Grettings!
I am trying to get to run bowtie2 using Nextflow with a pre-built hg38 index.
My Nextflow script looks like this:
params.reads = "$baseDir/data/library.fq"
params.index = "$baseDir/data/index/GRCh38_noalt_as"
params.outdir = "results"
log.info """
bowtie2 test
===================================
index : ${params.index}
reads : ${params.reads}
outdir : ${params.outdir}
"""
.stripIndent()
process bowtie2 {
publishDir params.outdir, mode:'copy'
input:
path reads from params.reads
path index from params.index
output:
path 'mapping.sam' into bowtie2_ch
script:
"""
bowtie2 -x $index -U $reads -S mapping.sam
"""
}
When I run this I get the following error:
Error executing process > 'bowtie2'
Caused by: Process
bowtie2
terminated with an error exit status (255)Command executed:
bowtie2 -x GRCh38_noalt_as -U library.fq -S mapping.sam
Command exit status: 255
Command output: (empty)
Command error: (ERR): "GRCh38_noalt_as" does not exist or is not a Bowtie 2 index Exiting now ...
When I run the command executed in the terminal the mapping works. So the index files do exist and their names are correct.
I tried several different approaches as creating a channel before the process for the index files and try to use it as an input but nothing worked so far.
Any help would be highly appreciated! :)
Thank you so much for your detailed answer! I will definitely switch to DSL2 when I am more comfortable with DSL1.
I added the bash script and this time I am getting a different error:
I am a little bit tried fighting with this all day so maybe I am missing something.
Edit: After coming back to it from a break this actually worked! I just needed to change the params.index from "$baseDir/data/index/GRCh38_noalt_as" to "$baseDir/data/index/"
Thanks a lot!
Nextflow has advantages without questions, but it is neither easy nor simple, and sometimes a PITA, I definitely feel you. At some point you're comfortable enough and have some template workflows that you can recycle for daily use, but it's definitely a steep learning curve. At least it was for me.