File: test_MEME.py

package info (click to toggle)
python-biopython 1.54-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 25,400 kB
  • ctags: 10,975
  • sloc: python: 116,757; xml: 33,167; ansic: 8,622; sql: 1,488; makefile: 147
file content (64 lines) | stat: -rw-r--r-- 1,689 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# 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

#Bio.MEME is deprecated now, but I want to keep testing it until
#it is removed (without showing the deprecation warning)
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
from Bio.MEME import Parser
warnings.resetwarnings()

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))