Nextflow DSL2 error while constructing BLAST pipeline
1
0
Entering edit mode
14 months ago
` ''' #! /usr/bin/env nextflow

nextflow.enable.dsl=2

println "\nI want to BLAST $params.query to $params.dbDir/$params.dbName using $params.threads CPUs and output it to $params.outdir\n"


process runBlast {

script:
    """
    blastn  -num_threads $params.threads -db $params.dbDir/$params.dbName -query $params.query -outfmt 6 -out input.blastout
    """

}


params {
query = "$PWD/input.fasta"
dbDir = "$PWD/DB/"
dbName = "blastDB"
threads = 2
outdir = "out_dir"
}

`

What workflow {} statement should I add to the main.nf file? The basic BLAST command works, but it does not take additional parameters when added to the command line. The error I get is as follows:

ERROR ~ No such variable: query

Please help if you can, thank you!

I have been following this tutorial: https://bioinformaticsworkbook.org/dataAnalysis/nextflow/02_creatingAworkflow.html#gsc.tab=0

And using this DSL2 documentation for support: https://www.nextflow.io/docs/latest/dsl2.html

nextflow pipeline BLAST dsl2 • 577 views
ADD COMMENT
1
Entering edit mode
14 months ago

try (not tested)


nextflow.enable.dsl=2

params.query = "$PWD/input.fasta"
params.dbDir = "$PWD/DB/"
params.dbName = "blastDB"



workflow {
runBlast("${params.dbDir}/${params.dbName}","${params.query}")
}



process runBlast {
cpus 2
input:
    val(dbFile)
    val(query)
script:
    """
    blastn  -num_threads ${task.cpus} -db '${dbFile}' -query '${query}' -outfmt 6 -out blast.out
    """
}

also do not use variable like params.outdir but use the publishDir directive (see NF manual)

ADD COMMENT

Login before adding your answer.

Traffic: 2033 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6