Commit 458a3c11 authored by lmueller's avatar lmueller
Browse files

added resolve_dbxrefs.py to nextflow.py (not working yet)

parent 57eb76c6
......@@ -74,6 +74,21 @@ process convert_${id}_to_json {
"""
}
''')
fetch_template = Template('''
process fetch_dbxrefs {
input:
file result from ${id}_fetch_json
output:
file "$${result}_fetched.json" into ${id}_json
script:
"""
resolve_dbxrefs.py --input $$result --retreiver ../dbxref/scripts --output $${result}_fetched.json
"""
}
''')
input_template = Template(''' file ${id}_result from ${id}_json''')
join_jsons_template = Template('''
process join_documents {
......@@ -153,8 +168,9 @@ Channel.fromPath(params.fasta).set{fasta}''')
for m in modules:
json_inputs.append(input_template.substitute(m))
# fragments.append(fetch_template.substitute(flatten(m)))
fragments.append(join_jsons_template.substitute({'inputs': '\n'.join(json_inputs)}))
fragments.append(split_jsons_template.substitute(execution))
nextflow_script = '\n'.join(fragments)
return nextflow_script
......@@ -7,6 +7,7 @@ import sys
parser = argparse.ArgumentParser(description='Resolve dbxrefs from json file')
parser.add_argument('--input', '-i', required=True, help='The json input document')
parser.add_argument('--retriever', '-s', required=True, help='Location of retriever')
parser.add_argument('--output', '-o', required=True, help='The json output document')
args = parser.parse_args()
basename = args.retriever.replace('scripts/', '')
......@@ -30,6 +31,7 @@ for c in j['computations']:
if 'target'in r and 'dbxref' in r['target']:
r['target']['dbxref'] = {'dbxref': r['target']['dbxref'], 'informations': next(entry for entry in entries if entry['id'] == r['target']['dbxref'])}
with open(args.input, 'w') as o:
#with open(args.input, 'w') as o:
with open(args.output, 'w') as o:
json.dump(j, o)
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