Skip to content

Commit

Permalink
Merge pull request #335 from nf-core/fix-mirtrace-staging-bug
Browse files Browse the repository at this point in the history
Fix mirtrace staging bug
  • Loading branch information
apeltzer authored Apr 3, 2024
2 parents 151d33d + 5d3b78f commit 18d4eba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 4 additions & 7 deletions modules/local/mirtrace.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 12 additions & 1 deletion subworkflows/local/mirtrace.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 18d4eba

Please sign in to comment.