''' #! /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
Please double check that tutorial. The
paramsscope is meant to be written in a separate file in yourprojectDircallednextflow.confignot in themain.nf. But if you do specify parameters inmain.nf, you need to make sure they are set before they are accessed, and I also think that it's not possible to use thescope. Instead writeparams.query = '$PWD/input.fasta'.Regarding your question about the workflow: I think that you should first have a look at the concept of
Channelsinstead of using the process as written in any workflow. After quickly scrolling through that tutorial, I find it very difficult to get what nextflow really is about and only throws snippets of code that don't work out of the box at the readers. Also, I find it not very helpful, that it introduces parameters very early, but not process inputs/outputs and does not mentionChannelsbefore section 9. Maybe you should start with the basic concept from the official docs instead? https://www.nextflow.io/docs/latest/basic.html