File: test_consan.py

package info (click to toggle)
python-cogent 1.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,424 kB
  • ctags: 24,343
  • sloc: python: 134,200; makefile: 100; ansic: 17; sh: 10
file content (46 lines) | stat: -rw-r--r-- 1,463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python

from cogent.util.unit_test import TestCase, main
from cogent.core.info import Info
from cogent.parse.consan import consan_parser

__author__ = "Shandy Wikman"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__contributors__ = ["Shandy Wikman"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Shandy Wikman"
__email__ = "ens01svn@cs.umu.se"
__status__ = "Development"

class ConsanParserTest(TestCase):
    """Provides tests for CONSAN RNA secondary structure parsers"""

    def setUp(self):
        """Setup function"""
        
        #output
        self.consan_out = CONSAN
        #expected
        self.consan_exp = [{'seq1':'GGACACGUCGCUCA','seq2':'G.ACAGAUCGCUCA'},
                            [(0,13),(2,11),(5,8)]]

        
    def test_consan_output(self):
        """Test for consan format parser"""
        
        obs = consan_parser(self.consan_out)
        self.assertEqual(obs,self.consan_exp)

CONSAN = ['Using standard STA scoring\n', 
'Using QRADIUS constraints (Quality > 0.9500 SPACED 20) !\n', 
'# STOCKHOLM 1.0\n', '\n', '#=GF SC\t 1.000000\n', '#=GF PI\t 0.720000\n', 
'#=GF ME\t QRadius  Num: 3  Win: 20  Cutoff: 0.95\n', 
'\n', 'seq1                \tGGACACGUCGCUCA\n', 
'seq2                \tG.ACAGAUCGCUCA\n', 
'#=GC SS_cons\t\t    >.>..>..<..<.<\n', 
'#=GC PN \t\t        .......*......\n', '\n', '\n', '\n', 
'#=GF TIME  43.0\n', '\n', '//\n']

if __name__ == '__main__':
    main()