forked from SBML-Kimlab/radar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb_stat.py
35 lines (35 loc) · 1.73 KB
/
db_stat.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
#import subprocess
from radar import *
#from sero import dir_wgs
import radar
class db_statistics :
def __init__( self, strain, db ) :
self.strain = strain
self.db = db
pass
@staticmethod
def db_stat( strain, db ) :
dir_db = radar.db_dir
db0 = db.replace( ".faa", "" )
if db0 == "BARDS" :
file_ntdb = dir_db + "BARDS.fasta"; file_aadb = dir_db + "BARDS.faa"; file_udb = dir_db + "BARDS.udb"
if os.path.isfile( file_ntdb ) == False :
print ( "Fatal error : No nucleotide database on ... %s" % dir_db )
print ( "Please Download RADAR DB(nt) on website" )
else :
ntdb_open = open( file_ntdb )
dic_ntdb = SeqIO.to_dict( SeqIO.parse( ntdb_open, "fasta" ) )
print ( "Total Antibiotics resistance genes : %s" % len( dic_ntdb ) )
if os.path.isfile( file_aadb ) == False :
print ( "Fatal error : No peptide database on ... %s" % dir_db )
print ( "Please Download RADAR DB(aa) on website" )
else : print ( "The peptide database existed... %s" % file_aadb )
if db0 == "USER_DB" :
file_aadb = dir_db + "USER_DB.faa"; file_udb = dir_db + "USER_DB.udb"
if os.path.isfile( file_aadb ) == False :
print ( "Fatal error : No user-defined database on ... %s" % dir_db )
print ( "Please Upload USER-DEFINED DATABASE... (/database/USER_DB.faa)" )
else :
aadb_open = open( file_aadb )
dic_aadb = SeqIO.to_dict( SeqIO.parse( aadb_open, "fasta" ) )
print ( "Total included genes: %s" % len( dic_aadb ) )