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():
taxid2name[taxid] = name
with open(finalPredictionsFile,'w') as outFile:
for query in objReturn:
for i in range(0,len(objReturn[query])):
if not objReturn[query][i] is None:
data = objReturn[query][i]
evalue = data[I_EVALUE]
bitscore = data[SCORE]
modid = data[MODEL_NAME]
modbeg = data[MODEL_START]
modend = data[MODEL_END]
modlen = data[MODEL_LEN]
domid = data[TARGET_ACC]
seqid = data[QUERY_NAME]
seqbeg = data[SEQ_START]
seqend = data[SEQ_END]
seqlen = data[SEQ_LEN]
accuracy = data[ACCURACY]
modtaxid = data[MODEL_TAXID]
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')
for query in sorted(objReturn.keys()):
sortedHits = sorted( (data for data in objReturn[query] if data is not None), key=lambda d:d[SEQ_START] )
for data in sortedHits:
evalue = data[I_EVALUE]
bitscore = data[SCORE]
modid = data[MODEL_NAME]
modbeg = data[MODEL_START]
modend = data[MODEL_END]
modlen = data[MODEL_LEN]
domid = data[TARGET_ACC]
seqid = data[QUERY_NAME]
seqbeg = data[SEQ_START]
seqend = data[SEQ_END]
seqlen = data[SEQ_LEN]
accuracy = data[ACCURACY]
modtaxid = data[MODEL_TAXID]
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')
# END OF ARI CODE #
runtime = time.time()-start_time
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