forked from plantismash/plantismash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_activeSiteFinder.py
executable file
·50 lines (37 loc) · 1.42 KB
/
test_activeSiteFinder.py
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
#!/usr/bin/env python
# Small script for testing the active site finder library without the whole antiSMASH Overhead
import helperlibs.bio.seqio
import antismash.generic_modules.active_site_finder
import antismash.config
import logging
import sys
from Bio import SeqIO
from argparse import Namespace
from antismash import utils
def main():
GenbankFile = ""
logging.basicConfig(format='%(levelname)s: %(message)s', level="DEBUG")
if len(sys.argv)>1:
if utils.locate_file(sys.argv[1]):
GenbankFile = sys.argv[1]
else:
GenbankFile = "/Users/karl/test/test.gb"
#GenbankFile = "/Users/karl/Documents/test/NC_018750.1.final.gbk"
#OutFile = "/Users/karl/Documents/test/test.gbk"
OutFile = "/Users/karl/test-asf.gbk"
options = Namespace()
antismash.config.load_config(options)
seq_records = helperlibs.bio.seqio.parse(GenbankFile)
out_recs = []
for seq_record in seq_records:
ASFObj = antismash.generic_modules.active_site_finder.active_site_finder(seq_record, options)
status = ASFObj.execute()
if status == True:
logging.debug("preparation/execution successful")
out_recs.append(seq_record)
else:
logging.debug("Error in preparation")
logging.debug("Writing output file")
SeqIO.write(out_recs, OutFile, "genbank")
if __name__ == "__main__":
main()