diff --git a/modules/nf-core/bwameth/align/main.nf b/modules/nf-core/bwameth/align/main.nf index 476463ae0df..8ce2ee32299 100644 --- a/modules/nf-core/bwameth/align/main.nf +++ b/modules/nf-core/bwameth/align/main.nf @@ -9,7 +9,8 @@ process BWAMETH_ALIGN { input: tuple val(meta), path(reads) - path index + tuple val(meta2), path(fasta) + tuple val(meta3), path(index) output: tuple val(meta), path("*.bam"), emit: bam @@ -24,17 +25,16 @@ process BWAMETH_ALIGN { def prefix = task.ext.prefix ?: "${meta.id}" def read_group = meta.read_group ? "-R ${meta.read_group}" : "" """ - INDEX=`find -L ${index} -name "*.bwameth.c2t" | sed 's/\\.bwameth.c2t\$//'` - # Modify the timestamps so that bwameth doesn't complain about building the index # See https://github.com/nf-core/methylseq/pull/217 - touch -c -- * + touch -c $index/* + mv $fasta $index/ bwameth.py \\ $args \\ $read_group \\ -t $task.cpus \\ - --reference \$INDEX \\ + --reference $index/$fasta \\ $reads \\ | samtools view $args2 -@ $task.cpus -bhS -o ${prefix}.bam - diff --git a/modules/nf-core/bwameth/align/meta.yml b/modules/nf-core/bwameth/align/meta.yml index 6cd78268d11..593d17304fc 100644 --- a/modules/nf-core/bwameth/align/meta.yml +++ b/modules/nf-core/bwameth/align/meta.yml @@ -33,7 +33,20 @@ input: description: | List of input FastQ files of size 1 and 2 for single-end and paired-end data, respectively. - - - index: + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input genome fasta file + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: type: directory description: Directory containing bwameth genome index output: diff --git a/modules/nf-core/bwameth/align/tests/main.nf.test b/modules/nf-core/bwameth/align/tests/main.nf.test index 94b1f56fde6..211e0956267 100644 --- a/modules/nf-core/bwameth/align/tests/main.nf.test +++ b/modules/nf-core/bwameth/align/tests/main.nf.test @@ -16,26 +16,29 @@ nextflow_process { script "../../../bwameth/index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) - + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } } - test("test-bwameth-align-single-end") { + test("sarscov2 methylated single_end [fastq]") { when { process { """ - input[0] = [ - [ id:'test', single_end:true ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true) - ] - ] - input[1] = BWAMETH_INDEX.out.index - + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true) + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BWAMETH_INDEX.out.index """ } } @@ -52,20 +55,23 @@ nextflow_process { } } - test("test-bwameth-align-paired-end") { + test("sarscov2 methylated paired_end [fastq]") { when { process { """ - input[0] = [ - [ id:'test', single_end:false ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz', checkIfExists: true) - ] - ] - input[1] = BWAMETH_INDEX.out.index - + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BWAMETH_INDEX.out.index """ } } @@ -88,15 +94,18 @@ nextflow_process { when { process { """ - input[0] = [ - [ id:'test', single_end:false ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz', checkIfExists: true) - ] - ] - input[1] = BWAMETH_INDEX.out.index - + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BWAMETH_INDEX.out.index """ } } diff --git a/modules/nf-core/bwameth/align/tests/main.nf.test.snap b/modules/nf-core/bwameth/align/tests/main.nf.test.snap index 2c8c120f351..a90108105f1 100644 --- a/modules/nf-core/bwameth/align/tests/main.nf.test.snap +++ b/modules/nf-core/bwameth/align/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "test-bwameth-align-single-end": { + "sarscov2 methylated single_end [fastq]": { "content": [ "5fdda0ada69daa3956c65a24c9d1c1e0", [ @@ -10,20 +10,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-04T20:43:02.509483" - }, - "test-bwameth-align-paired-end": { - "content": [ - "cbd5cfa8b446e26987898a45a94770ba", - [ - "versions.yml:md5,c00660f78aeab4fabe00092c70656098" - ] - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" - }, - "timestamp": "2024-09-04T20:43:10.963043" + "timestamp": "2024-10-16T07:50:08.241201566" }, "test-bwameth-align-paired-end-stub": { "content": [ @@ -58,6 +45,19 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-04T20:43:17.04632" + "timestamp": "2024-10-16T08:00:51.770330645" + }, + "sarscov2 methylated paired_end [fastq]": { + "content": [ + "cbd5cfa8b446e26987898a45a94770ba", + [ + "versions.yml:md5,c00660f78aeab4fabe00092c70656098" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-16T07:50:20.75109829" } } \ No newline at end of file diff --git a/modules/nf-core/bwameth/index/main.nf b/modules/nf-core/bwameth/index/main.nf index 33c83d90791..5059f134fb6 100644 --- a/modules/nf-core/bwameth/index/main.nf +++ b/modules/nf-core/bwameth/index/main.nf @@ -8,11 +8,11 @@ process BWAMETH_INDEX { 'biocontainers/bwameth:0.2.7--pyh7cba7a3_0' }" input: - path fasta, stageAs: "bwameth/*" + tuple val(meta), path(fasta) output: - path "bwameth" , emit: index - path "versions.yml" , emit: versions + tuple val(meta), path("BwamethIndex"), emit: index + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -20,7 +20,24 @@ process BWAMETH_INDEX { script: def args = task.ext.args ?: '' """ - bwameth.py index $fasta + mkdir BwamethIndex + mv $fasta BwamethIndex/ + + bwameth.py index BwamethIndex/$fasta + + rm BwamethIndex/$fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bwameth: \$(bwameth.py --version | cut -f2 -d" ") + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + """ + mkdir BwamethIndex + touch BwamethIndex/$fasta cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/bwameth/index/meta.yml b/modules/nf-core/bwameth/index/meta.yml index d92273c4d7e..2194e225804 100644 --- a/modules/nf-core/bwameth/index/meta.yml +++ b/modules/nf-core/bwameth/index/meta.yml @@ -19,12 +19,21 @@ tools: licence: ["MIT"] identifier: "" input: - - - fasta: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: type: file description: Input genome fasta file output: - index: - - bwameth: + - meta: + type: directory + description: Directory containing bwameth genome index + pattern: "index" + - BwamethIndex: type: directory description: Directory containing bwameth genome index pattern: "index" @@ -37,3 +46,4 @@ authors: - "@phue" maintainers: - "@phue" + - "@sateeshperi" diff --git a/modules/nf-core/bwameth/index/tests/main.nf.test b/modules/nf-core/bwameth/index/tests/main.nf.test index a314788ab00..152c8366881 100644 --- a/modules/nf-core/bwameth/index/tests/main.nf.test +++ b/modules/nf-core/bwameth/index/tests/main.nf.test @@ -10,12 +10,15 @@ nextflow_process { tag "bwameth" tag "bwameth/index" - test("test-bwameth-index") { - + test("sarscov2 genome [fasta]") { + when { process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } @@ -27,5 +30,5 @@ nextflow_process { ) } } - + } diff --git a/modules/nf-core/bwameth/index/tests/main.nf.test.snap b/modules/nf-core/bwameth/index/tests/main.nf.test.snap index 27f07221db3..fb427880686 100644 --- a/modules/nf-core/bwameth/index/tests/main.nf.test.snap +++ b/modules/nf-core/bwameth/index/tests/main.nf.test.snap @@ -1,16 +1,20 @@ { - "test-bwameth-index": { + "sarscov2 genome [fasta]": { "content": [ { "0": [ [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", - "genome.fasta.bwameth.c2t:md5,98039984526a41d04d6bd92fcc040c62", - "genome.fasta.bwameth.c2t.amb:md5,249a4195069071ce47cd0bae68abe376", - "genome.fasta.bwameth.c2t.ann:md5,46524d4359dcdfb203a235ab3b930dbb", - "genome.fasta.bwameth.c2t.bwt:md5,84f65df7d42dbe84c9ccfaddfdd5ea6b", - "genome.fasta.bwameth.c2t.pac:md5,4d8e51cb0bbdeaf24576bdf0264d8653", - "genome.fasta.bwameth.c2t.sa:md5,d25f6486f5134f57ed5b258f6fbb8673" + { + "id": "test" + }, + [ + "genome.fasta.bwameth.c2t:md5,98039984526a41d04d6bd92fcc040c62", + "genome.fasta.bwameth.c2t.amb:md5,249a4195069071ce47cd0bae68abe376", + "genome.fasta.bwameth.c2t.ann:md5,46524d4359dcdfb203a235ab3b930dbb", + "genome.fasta.bwameth.c2t.bwt:md5,84f65df7d42dbe84c9ccfaddfdd5ea6b", + "genome.fasta.bwameth.c2t.pac:md5,4d8e51cb0bbdeaf24576bdf0264d8653", + "genome.fasta.bwameth.c2t.sa:md5,d25f6486f5134f57ed5b258f6fbb8673" + ] ] ], "1": [ @@ -18,13 +22,17 @@ ], "index": [ [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", - "genome.fasta.bwameth.c2t:md5,98039984526a41d04d6bd92fcc040c62", - "genome.fasta.bwameth.c2t.amb:md5,249a4195069071ce47cd0bae68abe376", - "genome.fasta.bwameth.c2t.ann:md5,46524d4359dcdfb203a235ab3b930dbb", - "genome.fasta.bwameth.c2t.bwt:md5,84f65df7d42dbe84c9ccfaddfdd5ea6b", - "genome.fasta.bwameth.c2t.pac:md5,4d8e51cb0bbdeaf24576bdf0264d8653", - "genome.fasta.bwameth.c2t.sa:md5,d25f6486f5134f57ed5b258f6fbb8673" + { + "id": "test" + }, + [ + "genome.fasta.bwameth.c2t:md5,98039984526a41d04d6bd92fcc040c62", + "genome.fasta.bwameth.c2t.amb:md5,249a4195069071ce47cd0bae68abe376", + "genome.fasta.bwameth.c2t.ann:md5,46524d4359dcdfb203a235ab3b930dbb", + "genome.fasta.bwameth.c2t.bwt:md5,84f65df7d42dbe84c9ccfaddfdd5ea6b", + "genome.fasta.bwameth.c2t.pac:md5,4d8e51cb0bbdeaf24576bdf0264d8653", + "genome.fasta.bwameth.c2t.sa:md5,d25f6486f5134f57ed5b258f6fbb8673" + ] ] ], "versions": [ @@ -33,9 +41,9 @@ } ], "meta": { - "nf-test": "0.8.4", + "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-08-28T13:57:11.602104" + "timestamp": "2024-10-14T20:32:13.750317299" } } \ No newline at end of file