Commit b789b9ea by Riccardo Vicedomini

domain annotation is now sorted by sequence-id and sequence-start for simple architecture output

parent 32ef540c
...@@ -147,25 +147,24 @@ def main(): ...@@ -147,25 +147,24 @@ def main():
taxid2name[taxid] = name taxid2name[taxid] = name
with open(finalPredictionsFile,'w') as outFile: with open(finalPredictionsFile,'w') as outFile:
for query in objReturn: for query in sorted(objReturn.keys()):
for i in range(0,len(objReturn[query])): sortedHits = sorted( (data for data in objReturn[query] if data is not None), key=lambda d:d[SEQ_START] )
if not objReturn[query][i] is None: for data in sortedHits:
data = objReturn[query][i] evalue = data[I_EVALUE]
evalue = data[I_EVALUE] bitscore = data[SCORE]
bitscore = data[SCORE] modid = data[MODEL_NAME]
modid = data[MODEL_NAME] modbeg = data[MODEL_START]
modbeg = data[MODEL_START] modend = data[MODEL_END]
modend = data[MODEL_END] modlen = data[MODEL_LEN]
modlen = data[MODEL_LEN] domid = data[TARGET_ACC]
domid = data[TARGET_ACC] seqid = data[QUERY_NAME]
seqid = data[QUERY_NAME] seqbeg = data[SEQ_START]
seqbeg = data[SEQ_START] seqend = data[SEQ_END]
seqend = data[SEQ_END] seqlen = data[SEQ_LEN]
seqlen = data[SEQ_LEN] accuracy = data[ACCURACY]
accuracy = data[ACCURACY] modtaxid = data[MODEL_TAXID]
modtaxid = data[MODEL_TAXID] modtaxname = taxid2name.get(modtaxid,'unavailable')
modtaxname = taxid2name.get(modtaxid,'unavailable') outFile.write(f'{seqid}\t{seqbeg}\t{seqend}\t{seqlen}\t{domid}\t{modid}\t{modbeg}\t{modend}\t{modlen}\t{evalue}\t{bitscore}\t{accuracy}\t{modtaxname}\n')
outFile.write(f'{seqid}\t{seqbeg}\t{seqend}\t{seqlen}\t{domid}\t{modid}\t{modbeg}\t{modend}\t{modlen}\t{evalue}\t{bitscore}\t{accuracy}\t{modtaxname}\n')
# END OF ARI CODE # # END OF ARI CODE #
runtime = time.time()-start_time runtime = time.time()-start_time
eprint(f'[{script_name}] runtime: {runtime:.2f}') eprint(f'[{script_name}] runtime: {runtime:.2f}')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment