Commit e7854eff authored by Marc's avatar Marc
Browse files

run scripts can now "look up" if they were started inside of the container

parent 4d48a8a1
#!/usr/bin/env python3
import argparse
from psot import config
from os import system,makedirs
from os import system,makedirs,environ
signalp_tool = config.load_config()['tools'].get('signalp', 'signalp')
def find_tool_path():
from psot import config
return config.load_config()['tools'].get('signalp', 'signalp')
signalp_tool = ''
if 'INSIDE_CONTAINER' in environ:
signalp_tool = 'signalp'
else:
signalp_tool = find_tool_path()
parser = argparse.ArgumentParser(description='Find signal peptides in amino acid sequences')
parser.add_argument('--fasta', '-f', required=True, help='A fasta file with aminoacid sequences')
......
#!/usr/bin/env python3
import argparse
from psot import config
from os import system,makedirs,path
from os import system,makedirs,path,environ
import subprocess
cfg = config.load_config()
targetp_tool = cfg['tools'].get('targetp', 'targetp')
def find_tool_path():
from psot import config
cfg = config.load_config()
return cfg['tools'].get('targetp', 'targetp'), cfg['helpers_path'] + '/reduce_fasta_headers_to_enumeration.py'
targetp_tool = ''
reduce_headers_tool =''
if 'INSIDE_CONTAINER' in environ:
targetp_tool = 'targetp'
reduce_headers_tool = 'reduce_fasta_headers_to_enumeration.py'
else:
targetp_tool, reduce_headers_tool = find_tool_path()
org_flags = {'plant': '-P', 'non-plant': '-N'}
......@@ -19,7 +29,6 @@ args = parser.parse_args()
makedirs(args.output, exist_ok=True)
# Swap fasta headers for unique numbers to avoid truncation
reduce_headers_tool = cfg['helpers_path'] + '/reduce_fasta_headers_to_enumeration.py'
subprocess.run([reduce_headers_tool, "-f", args.fasta, "-e", args.output + '/enum_headers.tsv'])
results_file = args.output + '/results.txt'
......
#!/usr/bin/env python3
import argparse
from psot import config
from os import system
import subprocess
from os import system,environ
def find_tool_path():
from psot import config
return config.load_config()['tools'].get('tmhmm', 'tmhmm')
tmhmm_tool = ''
tmhmm_tool = config.load_config()['tools'].get('tmhmm', 'tmhmm')
if 'INSIDE_CONTAINER' in environ:
tmhmm_tool = 'tmhmm'
else:
tmhmm_tool = find_tool_path()
parser = argparse.ArgumentParser(description='Find transmembrane helices in amino acid sequences')
parser.add_argument('--fasta', '-f', required=True, help='A fasta file with aminoacid sequences')
......
......@@ -126,7 +126,7 @@ process retrieve_informations_for_${id} {
"""
}
''')
input_template = Template(''' file ${id}_result from ${id}_json.collect()''')
input_template = Template('''file ${id}_result from ${id}_json.collect()''')
join_jsons_template = Template('''
process join_documents {
......@@ -237,8 +237,8 @@ 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(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)
......
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