File: test_cut.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 (42 lines) | stat: -rw-r--r-- 1,156 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
#!/usr/bin/env python

from cogent.util.unit_test import TestCase, main
from cogent.parse.cut import cut_parser

__author__ = "Rob Knight"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__contributors__ = ["Rob Knight"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Rob Knight"
__email__ = "rob@spot.colorado.edu"
__status__ = "Development"

class CutParserTest(TestCase):
    """Provides tests for codon usage table parser"""
    def test_cut_parser(self):
        """cut_parser should work on first few lines of supplied file"""
        lines = """#Species: Saccharomyces cerevisiae
#Division: gbpln
#Release: TranstermMay1994
#CdsCount: 24

#Coding GC 44.99%
#1st letter GC 47.28%
#2nd letter GC 40.83%
#3rd letter GC 46.86%

#Codon AA Fraction Frequency Number
GCA    A     0.010     1.040      6
GCC    A     0.240    22.420    130
GCG    A     0.000     0.000      0
GCT    A     0.750    71.610    411
TGC    C     0.070     0.520      3
"""
        result = cut_parser(lines.splitlines())
        self.assertEqual(result, \
            {'GCA':6,'GCC':130,'GCG':0,'GCT':411,'TGC':3})
if __name__ == '__main__':
    main()