Commit a2f733d3 authored by hmueller's avatar hmueller
Browse files

Remove redundant sequence id field from results section of targetp in json output.

parent 7b15f5e7
......@@ -4,9 +4,9 @@ import sys
import json
import argparse
parser = argparse.ArgumentParser(description = 'Convert targetp results to json documents')
parser.add_argument('--result', '-r', required = True, help = 'The targetp results directory')
parser.add_argument('--output', '-o', required = True, help = 'The converted results json file')
parser = argparse.ArgumentParser(description='Convert targetp results to json documents')
parser.add_argument('--result', '-r', required=True, help='The targetp results directory')
parser.add_argument('--output', '-o', required=True, help='The converted results json file')
args = parser.parse_args()
loc_dict = {"C": "chloroplast", "M": "mitochondrion", "S": "secretory pathway", "_": "other", "*": "undetermined"}
......@@ -16,7 +16,7 @@ documents = {}
with open(filename) as f:
tool = None
field_index = {"Name": None, "cTP": None, "mTP": None, "SP": None, "Loc": None}
field_index = {"cTP": None, "mTP": None, "SP": None, "Loc": None}
is_datasection = False
for line in f:
......@@ -29,12 +29,10 @@ with open(filename) as f:
results = documents[split[0]]['computations'][0]["results"][0]
for field in field_index:
if field_index[field] is not None:
if field in ["cTP", "mTP", "SP"]:
results[field.lower()] = float(split[field_index[field]])
elif field == "Loc":
if field == "Loc":
results[field.lower()] = loc_dict[split[field_index[field]]]
else:
results[field.lower()] = split[field_index[field]]
results[field.lower()] = float(split[field_index[field]])
else:
if line.startswith('Name '):
split = line.split()
......
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