Commit 4d48a8a1 authored by Marc's avatar Marc
Browse files

netxflow.py generates a nextflow.config file now; add container element in...

netxflow.py generates a nextflow.config file now; add container element in some modules in the default_repo
parent 5f2bbc99
......@@ -13,6 +13,8 @@ analysis:
script: 'run_signalp.py'
# specify additional default configuration here
parameters:
# run script in a container
container: 'psot'
# The configuration of the script for the json conversion step.
converter:
......
......@@ -13,6 +13,8 @@ analysis:
script: 'run_targetp.py'
# specify additional default configuration here
parameters:
# run script in a container
container: 'psot'
# The configuration of the script for the json conversion step.
converter:
......
......@@ -13,6 +13,8 @@ analysis:
script: 'run_tmhmm.py'
# specify additional default configuration here
parameters:
# run script in a container
container: 'psot'
# The configuration of the script for the json conversion step.
converter:
......
......@@ -160,6 +160,13 @@ process split_documents {
}
''')
process_config_template = Template('''
withName:${id}{
${container}
}
'''
)
def setup_execution_directory(execution):
directory = execution['directory']
if not os.path.exists(directory):
......@@ -170,6 +177,10 @@ def setup_execution_directory(execution):
nextflow_script = generate_nextflow_script(execution)
with open(directory + '/main.nf', 'w') as script_file:
script_file.write(nextflow_script)
nextflow_config = generate_nextflow_config(execution)
with open(directory + '/nextflow.config', 'w') as config_file:
config_file.write(nextflow_config)
if not os.path.exists(directory + '/bin'):
os.symlink(os.path.join(execution['install_path'], 'helpers'), directory + '/bin')
......@@ -232,3 +243,25 @@ Channel.fromPath(params.fasta).set{fasta}''')
nextflow_script = '\n'.join(fragments)
return nextflow_script
def generate_nextflow_config(execution):
modules = execution['modules']
fragments = []
fragments.append('''docker.enabled = true''')
fragments.append('''process { ''')
for m in modules:
config = {}
if m['analysis']['container']:
config['id'] = m['id']
config['container'] = "container = " + "'" + m['analysis']['container'] + "'"
fragments.append(process_config_template.substitute(config))
fragments.append('''}''')
nextflow_config = '\n'.join(fragments)
return nextflow_config
\ No newline at end of file
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