Skip to content

Commit

Permalink
Update mirtop modules and subworkflow (#6635)
Browse files Browse the repository at this point in the history
* add arity to mirtop/gff

* add prefix to mirtop output

* update tests and snapshots

* update yml
  • Loading branch information
atrigila authored Sep 13, 2024
1 parent aa8c39b commit 43b2b70
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 76 deletions.
4 changes: 2 additions & 2 deletions modules/nf-core/mirtop/counts/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nextflow_process {
when {
process {
"""
input[0] = MIRTOP_GFF.out.mirtop_gff
input[0] = MIRTOP_GFF.out.gff
input[1] = [
[ id:'hairpin'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/mirtop/hairpin_mirtop.fa", checkIfExists: true),
Expand Down Expand Up @@ -72,7 +72,7 @@ nextflow_process {
when {
process {
"""
input[0] = MIRTOP_GFF.out.mirtop_gff
input[0] = MIRTOP_GFF.out.gff
input[1] = [
[ id:'hairpin'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/mirtop/hairpin_mirtop.fa", checkIfExists: true),
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-core/mirtop/export/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ nextflow_process {
when {
process {
"""
input[0] = MIRTOP_GFF.out.mirtop_gff
input[0] = MIRTOP_GFF.out.gff
input[1] = [
[ id:'hairpin'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/mirtop/hairpin_mirtop.fa", checkIfExists: true),
Expand Down Expand Up @@ -66,7 +66,7 @@ nextflow_process {
when {
process {
"""
input[0] = MIRTOP_GFF.out.mirtop_gff
input[0] = MIRTOP_GFF.out.gff
input[1] = [
[ id:'hairpin'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/mirtop/hairpin_mirtop.fa", checkIfExists: true),
Expand Down
6 changes: 3 additions & 3 deletions modules/nf-core/mirtop/export/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{
"id": "sample_sim_isomir_bam"
},
"mirtop_rawData.tsv:md5,efbcbe67716a4a56f89e538af2251dcc"
"sample_sim_isomir_bam_mirtop_rawData.tsv:md5,efbcbe67716a4a56f89e538af2251dcc"
]
],
"1": [
Expand All @@ -82,7 +82,7 @@
{
"id": "sample_sim_isomir_bam"
},
"mirtop_rawData.tsv:md5,efbcbe67716a4a56f89e538af2251dcc"
"sample_sim_isomir_bam_mirtop_rawData.tsv:md5,efbcbe67716a4a56f89e538af2251dcc"
]
],
"vcf": [
Expand All @@ -97,6 +97,6 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-03T15:25:24.528528611"
"timestamp": "2024-09-12T23:12:49.612315132"
}
}
8 changes: 4 additions & 4 deletions modules/nf-core/mirtop/gff/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ process MIRTOP_GFF {
'biocontainers/mulled-v2-0c13ef770dd7cc5c76c2ce23ba6669234cf03385:63be019f50581cc5dfe4fc0f73ae50f2d4d661f7-0' }"

input:
tuple val(meta), path(bam)
tuple val(meta), path(bam, arity:'1..*')
tuple val(meta2), path(hairpin)
tuple val(meta3), path(gtf), val(species)

output:
tuple val(meta), path("mirtop/${bam.baseName}.gff") , emit: sample_gff
tuple val(meta), path("mirtop/mirtop.gff") , emit: mirtop_gff
tuple val(meta), path("mirtop/*mirtop.gff") , emit: gff
path "versions.yml" , emit: versions

when:
Expand All @@ -33,6 +32,8 @@ process MIRTOP_GFF {
-o mirtop \\
$bam
mv mirtop/mirtop.gff mirtop/${prefix}_mirtop.gff
cat <<-END_VERSIONS > versions.yml
"${task.process}":
mirtop: \$(echo \$(mirtop --version 2>&1) | sed 's/^.*mirtop //')
Expand All @@ -45,7 +46,6 @@ process MIRTOP_GFF {
"""
mkdir mirtop
touch mirtop/mirtop.gff
touch mirtop/sim_isomir_sort.gff
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
6 changes: 1 addition & 5 deletions modules/nf-core/mirtop/gff/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ output:
type: file
description: File containing software versions
pattern: "versions.yml"
- mirtop_gff:
type: file
description: GFF file
pattern: "*.{gff}"
- sample_gff:
- gff:
type: file
description: GFF file
pattern: "*.{gff}"
Expand Down
3 changes: 1 addition & 2 deletions modules/nf-core/mirtop/gff/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ nextflow_process {
{ assert process.success },
{ assert snapshot(
process.out.bam,
file(process.out.sample_gff[0][1]).readLines().findAll { it.contains("hsa-let-7a-2 miRBasev21 isomiR 3 25 0 + . Read TTGAGGTAGTAGGTTGTATAGTT; UID iso-23-Z0S31NSL0E; Name hsa-let-7a-5p;Parent hsa-let-7a-2; Variant iso_5p:-1; Cigar 23M;Expression 0; Filter Pass; Hits 1;") },
process.out.versions,
).match()
},
// md5sum is not stable, order of elements in section "variant" may change
{ assert file(process.out.mirtop_gff[0][1]).readLines().findAll { it.contains("iso-24-5URPV39QFB") }}
{ assert file(process.out.gff[0][1]).readLines().findAll { it.contains("iso-24-5URPV39QFB") }}
)
}

Expand Down
27 changes: 4 additions & 23 deletions modules/nf-core/mirtop/gff/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,24 @@
"content": [
{
"0": [
[
{
"id": "sample_sim_isomir_bam"
},
"sim_isomir_sort.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "sample_sim_isomir_bam"
},
"mirtop.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"1": [
"versions.yml:md5,d16ade25d46f8d12e200e124205afefc"
],
"mirtop_gff": [
"gff": [
[
{
"id": "sample_sim_isomir_bam"
},
"mirtop.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"sample_gff": [
[
{
"id": "sample_sim_isomir_bam"
},
"sim_isomir_sort.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,d16ade25d46f8d12e200e124205afefc"
]
Expand All @@ -46,14 +30,11 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-03T12:47:11.610449763"
"timestamp": "2024-09-12T22:40:30.542921953"
},
"isomir - bam": {
"content": [
null,
[
"hsa-let-7a-2\tmiRBasev21\tisomiR\t3\t25\t0\t+\t.\tRead TTGAGGTAGTAGGTTGTATAGTT; UID iso-23-Z0S31NSL0E; Name hsa-let-7a-5p;Parent hsa-let-7a-2; Variant iso_5p:-1; Cigar 23M;Expression 0; Filter Pass; Hits 1;"
],
[
"versions.yml:md5,d16ade25d46f8d12e200e124205afefc"
]
Expand All @@ -62,6 +43,6 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-06T21:42:47.26306174"
"timestamp": "2024-09-12T22:38:09.903017316"
}
}
4 changes: 4 additions & 0 deletions modules/nf-core/mirtop/stats/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ output:
type: file
description: TXT file with stats
pattern: "*.{txt}"
- log:
type: file
description: log file with stats
pattern: "*.{log}"

authors:
- "@atrigila"
Expand Down
23 changes: 0 additions & 23 deletions modules/nf-core/mirtop/stats/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,8 @@ nextflow_process {
tag "modules"
tag "modules_nfcore"
tag "mirtop"
tag "mirtop/gff"
tag "mirtop/stats"

setup {
run("MIRTOP_GFF") {
script "../../gff/main.nf"
process {
"""
input[0] = [
[ id:'sample_sim_isomir_bam'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/mirtop/sim_isomir_sort.bam", checkIfExists: true),
]
input[1] = [
[ id:'hairpin'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/mirtop/hairpin_mirtop.fa", checkIfExists: true),
]
input[2] = [
[ id:'hsa' ], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/mirtop/hsa.gff3", checkIfExists: true),
"hsa"]
"""
}
}
}

test("isomir - bam") {

when {
Expand Down
17 changes: 9 additions & 8 deletions subworkflows/nf-core/bam_stats_mirna_mirtop/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ workflow BAM_STATS_MIRNA_MIRTOP {
ch_versions = Channel.empty()

MIRTOP_GFF ( ch_bam, ch_hairpin, ch_gtf_species )
ch_versions = ch_versions.mix(MIRTOP_GFF.out.versions.first())
ch_versions = ch_versions.mix(MIRTOP_GFF.out.versions)

MIRTOP_COUNTS ( MIRTOP_GFF.out.mirtop_gff, ch_hairpin, ch_gtf_species )
ch_versions = ch_versions.mix(MIRTOP_COUNTS.out.versions.first())
MIRTOP_COUNTS ( MIRTOP_GFF.out.gff, ch_hairpin, ch_gtf_species )
ch_versions = ch_versions.mix(MIRTOP_COUNTS.out.versions)

MIRTOP_EXPORT ( MIRTOP_GFF.out.mirtop_gff, ch_hairpin, ch_gtf_species )
ch_versions = ch_versions.mix(MIRTOP_EXPORT.out.versions.first())
MIRTOP_EXPORT ( MIRTOP_GFF.out.gff, ch_hairpin, ch_gtf_species )
ch_versions = ch_versions.mix(MIRTOP_EXPORT.out.versions)

MIRTOP_STATS ( MIRTOP_GFF.out.mirtop_gff )
ch_versions = ch_versions.mix(MIRTOP_STATS.out.versions.first())
MIRTOP_STATS ( MIRTOP_GFF.out.gff )
ch_versions = ch_versions.mix(MIRTOP_STATS.out.versions)

emit:
rawdata_tsv = MIRTOP_EXPORT.out.tsv // channel: [ val(meta), [ tsv ] ]
isomirs = MIRTOP_EXPORT.out.tsv // channel: [ val(meta), [ tsv ] ]
counts = MIRTOP_COUNTS.out.tsv // channel: [ val(meta), [ tsv ] ]
stats_txt = MIRTOP_STATS.out.txt // channel: [ val(meta), [ txt ] ]
stats_log = MIRTOP_STATS.out.log // channel: [ val(meta), [ log ] ]
versions = ch_versions // channel: [ versions.yml ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ nextflow_workflow {
assertAll(
{ assert workflow.success},
{ assert snapshot(
workflow.out.rawdata_tsv,
workflow.out.isomirs,
workflow.out.stats_txt,
workflow.out.stats_log,
workflow.out.versions).match() }
workflow.out.versions).match() },
{ assert path("${workflow.out.counts[0][1]}").exists() }
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"id": "sample_sim_isomir_bam"
},
"mirtop_rawData.tsv:md5,4a065e444c54b0e816352bf1640594dd"
"sample_sim_isomir_bam_mirtop_rawData.tsv:md5,4a065e444c54b0e816352bf1640594dd"
]
],
[
Expand Down Expand Up @@ -36,6 +36,6 @@
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-09-04T21:31:21.204039357"
"timestamp": "2024-09-12T23:13:48.308574263"
}
}

0 comments on commit 43b2b70

Please sign in to comment.