diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e814491..7d8f261b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [[#328]](https://github.com/nf-core/smrnaseq/pull/328) - Fix [casting issue](https://github.com/nf-core/smrnaseq/issues/327) in mirtrace module - [[#334]](https://github.com/nf-core/smrnaseq/pull/334) - Fix [input channel cardinality](https://github.com/nf-core/smrnaseq/issues/331) in `MIRDEEP2_RUN` module - [[#334]](https://github.com/nf-core/smrnaseq/pull/334) - Fix [bowtie conda version](https://github.com/nf-core/smrnaseq/issues/333) in `BOWTIE_MAP_SEQ` module +- [[#335]](https://github.com/nf-core/smrnaseq/pull/335) - Final fix for [casting issue](https://github.com/nf-core/smrnaseq/issues/327) in mirtrace module ### Software dependencies diff --git a/modules/local/mirtrace.nf b/modules/local/mirtrace.nf index 470ec95c..d9b5eb39 100644 --- a/modules/local/mirtrace.nf +++ b/modules/local/mirtrace.nf @@ -7,7 +7,8 @@ process MIRTRACE_RUN { 'biocontainers/mirtrace:1.0.1--hdfd78af_1' }" input: - tuple val(adapter), val(ids), val(reads) + tuple val(adapter), val(ids), path(reads) + path(mirtrace_config) output: path "mirtrace/*" , emit: mirtrace @@ -25,19 +26,15 @@ process MIRTRACE_RUN { tmem = task.memory.toBytes() java_mem = "-Xms${tmem} -Xmx${tmem}" } - def config_lines = [ids,reads] - .transpose() - .collect({ id, path -> "echo '${path},${id}' >> mirtrace_config" }) + """ export mirtracejar=\$(dirname \$(which mirtrace)) - ${config_lines.join("\n ")} - java $java_mem -jar \$mirtracejar/mirtrace.jar --mirtrace-wrapper-name mirtrace qc \\ --species $params.mirtrace_species \\ $primer \\ $protocol \\ - --config mirtrace_config \\ + --config $mirtrace_config \\ --write-fasta \\ --output-dir mirtrace \\ --force diff --git a/subworkflows/local/mirtrace.nf b/subworkflows/local/mirtrace.nf index 317c4444..d9dea8b6 100644 --- a/subworkflows/local/mirtrace.nf +++ b/subworkflows/local/mirtrace.nf @@ -9,7 +9,18 @@ workflow MIRTRACE { reads // channel: [ val(adapterseq), [ val(ids) ], [ path(reads) ] ] main: - reads | MIRTRACE_RUN + + //Staging the files as path() but then getting the filenames for the config file that mirtrace needs + //Directly using val(reads) as in previous versions is not reliable as staging between work directories is not 100% reliable if not explicitly defined via nextflow itself + ch_mirtrace_config = + reads.map { adapter, ids, reads -> [ids,reads]} + .transpose() + .collectFile { id, path -> "./${path.getFileName().toString()}\n" } // operations need a channel, so, should be outside the module + + MIRTRACE_RUN ( + reads, + ch_mirtrace_config + ) emit: results = MIRTRACE_RUN.out.mirtrace