Parameters Optimization with Nextflow

Recently I have used Nextflow to try different parameters for a tool and found it worth sharing.

We start by defining parameters:

param1 = [50,70,90]
param2 = [1,2,3,4,5]
param3 = [0.1,0.2,0.3]

Then we declare input, output and commands to run:

in_data = Channel.fromPath('test')

process test {

    path indata from in_data    

    each p1 from param1 
    each p2 from param2
    each p3 from param3


    publishDir "output", mode: 'copy' 
    path "${p1}_${p2}_${p3}" 

mkdir -p ${p1}_${p2}_${p3}

./binary \
--threads 1 \ 
--param1 ${p1} \
--param2 ${p2} \
--param3 ${p3} \
--input ${indata} \
--output ${p1}_${p2}_${p3}


Thats it 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s