Import parameters from another file (or other variables)

860 views
Skip to first unread message

Z

unread,
Nov 15, 2018, 6:58:24 AM11/15/18
to Nextflow
Hello Paolo,

I hope you're doing good !

I tried to search if someone asked this question previously but I couldn't find anything. Let's say I have a main.nf that contains the parameters defined at the top along other variables and a nextflow.config. I tried to create a params.config and put them inside the file. Then I edited nextflow.config to includeConfig "params.config".  Is there a way to tell Nextflow that the parameters given at the terminal are for params.config and not for main.nf ?

Thanks !

Z

unread,
Nov 15, 2018, 8:50:29 AM11/15/18
to Nextflow
Oh and I have another question please. As you know, I am using SLURM to run my jobs. When I use publishDir, the outputs are copied/moved to the local path given. How can I tell Nextflow to pass the path of publishDir to SLURM and outputs the results in the directory of the compute node instead of a local directory. if it is not possible, then I guess it must be a shared directory too ?

Paolo Di Tommaso

unread,
Nov 15, 2018, 9:02:20 AM11/15/18
to next...@googlegroups.com
> Is there a way to tell Nextflow that the parameters given at the terminal are for params.config and not for main.nf ?

Quick answer: no. 

p
 

--
You received this message because you are subscribed to the Google Groups "Nextflow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nextflow+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/nextflow.
For more options, visit https://groups.google.com/d/optout.

Paolo Di Tommaso

unread,
Nov 15, 2018, 9:03:42 AM11/15/18
to next...@googlegroups.com
> How can I tell Nextflow to pass the path of publishDir to SLURM and outputs the results in the directory of the compute node instead of a local directory

This does not make much sense for what publishDir is designed for. 


p

--

Z

unread,
Nov 15, 2018, 11:08:52 AM11/15/18
to Nextflow
Hey Paolo,

Sorry could you please explain me what do you mean by that ? Maybe I didn't explain myself better. I am using publishDir to output my results in a particular directory. When using SLURM, he publishes the results in a path on the controller node (local) instead of the computing nodes directory (remote).

Thanks !

Paolo Di Tommaso

unread,
Nov 19, 2018, 2:00:28 AM11/19/18
to next...@googlegroups.com
The publishDir is not aware if the path is local or remote. Therefore if you want that files in a remote directory, you need to provide a shared file system path (accessible from the computing node) that allows you to write that files remotely. 


p

Steve

unread,
Nov 28, 2018, 11:46:35 AM11/28/18
to Nextflow
In regards to "importing parameters from another file", I have found it useful to import from a JSON file instead. Example usage here:

The basic code would look something like this:


import groovy.json.JsonSlurper
def jsonSlurper = new JsonSlurper()


// new File object from your JSON file

def ConfigFile = new File("config.json")


// load the text from the JSON

String ConfigJSON = ConfigFile.text


// create a dictionary object from the JSON text

def myConfig = jsonSlurper.parseText(ConfigJSON)


// access values in the dict
log
.info "Some val: ${myConfig.some_val}"

Paolo Di Tommaso

unread,
Nov 29, 2018, 3:30:32 AM11/29/18
to next...@googlegroups.com
This is a good candidate for the patterns page 



p

--
Reply all
Reply to author
Forward
0 new messages