File: test_MEME.py

package info (click to toggle)
python-biopython 1.45-3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 18,192 kB
  • ctags: 12,310
  • sloc: python: 83,505; xml: 13,834; ansic: 7,015; cpp: 1,855; sql: 1,144; makefile: 179
file content (57 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
# Copyright 2004 by Jason A. Hackney.  All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license.  Please see the LICENSE file that should have been included
# as part of this package.

import os
import string
from Bio.MEME import Parser
from Bio import ParserSupport
from Bio.File import UndoHandle

meme_tests = [
    "meme.dna.oops.txt",
    "meme.protein.oops.txt",
    "meme.protein.tcm.txt"
    ]
    
mast_tests = [
    "mast.dna.oops.txt",
    "mast.protein.oops.txt",
    "mast.protein.tcm.txt"
    ]


print "Testing MEME Scanner"

datafile = os.path.join("MEME", meme_tests[0])
uhandle = UndoHandle(open(datafile))
scanner = Parser._MEMEScanner()
consumer = ParserSupport.TaggingConsumer()
scanner.feed(uhandle, consumer)
    
print "Running tests on MEME parser"    

meme_parser = Parser.MEMEParser()

for test in meme_tests:
    print "*" * 50, "TESTING %s" % test
    datafile = os.path.join("MEME", test)
    rec = meme_parser.parse(open(datafile))

print "Testing MEME Scanner"

datafile = os.path.join("MEME", mast_tests[0])
uhandle = UndoHandle(open(datafile))
scanner = Parser._MASTScanner()
consumer = ParserSupport.TaggingConsumer()
scanner.feed(uhandle, consumer)    
   
print "Running tests on MAST parser"

mast_parser = Parser.MASTParser()

for test in mast_tests:
    print "*" * 50, "TESTING %s" % test
    datafile = os.path.join("MEME", test)
    rec = mast_parser.parse(open(datafile))