root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/bx/seq/fasta_tests.py

リビジョン 3, 1.2 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1"""
2Tests for `bx.seq.fasta`.
3"""
4
5import unittest
6import sys
7import os.path
8import fasta
9
10test_fa = "test_data/seq_tests/test.fa"
11
12# Same sequence data as stored in test.fa
13
14valid_seq = "TGGAGGCATTTGTGATTCAATAGATGCAGAAAGAAACCTTCCTAGAGCTG" \
15          + "GCGTTCTCTAACTAAAAGTGGAAAGTTCTGAGGAATGAGGACTGTTATAA" \
16          + "ATCCCACCCCACACCGCACCTTCTCCAGGGAAGTTTCATGGCCGTGAAGA" \
17          + "GGACAGAAAGTGAGAACCAAGATggaactgaataaacaagcttcacactg" \
18          + "ttagtttccccatatgcttaccttcccacagatgccaaccttggaggcct" \
19          + "aagaggcctagaatattatcctttgtctgatcatttctctacaaatttat" \
20          + "tgttctttgttaagatgctacataagcccaaattctaaccacccctttga" \
21          + "gttacccatcatcaagtttctcccatgtg"
22
23valid_seq_len = len( valid_seq )
24
25class FASTATestCase( unittest.TestCase ):
26
27    def test_get( self ):
28        fastafile = fasta.FastaFile( file(test_fa, "rb" ) )
29        check_get(fastafile, 0, valid_seq_len)
30        check_get(fastafile, 0, 40)
31        check_get(fastafile, valid_seq_len - 40, 40)
32
33def check_get( fastafile, start, len ):
34    assert fastafile.get( start, len ) == valid_seq[start:start+len]
35
36test_classes = [ FASTATestCase ]
37suite = unittest.TestSuite( [ unittest.makeSuite( c ) for c in test_classes ] )
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。