Skip to content

Commit e380f0e

Browse files
Jon PalmerJon Palmer
Jon Palmer
authored and
Jon Palmer
committed
add tbl2asn ERROR parsing to update script
1 parent 92b44f6 commit e380f0e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

bin/funannotate-update.py

+32
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,38 @@ def compareAnnotations(old, new, output):
15461546
compareAnnotations(GBK, final_gbk, Changes)
15471547

15481548
lib.log.info("Funannotate update is finished, output files are in the %s/update_results folder" % (args.out))
1549+
#check if there are error that need to be fixed
1550+
ncbi_error = 0
1551+
with open(final_error, 'rU') as errors:
1552+
for line in errors:
1553+
line = line.strip()
1554+
if 'ERROR' in line:
1555+
num = line.split(' ')[0]
1556+
ncbi_error = ncbi_error + int(num)
1557+
1558+
if ncbi_error > 0:
1559+
#see if we can get the gene models that need to be fixed
1560+
needFixing = {}
1561+
with open(final_validation, 'rU') as validationFile:
1562+
for line in validationFile:
1563+
line = line.strip()
1564+
if line.startswith('ERROR'):
1565+
ID = line.split('gnl|ncbi|')[-1].replace('-T1]', '')
1566+
reason = line.split(' FEATURE:')[0]
1567+
reason = reason.split('] ')[-1]
1568+
if not ID in needFixing:
1569+
needFixing[ID] = reason
1570+
lib.log.info("There are %i gene models that need to be fixed." % ncbi_error)
1571+
print('-------------------------------------------------------')
1572+
with open(final_fixes, 'w') as fixout:
1573+
fixout.write('#GeneID\tError Message\n')
1574+
for k,v in natsorted(needFixing.items()):
1575+
fixout.write('%s\t%s\n' % (k,v))
1576+
print('%s\t%s' % (k,v))
1577+
print('-------------------------------------------------------')
1578+
lib.log.info("Manually edit the tbl file %s, then run:\n\nfunannotate fix -i %s -t %s\n" % (final_tbl, final_gbk, final_tbl))
1579+
lib.log.info("After the problematic gene models are fixed, you can proceed with functional annotation.")
1580+
15491581
lib.log.info("Your next step might be functional annotation, suggested commands:\n\
15501582
-------------------------------------------------------\n\
15511583
Run InterProScan (Docker required): \n{:} -i={:} -c={:}\n\n\

0 commit comments

Comments
 (0)