Skip to content
Snippets Groups Projects
Commit c120d853 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Fix bug: blastp converter ignores sequences without hits

parent 7a52f072
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python3
import sys
import glob
import json
import argparse
......@@ -63,6 +64,20 @@ with open(filename) as f:
results.append(result)
# add entries for files with no results
queries = []
path = "*.ids"
for filename in glob.glob(path):
with open(filename) as f:
for line in f:
if line.startswith('>'):
queries.append(line.split()[0].strip().lstrip('>'))
else:
queries.append(line.split()[0].strip())
for query_id in queries:
if not query_id in documents:
documents[query_id] = {"id": query_id, "computations": [{'tool': tool, 'results':[]}]}
output_filename = args.output
with open(output_filename, 'w') as o:
json.dump(documents, o)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment