Skip to content

Commit eaf4715

Browse files
Jon PalmerJon Palmer
authored andcommitted
detect old go.obo
1 parent 2d77e3b commit eaf4715

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

bin/funannotate-compare.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

784788
table = []
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']
786790
for 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

Comments
 (0)