From 8cee763355d16a48423ad2318332cfbd7582194a Mon Sep 17 00:00:00 2001 From: Adelaide Rhodes Date: Wed, 22 May 2024 19:03:53 +0000 Subject: [PATCH 1/5] added module 10xbamtofastq --- modules/nf-core/10xbamtofastq/environment.yml | 9 +++ modules/nf-core/10xbamtofastq/main.nf | 58 ++++++++++++++++++ modules/nf-core/10xbamtofastq/main.nf.test | 29 +++++++++ modules/nf-core/10xbamtofastq/meta.yml | 48 +++++++++++++++ .../nf-core/10xbamtofastq/tests/main.nf.test | 60 +++++++++++++++++++ modules/nf-core/10xbamtofastq/tests/tags.yml | 2 + 6 files changed, 206 insertions(+) create mode 100644 modules/nf-core/10xbamtofastq/environment.yml create mode 100644 modules/nf-core/10xbamtofastq/main.nf create mode 100644 modules/nf-core/10xbamtofastq/main.nf.test create mode 100644 modules/nf-core/10xbamtofastq/meta.yml create mode 100644 modules/nf-core/10xbamtofastq/tests/main.nf.test create mode 100644 modules/nf-core/10xbamtofastq/tests/tags.yml diff --git a/modules/nf-core/10xbamtofastq/environment.yml b/modules/nf-core/10xbamtofastq/environment.yml new file mode 100644 index 000000000000..cd3be8ad2241 --- /dev/null +++ b/modules/nf-core/10xbamtofastq/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "10xbamtofastq" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::10x_bamtofastq=1.4.1" diff --git a/modules/nf-core/10xbamtofastq/main.nf b/modules/nf-core/10xbamtofastq/main.nf new file mode 100644 index 000000000000..f0275b7bc32f --- /dev/null +++ b/modules/nf-core/10xbamtofastq/main.nf @@ -0,0 +1,58 @@ +process 10XBAMTOFASTQ { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/10x_bamtofastq:1.4.1--hdbdd923_2': + 'biocontainers/10x_bamtofastq:1.4.1--hdbdd923_2' }" + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*.fastq.gz"), emit: fastq + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ + if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" + m = args =~ /-format ([a-z]+)/ + ext = m[0][1] + + """ + + bamtofastq \\ + $args \\ + $bam + $path + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + 10xbamtofastq: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + 10xbamtofastq: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //') + END_VERSIONS + + """ +} + + + + diff --git a/modules/nf-core/10xbamtofastq/main.nf.test b/modules/nf-core/10xbamtofastq/main.nf.test new file mode 100644 index 000000000000..b20680b80e97 --- /dev/null +++ b/modules/nf-core/10xbamtofastq/main.nf.test @@ -0,0 +1,29 @@ +nextflow_process { + + name "Test Process 10XBAMTOFASTQ" + script "modules/nf-core/10xbamtofastq/main.nf" + process "10XBAMTOFASTQ" + + test("Should run without failures") { + + when { + params { + // define parameters here. Example: + // outdir = "tests/results" + } + process { + """ + // define inputs of the process here. Example: + // input[0] = file("test-file.txt") + """ + } + } + + then { + assert process.success + assert snapshot(process.out).match() + } + + } + +} diff --git a/modules/nf-core/10xbamtofastq/meta.yml b/modules/nf-core/10xbamtofastq/meta.yml new file mode 100644 index 000000000000..b51037a5ffb2 --- /dev/null +++ b/modules/nf-core/10xbamtofastq/meta.yml @@ -0,0 +1,48 @@ +name: 10xbamtofastq + +description: Tool for converting 10x BAMs produced by Cell Ranger, Space Ranger, Cell Ranger ATAC, Cell Ranger DNA, and Long Ranger back to FASTQ files that can be used as inputs to re-run analysis + +keywords: + - bam + - convert + - fastq + - 10x + +tools: + - 10xbamtofastq: + description: Tool for converting 10x BAMs produced by Cell Ranger, Space Ranger, Cell Ranger ATAC, Cell Ranger DNA, and Long Ranger back to FASTQ files that can be used as inputs to re-run analysis + homepage: https://github.com/10XGenomics/bamtofastq + documentation: https://github.com/10XGenomics/bamtofastq + tool_dev_url: https://github.com/10XGenomics/bamtofastq + licence: ["MIT"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: BAM file + pattern: "*.bam" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + + - fastq: + type: file + description: fastq compressed file + pattern: "*.fastq.gz" + +authors: + - "@BlueBicycleBlog" +maintainers: + - "@BlueBicycleBlog" diff --git a/modules/nf-core/10xbamtofastq/tests/main.nf.test b/modules/nf-core/10xbamtofastq/tests/main.nf.test new file mode 100644 index 000000000000..613ff5d45677 --- /dev/null +++ b/modules/nf-core/10xbamtofastq/tests/main.nf.test @@ -0,0 +1,60 @@ +nextflow_process { + + name "Test Process 10XBAMTOFASTQ" + script "../main.nf" + process "10XBAMTOFASTQ" + + tag "modules" + tag "modules_nfcore" + tag "10xbamtofastq" + + test("human - bam") { + + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + + ) + } + + } + + + test("human - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/10xbamtofastq/tests/tags.yml b/modules/nf-core/10xbamtofastq/tests/tags.yml new file mode 100644 index 000000000000..54caa7881178 --- /dev/null +++ b/modules/nf-core/10xbamtofastq/tests/tags.yml @@ -0,0 +1,2 @@ +10xbamtofastq: + - "modules/nf-core/10xbamtofastq/**" From ca1e260d3ac8f73c0be5b1e3ae5ce325cf914c44 Mon Sep 17 00:00:00 2001 From: Adelaide Rhodes Date: Wed, 22 May 2024 19:28:30 +0000 Subject: [PATCH 2/5] remove extra test file --- modules/nf-core/10xbamtofastq/main.nf.test | 29 ---------------------- 1 file changed, 29 deletions(-) delete mode 100644 modules/nf-core/10xbamtofastq/main.nf.test diff --git a/modules/nf-core/10xbamtofastq/main.nf.test b/modules/nf-core/10xbamtofastq/main.nf.test deleted file mode 100644 index b20680b80e97..000000000000 --- a/modules/nf-core/10xbamtofastq/main.nf.test +++ /dev/null @@ -1,29 +0,0 @@ -nextflow_process { - - name "Test Process 10XBAMTOFASTQ" - script "modules/nf-core/10xbamtofastq/main.nf" - process "10XBAMTOFASTQ" - - test("Should run without failures") { - - when { - params { - // define parameters here. Example: - // outdir = "tests/results" - } - process { - """ - // define inputs of the process here. Example: - // input[0] = file("test-file.txt") - """ - } - } - - then { - assert process.success - assert snapshot(process.out).match() - } - - } - -} From 8460b2019e3d12ef6061cc3073f8d18a84e5fe6d Mon Sep 17 00:00:00 2001 From: Adelaide Rhodes <75856507+BlueBicycleBlog@users.noreply.github.com> Date: Wed, 22 May 2024 16:09:24 -0400 Subject: [PATCH 3/5] Update main.nf.test --- modules/nf-core/10xbamtofastq/tests/main.nf.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/10xbamtofastq/tests/main.nf.test b/modules/nf-core/10xbamtofastq/tests/main.nf.test index 613ff5d45677..2ada7160ab2f 100644 --- a/modules/nf-core/10xbamtofastq/tests/main.nf.test +++ b/modules/nf-core/10xbamtofastq/tests/main.nf.test @@ -1,6 +1,6 @@ nextflow_process { - name "Test Process 10XBAMTOFASTQ" + name "Test Process "BAMTOFASTQ10X" script "../main.nf" process "10XBAMTOFASTQ" From e2a33a60dac0e3a369ea6bebc706922437963cd1 Mon Sep 17 00:00:00 2001 From: Adelaide Rhodes <75856507+BlueBicycleBlog@users.noreply.github.com> Date: Wed, 22 May 2024 16:11:09 -0400 Subject: [PATCH 4/5] Update main.nf --- modules/nf-core/10xbamtofastq/main.nf | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/modules/nf-core/10xbamtofastq/main.nf b/modules/nf-core/10xbamtofastq/main.nf index f0275b7bc32f..68fac6b6d976 100644 --- a/modules/nf-core/10xbamtofastq/main.nf +++ b/modules/nf-core/10xbamtofastq/main.nf @@ -1,4 +1,4 @@ -process 10XBAMTOFASTQ { +process BAMTOFASTQ10X { tag "$meta.id" label 'process_low' @@ -12,7 +12,7 @@ process 10XBAMTOFASTQ { output: tuple val(meta), path("*.fastq.gz"), emit: fastq - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -20,17 +20,11 @@ process 10XBAMTOFASTQ { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ - if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" - m = args =~ /-format ([a-z]+)/ - ext = m[0][1] - """ - bamtofastq \\ $args \\ - $bam - $path + $bam \\ + $prefix cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -41,7 +35,6 @@ process 10XBAMTOFASTQ { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - """ touch ${prefix}.bam @@ -49,10 +42,5 @@ process 10XBAMTOFASTQ { "${task.process}": 10xbamtofastq: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //') END_VERSIONS - """ } - - - - From d22fc3a0abb1fd1405341b7728f7615d54612247 Mon Sep 17 00:00:00 2001 From: Harshil Patel Date: Wed, 22 May 2024 16:44:16 -0400 Subject: [PATCH 5/5] Rename module and fix tests --- modules/nf-core/10xbamtofastq/tests/tags.yml | 2 - .../environment.yml | 2 +- .../{10xbamtofastq => bamtofastq10x}/main.nf | 9 ++-- .../{10xbamtofastq => bamtofastq10x}/meta.yml | 4 +- .../tests/main.nf.test | 17 +++---- .../bamtofastq10x/tests/main.nf.test.snap | 47 +++++++++++++++++++ modules/nf-core/bamtofastq10x/tests/tags.yml | 2 + 7 files changed, 62 insertions(+), 21 deletions(-) delete mode 100644 modules/nf-core/10xbamtofastq/tests/tags.yml rename modules/nf-core/{10xbamtofastq => bamtofastq10x}/environment.yml (91%) rename modules/nf-core/{10xbamtofastq => bamtofastq10x}/main.nf (83%) rename modules/nf-core/{10xbamtofastq => bamtofastq10x}/meta.yml (97%) rename modules/nf-core/{10xbamtofastq => bamtofastq10x}/tests/main.nf.test (70%) create mode 100644 modules/nf-core/bamtofastq10x/tests/main.nf.test.snap create mode 100644 modules/nf-core/bamtofastq10x/tests/tags.yml diff --git a/modules/nf-core/10xbamtofastq/tests/tags.yml b/modules/nf-core/10xbamtofastq/tests/tags.yml deleted file mode 100644 index 54caa7881178..000000000000 --- a/modules/nf-core/10xbamtofastq/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -10xbamtofastq: - - "modules/nf-core/10xbamtofastq/**" diff --git a/modules/nf-core/10xbamtofastq/environment.yml b/modules/nf-core/bamtofastq10x/environment.yml similarity index 91% rename from modules/nf-core/10xbamtofastq/environment.yml rename to modules/nf-core/bamtofastq10x/environment.yml index cd3be8ad2241..d612f512e6f6 100644 --- a/modules/nf-core/10xbamtofastq/environment.yml +++ b/modules/nf-core/bamtofastq10x/environment.yml @@ -1,6 +1,6 @@ --- # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json -name: "10xbamtofastq" +name: "bamtofastq10x" channels: - conda-forge - bioconda diff --git a/modules/nf-core/10xbamtofastq/main.nf b/modules/nf-core/bamtofastq10x/main.nf similarity index 83% rename from modules/nf-core/10xbamtofastq/main.nf rename to modules/nf-core/bamtofastq10x/main.nf index 68fac6b6d976..be1b14415bee 100644 --- a/modules/nf-core/10xbamtofastq/main.nf +++ b/modules/nf-core/bamtofastq10x/main.nf @@ -24,23 +24,22 @@ process BAMTOFASTQ10X { bamtofastq \\ $args \\ $bam \\ - $prefix + ${prefix}.fastq.gz cat <<-END_VERSIONS > versions.yml "${task.process}": - 10xbamtofastq: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //') + bamtofastq10x: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //') END_VERSIONS """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix}.bam + touch ${prefix}.fastq.gz cat <<-END_VERSIONS > versions.yml "${task.process}": - 10xbamtofastq: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //') + bamtofastq10x: \$(bamtofastq --version |& sed '1!d ; s/bamtofastq //') END_VERSIONS """ } diff --git a/modules/nf-core/10xbamtofastq/meta.yml b/modules/nf-core/bamtofastq10x/meta.yml similarity index 97% rename from modules/nf-core/10xbamtofastq/meta.yml rename to modules/nf-core/bamtofastq10x/meta.yml index b51037a5ffb2..2ac31a5cf827 100644 --- a/modules/nf-core/10xbamtofastq/meta.yml +++ b/modules/nf-core/bamtofastq10x/meta.yml @@ -1,4 +1,4 @@ -name: 10xbamtofastq +name: bamtofastq10x description: Tool for converting 10x BAMs produced by Cell Ranger, Space Ranger, Cell Ranger ATAC, Cell Ranger DNA, and Long Ranger back to FASTQ files that can be used as inputs to re-run analysis @@ -9,7 +9,7 @@ keywords: - 10x tools: - - 10xbamtofastq: + - bamtofastq10x: description: Tool for converting 10x BAMs produced by Cell Ranger, Space Ranger, Cell Ranger ATAC, Cell Ranger DNA, and Long Ranger back to FASTQ files that can be used as inputs to re-run analysis homepage: https://github.com/10XGenomics/bamtofastq documentation: https://github.com/10XGenomics/bamtofastq diff --git a/modules/nf-core/10xbamtofastq/tests/main.nf.test b/modules/nf-core/bamtofastq10x/tests/main.nf.test similarity index 70% rename from modules/nf-core/10xbamtofastq/tests/main.nf.test rename to modules/nf-core/bamtofastq10x/tests/main.nf.test index 2ada7160ab2f..2b455ae84470 100644 --- a/modules/nf-core/10xbamtofastq/tests/main.nf.test +++ b/modules/nf-core/bamtofastq10x/tests/main.nf.test @@ -1,22 +1,20 @@ nextflow_process { - name "Test Process "BAMTOFASTQ10X" + name "Test Process BAMTOFASTQ10X" script "../main.nf" - process "10XBAMTOFASTQ" + process "BAMTOFASTQ10X" tag "modules" tag "modules_nfcore" - tag "10xbamtofastq" + tag "bamtofastq10x" test("human - bam") { - - when { process { """ input[0] = Channel.of([ [ id:'test' ], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true) ]) """ } @@ -29,7 +27,6 @@ nextflow_process { ) } - } @@ -42,7 +39,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true) ]) """ } @@ -50,11 +47,9 @@ nextflow_process { then { assertAll( - { assert process.success }, - { assert snapshot(process.out).match() } + { assert process.success } ) } } - } diff --git a/modules/nf-core/bamtofastq10x/tests/main.nf.test.snap b/modules/nf-core/bamtofastq10x/tests/main.nf.test.snap new file mode 100644 index 000000000000..d534674592d6 --- /dev/null +++ b/modules/nf-core/bamtofastq10x/tests/main.nf.test.snap @@ -0,0 +1,47 @@ +{ + "human - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + [ + "bamtofastq_S1_L000_I1_001.fastq.gz:md5,a33682ac881de7a7453d79721b7621a0", + "bamtofastq_S1_L000_R1_001.fastq.gz:md5,5ccebf77d8636d7a7cdfc59737aea79f", + "bamtofastq_S1_L000_R2_001.fastq.gz:md5,2ee7c90e4307deba74065cfd00a65002" + ] + ] + ] + ], + "1": [ + "versions.yml:md5,845cd1d09c8a3d0059da9d074a9e5436" + ], + "fastq": [ + [ + { + "id": "test" + }, + [ + [ + "bamtofastq_S1_L000_I1_001.fastq.gz:md5,a33682ac881de7a7453d79721b7621a0", + "bamtofastq_S1_L000_R1_001.fastq.gz:md5,5ccebf77d8636d7a7cdfc59737aea79f", + "bamtofastq_S1_L000_R2_001.fastq.gz:md5,2ee7c90e4307deba74065cfd00a65002" + ] + ] + ] + ], + "versions": [ + "versions.yml:md5,845cd1d09c8a3d0059da9d074a9e5436" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.0" + }, + "timestamp": "2024-05-22T16:43:24.999397" + } +} \ No newline at end of file diff --git a/modules/nf-core/bamtofastq10x/tests/tags.yml b/modules/nf-core/bamtofastq10x/tests/tags.yml new file mode 100644 index 000000000000..fe62227fef66 --- /dev/null +++ b/modules/nf-core/bamtofastq10x/tests/tags.yml @@ -0,0 +1,2 @@ +bamtofastq10x: + - "modules/nf-core/bamtofastq10x/**"