@@ -770,7 +770,11 @@ def __init__(self,prog):
770770 gos = col [1 ].split (';' )
771771 goList = []
772772 for i in gos :
773- description = i + ' ' + goLookup [i ].name
773+ try :
774+ description = i + ' ' + goLookup [i ].name
775+ except KeyError :
776+ print '%s not found in go.obo, try to download updated go file' % i
777+ description = i
774778 goList .append (description )
775779 goDict [col [0 ]] = goList
776780
@@ -782,7 +786,7 @@ def __init__(self,prog):
782786
783787
784788table = []
785- header = ['GeneID' ,'length' ,'description' , 'Ortho Group' , 'EggNog' , 'BUSCO' , 'Secreted' , 'Protease family' , 'CAZyme family' , 'InterPro Domains' , 'PFAM Domains' , 'GO terms' , 'SecMet Cluster' , 'SMCOG' ]
789+ header = ['GeneID' ,'scaffold:start-end' , 'strand' , ' length' ,'description' , 'Ortho Group' , 'EggNog' , 'BUSCO' , 'Secreted' , 'Protease family' , 'CAZyme family' , 'InterPro Domains' , 'PFAM Domains' , 'GO terms' , 'SecMet Cluster' , 'SMCOG' ]
786790for y in range (0 ,num_input ):
787791 outputname = os .path .join (args .out , 'annotations' , scinames [y ]+ '.all.annotations.tsv' )
788792 with open (outputname , 'w' ) as output :
@@ -798,6 +802,14 @@ def __init__(self,prog):
798802 ID = f .qualifiers ['locus_tag' ][0 ]
799803 length = len (f .qualifiers ['translation' ][0 ])
800804 description = f .qualifiers ['product' ][0 ]
805+ start = f .location .nofuzzy_start
806+ end = f .location .nofuzzy_end
807+ chr = record .id
808+ location = str (chr )+ ':' + str (start )+ '-' + str (end )
809+ if f .location .strand == 1 :
810+ strand = '+'
811+ else :
812+ strand = '-'
801813 if ID in iprDict :
802814 IPRdomains = "; " .join (iprDict .get (ID ))
803815 else :
@@ -842,7 +854,7 @@ def __init__(self,prog):
842854 if i .startswith ('SMCOG:' ):
843855 smcog = i
844856
845- final_result = [ID , str (length ), description , orthogroup , egg , buscogroup , signalphit , meropsdomains , cazydomains , IPRdomains , pfamdomains , goTerms , cluster , smcog ]
857+ final_result = [ID , location , strand , str (length ), description , orthogroup , egg , buscogroup , signalphit , meropsdomains , cazydomains , IPRdomains , pfamdomains , goTerms , cluster , smcog ]
846858 output .write ("%s\n " % ('\t ' .join (final_result )))
847859############################################
848860
0 commit comments