I am trying to run a Nextflow process to run bowtie2-build. Attached is my code for the process. Does anyone have any idea how to solve the error "ERROR ~ Unexpected error while finalizing task 'BOWTIE_INDEX (1)' - cause: Not a valid PublishDir entry [org.codehaus.groovy.runtime.GStringImpl]". Note I've also included the relevant workflow and parameters.
process BOWTIE_INDEX {
publishDir params.ref_dir, mode = 'symlink'
conda 'bioconda::bowtie2'
input:
path reference_fa
output:
path 'GRCm38*'
script:
"""
bowtie2-build $reference_fa GRCm38
"""
}
workflow {
index = BOWTIE_INDEX(reference_fa)
}
params {
ref_dir = "$projectDir/reference/bowtie_index"
}
I am trying to index the fasta file for the mouse genome using bowtie2. The indexing process runs fine, but Nextflow fails as it tries to link the files in the publishDir. The files are generated correctly in the work directory.
This is just a syntax error. Instead, make sure to use a colon to specify the 'mode' option:
publishDir params.ref_dir, mode: 'symlink'
Which is just the same as:
publishDir(
path: params.ref_dir,
mode: 'symlink',
enabled: true,
)
Alternatively, directives can be specified in your nextflow.config. For example, using the withName
process selector:
params {
ref_dir = "${projectDir}/reference/bowtie_index"
}
process {
withName: 'BOWTIE_INDEX' {
publishDir = [
path: { "${params.ref_dir}/BOWTIE_INDEX" },
mode: 'copy',
enabled: true,
]
}
}