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

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

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

行番号 
1"""
2Tests for `bx.align.lav`.
3"""
4
5import unittest
6import sys
7import bx.align as align
8import bx.align.lav as lav
9
10test_lav = "test_data/lav_tests/apple_orange.lav"
11
12class lavTestCase(unittest.TestCase):
13
14    def testReader(self):
15
16        reader = lav.Reader(file(test_lav))
17
18        a = reader.next()
19        assert a.score == 10286, "a.score is wrong: %s" % a.score
20        assert len(a.components) == 2
21        check_component(a.components[0], "apple",            106, 252, "+", 411, "GTCCGGCCGGCTGAGAGCTACAATACACATGCACGCAGTTTGGCCACTCACATTAAGTATATGAGGAAGGGTTAGCATGAGTTGTACTATAAGGCAGCGGATAGCAGGTTGTGGAAAAATATCCTCCCGATTCAAATCCCCAGGTGCCTAAA----------------GTAGGGCCGGTAGTTGAATGCTTGCCTGTCAGACTGGATGACCAAGTTCAGTATCAACACAATATAGTGCCAGGAGCTAATTGTTCCCCAGCAGCGTGAC")
22        check_component(a.components[1], "lav_tests.orange",  53, 252, "+", 361, "GTCCGGCCGGCTGTGTGCTACAATACACGTTCACGCAGTTTGGCCAATCACTTTAAGTATATACGAAATGGTTACCATGAGTTGTACTGTAAGGCAGCGGAAAGC---TTGTTAA--------CTCCTGGGCGACATT----GGGGCTGCAACATCGTTTATCCTCCTCTACAACCAATAGCTG-TTGCTTCTTGGTTCAAGTATATCCCATGGATTAGTATCAACACGATATAGTGTCAGGAGCTAATTGTTCCCCAGCAGCGTGAC")
23
24        a = reader.next()
25        assert a.score == 3586, "a.score is wrong: %s" % a.score
26        assert len(a.components) == 2
27        check_component(a.components[0], "apple",             52,  72, "+", 411, "TGCATATCGACTATTACAGCCACGCGAGTTACATTCCTCTTTTTTTTTGCTGGCGTCCGGCCGGCTGAGAGC")
28        check_component(a.components[1], "lav_tests.orange",   2,  72, "-", 361, "TGCATATCGACTAGTACAGCCTCTCGAGTTACCCCCCCCATTCCTCTTGCTGACGTCACGCTGCTGGGGAAC")
29
30        a = reader.next()
31        assert a is None
32
33        reader.close()
34
35def check_component( c, src, start, size, strand, src_size, text ):
36    #..print "\"%s\" == \"%s\"" % (c.src,src)
37    assert c.src      == src,      "c.src = %s (expected %s)"          % (c.src,     src)
38    assert c.start    == start,    "c.start = %s (expected %s)"        % (c.start,   start)
39    assert c.size     == size,     "c.size = %s (expected %s)"         % (c.size,    size)
40    assert c.strand   == strand,   "c.strand = %s (expected %s)"       % (c.strand,  strand)
41    assert c.src_size == src_size, "c.src_size = %s (expected %s)"     % (c.src_size,src_size)
42    assert c.text     == text,     "c.text = \"%s\" (expected \"%s\")" % (c.text,    text)
43
44test_classes = [ lavTestCase ]
45suite = unittest.TestSuite([ unittest.makeSuite(c) for c in test_classes ])
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。