nextflow-io/patterns

Parsing from initial run argument into process scripts

DolapoA opened this issue · 3 comments

How do I parse an argument from the initiation command into one of my process scripts that's in another language like Python.

Initiation cmd:
nextflow run /Path/to/myscript.nf --in '/Path/to/MyData'

process dataDirectories {

"""
#!/usr/bin/env python2.7

import os
import getpass

currentUser=getpass.getuser()

dataPath="/home/" + currentUser + "/WGS_Data/" + MyData
resultsPath="/home/" + currentUser + "/WGS_Results/" + MyData

try:
	os.makedirs(dataPath, 0o777)    
	os.makedirs(resultsPath, 0o777)

except:
	pass
"""

}

I would like to get the string 'MyData' from the path (which is in my '--in' argument) into my python script.
Can this be done?

It's just a matter of string interpolation e.g. "/WGS_Data/${params.in}"

Ah yes that works thanks bro.

Enjoy