From ef44c512173fffe178b9d400937f21532538c940 Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Sun, 9 Feb 2025 22:44:21 +0000 Subject: [PATCH 1/8] Add skeleton --- modules/nf-core/perbase/environment.yml | 7 ++ modules/nf-core/perbase/main.nf | 91 ++++++++++++++++++++++ modules/nf-core/perbase/meta.yml | 69 ++++++++++++++++ modules/nf-core/perbase/tests/main.nf.test | 73 +++++++++++++++++ 4 files changed, 240 insertions(+) create mode 100644 modules/nf-core/perbase/environment.yml create mode 100644 modules/nf-core/perbase/main.nf create mode 100644 modules/nf-core/perbase/meta.yml create mode 100644 modules/nf-core/perbase/tests/main.nf.test diff --git a/modules/nf-core/perbase/environment.yml b/modules/nf-core/perbase/environment.yml new file mode 100644 index 00000000000..1148e2be500 --- /dev/null +++ b/modules/nf-core/perbase/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::perbase=0.10.2" diff --git a/modules/nf-core/perbase/main.nf b/modules/nf-core/perbase/main.nf new file mode 100644 index 00000000000..f918bcf2abc --- /dev/null +++ b/modules/nf-core/perbase/main.nf @@ -0,0 +1,91 @@ +// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) +// https://github.com/nf-core/modules/tree/master/modules/nf-core/ +// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: +// https://nf-co.re/join +// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. +// All other parameters MUST be provided using the "task.ext" directive, see here: +// https://www.nextflow.io/docs/latest/process.html#ext +// where "task.ext" is a string. +// Any parameters that need to be evaluated in the context of a particular sample +// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. +// TODO nf-core: Software that can be piped together SHOULD be added to separate module files +// unless there is a run-time, storage advantage in implementing in this way +// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: +// bwa mem | samtools view -B -T ref.fasta +// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty +// list (`[]`) instead of a file can be used to work around this issue. + +process PERBASE { + tag "$meta.id" + label 'process_single' + + // TODO nf-core: List required Conda package(s). + // Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE': + 'biocontainers/YOUR-TOOL-HERE' }" + + input: + // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" + // MUST be provided as an input via a Groovy Map called "meta". + // This information may not be required in some instances e.g. indexing reference genome files: + // https://github.com/nf-core/modules/blob/master/modules/nf-core/bwa/index/main.nf + // TODO nf-core: Where applicable please provide/convert compressed files as input/output + // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. + tuple val(meta), path(bam) + + output: + // TODO nf-core: Named file extensions MUST be emitted for ALL output channels + tuple val(meta), path("*.bam"), emit: bam + // TODO nf-core: List additional required output channels/values here + 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}" + // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 + // If the software is unable to output a version number on the command-line then it can be manually specified + // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf + // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) + // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive + // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter + // using the Nextflow "task" variable e.g. "--threads $task.cpus" + // TODO nf-core: Please replace the example samtools command below with your module's command + // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) + """ + samtools \\ + sort \\ + $args \\ + -@ $task.cpus \\ + -o ${prefix}.bam \\ + -T $prefix \\ + $bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + perbase: \$(samtools --version |& sed '1!d ; s/samtools //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + // TODO nf-core: A stub section should mimic the execution of the original module as best as possible + // Have a look at the following examples: + // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 + // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 + """ + touch ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + perbase: \$(samtools --version |& sed '1!d ; s/samtools //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/perbase/meta.yml b/modules/nf-core/perbase/meta.yml new file mode 100644 index 00000000000..8ba1c87dbb5 --- /dev/null +++ b/modules/nf-core/perbase/meta.yml @@ -0,0 +1,69 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "perbase" +## TODO nf-core: Add a description of the module and list keywords +description: write your description here +keywords: + - sort + - example + - genomics +tools: + - "perbase": + ## TODO nf-core: Add a description and other details for the software below + description: "Per-base metrics on BAM/CRAM files." + homepage: "https://github.com/sstadick/perbase/blob/v0.10.2/README.md" + documentation: "https://github.com/sstadick/perbase/blob/v0.10.2/README.md" + tool_dev_url: "https://github.com/sstadick/perbase" + doi: "" + licence: ['MIT'] + identifier: biotools:perbase + +## TODO nf-core: Add a description of all of the variables used as input +input: + # Only when we have meta + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + ## TODO nf-core: Delete / customise this example input + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + ontologies: + - edam: "http://edamontology.org/format_25722" + - edam: "http://edamontology.org/format_2573" + - edam: "http://edamontology.org/format_3462" + + +## TODO nf-core: Add a description of all of the variables used as output +output: + - bam: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + ## TODO nf-core: Delete / customise this example output + - "*.bam": + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + ontologies: + - edam: "http://edamontology.org/format_25722" + - edam: "http://edamontology.org/format_2573" + - edam: "http://edamontology.org/format_3462" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@camlloyd" +maintainers: + - "@camlloyd" diff --git a/modules/nf-core/perbase/tests/main.nf.test b/modules/nf-core/perbase/tests/main.nf.test new file mode 100644 index 00000000000..ecf7a9ed62a --- /dev/null +++ b/modules/nf-core/perbase/tests/main.nf.test @@ -0,0 +1,73 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test perbase +nextflow_process { + + name "Test Process PERBASE" + script "../main.nf" + process "PERBASE" + + tag "modules" + tag "modules_nfcore" + tag "perbase" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} From 6987875cdb3b84c4c7feb7f5b563bfa5ca6453bd Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Mon, 10 Feb 2025 09:18:53 +0000 Subject: [PATCH 2/8] Update perbase --- modules/nf-core/perbase/environment.yml | 2 +- modules/nf-core/perbase/main.nf | 68 ++------- modules/nf-core/perbase/meta.yml | 63 ++++---- modules/nf-core/perbase/tests/main.nf.test | 74 ++++++--- .../nf-core/perbase/tests/main.nf.test.snap | 142 ++++++++++++++++++ 5 files changed, 237 insertions(+), 112 deletions(-) create mode 100644 modules/nf-core/perbase/tests/main.nf.test.snap diff --git a/modules/nf-core/perbase/environment.yml b/modules/nf-core/perbase/environment.yml index 1148e2be500..90e2c71c672 100644 --- a/modules/nf-core/perbase/environment.yml +++ b/modules/nf-core/perbase/environment.yml @@ -4,4 +4,4 @@ channels: - conda-forge - bioconda dependencies: - - "bioconda::perbase=0.10.2" + - bioconda::perbase=0.10.2 diff --git a/modules/nf-core/perbase/main.nf b/modules/nf-core/perbase/main.nf index f918bcf2abc..cc5cfeb2ab7 100644 --- a/modules/nf-core/perbase/main.nf +++ b/modules/nf-core/perbase/main.nf @@ -1,46 +1,17 @@ -// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) -// https://github.com/nf-core/modules/tree/master/modules/nf-core/ -// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: -// https://nf-co.re/join -// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. -// All other parameters MUST be provided using the "task.ext" directive, see here: -// https://www.nextflow.io/docs/latest/process.html#ext -// where "task.ext" is a string. -// Any parameters that need to be evaluated in the context of a particular sample -// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. -// TODO nf-core: Software that can be piped together SHOULD be added to separate module files -// unless there is a run-time, storage advantage in implementing in this way -// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: -// bwa mem | samtools view -B -T ref.fasta -// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty -// list (`[]`) instead of a file can be used to work around this issue. - process PERBASE { tag "$meta.id" - label 'process_single' + label 'process_low' - // TODO nf-core: List required Conda package(s). - // Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE': - 'biocontainers/YOUR-TOOL-HERE' }" + 'https://depot.galaxyproject.org/singularity/perbase:0.10.1--h15397dd_0': + 'biocontainers/perbase:0.10.2--h15397dd_0' }" input: - // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" - // MUST be provided as an input via a Groovy Map called "meta". - // This information may not be required in some instances e.g. indexing reference genome files: - // https://github.com/nf-core/modules/blob/master/modules/nf-core/bwa/index/main.nf - // TODO nf-core: Where applicable please provide/convert compressed files as input/output - // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. tuple val(meta), path(bam) output: - // TODO nf-core: Named file extensions MUST be emitted for ALL output channels - tuple val(meta), path("*.bam"), emit: bam - // TODO nf-core: List additional required output channels/values here + tuple val(meta), path("*.tsv.gz"), emit: tsv path "versions.yml" , emit: versions when: @@ -49,43 +20,30 @@ process PERBASE { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 - // If the software is unable to output a version number on the command-line then it can be manually specified - // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf - // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) - // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive - // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter - // using the Nextflow "task" variable e.g. "--threads $task.cpus" - // TODO nf-core: Please replace the example samtools command below with your module's command - // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) """ - samtools \\ - sort \\ + perbase \\ + base-depth \\ + $bam \\ $args \\ - -@ $task.cpus \\ - -o ${prefix}.bam \\ - -T $prefix \\ - $bam + --threads $task.cpus \\ + --bgzip \\ + --output ${prefix}.tsv.gz cat <<-END_VERSIONS > versions.yml "${task.process}": - perbase: \$(samtools --version |& sed '1!d ; s/samtools //') + perbase: \$(perbase --version |& sed '1!d ; s/perbase //') END_VERSIONS """ stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: A stub section should mimic the execution of the original module as best as possible - // Have a look at the following examples: - // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 - // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 """ - touch ${prefix}.bam + echo "" | gzip > ${prefix}.tsv.gz cat <<-END_VERSIONS > versions.yml "${task.process}": - perbase: \$(samtools --version |& sed '1!d ; s/samtools //') + perbase: \$(perbase --version |& sed '1!d ; s/perbase //') END_VERSIONS """ } diff --git a/modules/nf-core/perbase/meta.yml b/modules/nf-core/perbase/meta.yml index 8ba1c87dbb5..dcc35b6b6d8 100644 --- a/modules/nf-core/perbase/meta.yml +++ b/modules/nf-core/perbase/meta.yml @@ -1,24 +1,20 @@ --- # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json name: "perbase" -## TODO nf-core: Add a description of the module and list keywords -description: write your description here +description: Per-base metrics on BAM/CRAM files. keywords: - - sort - - example - - genomics + - bam + - cram + - depth tools: - "perbase": - ## TODO nf-core: Add a description and other details for the software below description: "Per-base metrics on BAM/CRAM files." homepage: "https://github.com/sstadick/perbase/blob/v0.10.2/README.md" documentation: "https://github.com/sstadick/perbase/blob/v0.10.2/README.md" tool_dev_url: "https://github.com/sstadick/perbase" - doi: "" - licence: ['MIT'] + licence: ["MIT"] identifier: biotools:perbase -## TODO nf-core: Add a description of all of the variables used as input input: # Only when we have meta - - meta: @@ -26,42 +22,35 @@ input: description: | Groovy Map containing sample information e.g. `[ id:'sample1', single_end:false ]` - - ## TODO nf-core: Delete / customise this example input + - bam: type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" + description: Sorted BAM/CRAM file + pattern: "*.{bam,cram}" ontologies: - edam: "http://edamontology.org/format_25722" - - edam: "http://edamontology.org/format_2573" - edam: "http://edamontology.org/format_3462" - -## TODO nf-core: Add a description of all of the variables used as output output: - - bam: - #Only when we have meta - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. `[ id:'sample1', single_end:false ]` - ## TODO nf-core: Delete / customise this example output - - "*.bam": - type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" - ontologies: - - edam: "http://edamontology.org/format_25722" - - edam: "http://edamontology.org/format_2573" - - edam: "http://edamontology.org/format_3462" - + - tsv: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.tsv.gz": + type: file + description: TSV file + pattern: "*.{tsv.gz}" + ontologies: + - edam: "http://edamontology.org/format_3475" + - versions: - - "versions.yml": - type: file - description: File containing software versions - pattern: "versions.yml" + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" authors: - "@camlloyd" diff --git a/modules/nf-core/perbase/tests/main.nf.test b/modules/nf-core/perbase/tests/main.nf.test index ecf7a9ed62a..7b07fdc48cf 100644 --- a/modules/nf-core/perbase/tests/main.nf.test +++ b/modules/nf-core/perbase/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test perbase nextflow_process { name "Test Process PERBASE" @@ -10,22 +8,16 @@ nextflow_process { tag "modules_nfcore" tag "perbase" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { + test("homo_sapiens - illumina - cram") { - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). when { process { """ - // TODO nf-core: define inputs of the process here. Example: - + input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true), ] """ } @@ -35,26 +27,71 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("homo_sapiens - illumina - cram - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - + + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("homo_sapiens - illumina - bam") { + + + when { + process { + """ + + input[0] = [ + [ id:'test', single_end:false ], // meta map + 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("homo_sapiens - illumina - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), ] """ } @@ -64,7 +101,6 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/perbase/tests/main.nf.test.snap b/modules/nf-core/perbase/tests/main.nf.test.snap new file mode 100644 index 00000000000..580ca63be7e --- /dev/null +++ b/modules/nf-core/perbase/tests/main.nf.test.snap @@ -0,0 +1,142 @@ +{ + "homo_sapiens - illumina - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-10T09:15:57.123695003" + }, + "homo_sapiens - illumina - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-10T09:15:38.056976127" + }, + "homo_sapiens - illumina - cram": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-10T09:14:52.87095271" + }, + "homo_sapiens - illumina - cram - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,b0d0beb66ff667db414fa86ee1e248dd" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-10T09:15:15.455581039" + } +} \ No newline at end of file From b2b4b2568d25e21d924c311159eb987de20c4ad9 Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Mon, 10 Feb 2025 12:19:59 +0000 Subject: [PATCH 3/8] Update perbase --- modules/nf-core/perbase/main.nf | 2 +- modules/nf-core/perbase/meta.yml | 5 +++++ modules/nf-core/perbase/tests/main.nf.test | 4 ++++ modules/nf-core/perbase/tests/main.nf.test.snap | 6 +++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/perbase/main.nf b/modules/nf-core/perbase/main.nf index cc5cfeb2ab7..62a6ad883d1 100644 --- a/modules/nf-core/perbase/main.nf +++ b/modules/nf-core/perbase/main.nf @@ -8,7 +8,7 @@ process PERBASE { 'biocontainers/perbase:0.10.2--h15397dd_0' }" input: - tuple val(meta), path(bam) + tuple val(meta), path(bam), path(index) output: tuple val(meta), path("*.tsv.gz"), emit: tsv diff --git a/modules/nf-core/perbase/meta.yml b/modules/nf-core/perbase/meta.yml index dcc35b6b6d8..36fe62d1b87 100644 --- a/modules/nf-core/perbase/meta.yml +++ b/modules/nf-core/perbase/meta.yml @@ -31,6 +31,11 @@ input: - edam: "http://edamontology.org/format_25722" - edam: "http://edamontology.org/format_3462" + - index: + type: file + description: BAI/CRAI file + pattern: "*.{bai,crai}" + output: - tsv: #Only when we have meta diff --git a/modules/nf-core/perbase/tests/main.nf.test b/modules/nf-core/perbase/tests/main.nf.test index 7b07fdc48cf..82d2a2eb7a9 100644 --- a/modules/nf-core/perbase/tests/main.nf.test +++ b/modules/nf-core/perbase/tests/main.nf.test @@ -18,6 +18,7 @@ nextflow_process { input[0] = [ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram.crai', checkIfExists: true) ] """ } @@ -43,6 +44,7 @@ nextflow_process { input[0] = [ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram.crai', checkIfExists: true) ] """ } @@ -67,6 +69,7 @@ nextflow_process { input[0] = [ [ id:'test', single_end:false ], // meta map 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/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true) ] """ } @@ -92,6 +95,7 @@ nextflow_process { input[0] = [ [ id:'test', single_end:false ], // meta map 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/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true) ] """ } diff --git a/modules/nf-core/perbase/tests/main.nf.test.snap b/modules/nf-core/perbase/tests/main.nf.test.snap index 580ca63be7e..f97fbe72f33 100644 --- a/modules/nf-core/perbase/tests/main.nf.test.snap +++ b/modules/nf-core/perbase/tests/main.nf.test.snap @@ -43,7 +43,7 @@ "id": "test", "single_end": false }, - "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.tsv.gz:md5,815a34cba6bd6aab7508212a03e6d467" ] ], "1": [ @@ -55,7 +55,7 @@ "id": "test", "single_end": false }, - "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.tsv.gz:md5,815a34cba6bd6aab7508212a03e6d467" ] ], "versions": [ @@ -67,7 +67,7 @@ "nf-test": "0.9.2", "nextflow": "24.10.4" }, - "timestamp": "2025-02-10T09:15:38.056976127" + "timestamp": "2025-02-10T11:52:59.613861207" }, "homo_sapiens - illumina - cram": { "content": [ From ae3dc8d262168aa406df56b1323646f0a021b3b6 Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Mon, 10 Feb 2025 19:58:34 +0000 Subject: [PATCH 4/8] Update perbase --- modules/nf-core/perbase/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/perbase/main.nf b/modules/nf-core/perbase/main.nf index 62a6ad883d1..17c2fc8ff62 100644 --- a/modules/nf-core/perbase/main.nf +++ b/modules/nf-core/perbase/main.nf @@ -4,7 +4,7 @@ process PERBASE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/perbase:0.10.1--h15397dd_0': + 'https://depot.galaxyproject.org/singularity/perbase:0.10.2--h15397dd_0': 'biocontainers/perbase:0.10.2--h15397dd_0' }" input: From dab52a412116ccb55b01a16193843b6ab8dcec98 Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Fri, 14 Feb 2025 16:13:08 +0000 Subject: [PATCH 5/8] Harshil Alignment --- modules/nf-core/perbase/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/perbase/main.nf b/modules/nf-core/perbase/main.nf index 17c2fc8ff62..5258b44e89d 100644 --- a/modules/nf-core/perbase/main.nf +++ b/modules/nf-core/perbase/main.nf @@ -12,7 +12,7 @@ process PERBASE { output: tuple val(meta), path("*.tsv.gz"), emit: tsv - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when From ad12a3508b966a28c8b0f24f7b65bb78882024a8 Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Sun, 16 Feb 2025 16:24:09 +0000 Subject: [PATCH 6/8] Update perbase --- modules/nf-core/perbase/main.nf | 3 +++ modules/nf-core/perbase/meta.yml | 16 +++++++++++++--- modules/nf-core/perbase/tests/main.nf.test | 15 ++++++++++++++- modules/nf-core/perbase/tests/main.nf.test.snap | 10 +++++----- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/modules/nf-core/perbase/main.nf b/modules/nf-core/perbase/main.nf index 5258b44e89d..40734e6f19a 100644 --- a/modules/nf-core/perbase/main.nf +++ b/modules/nf-core/perbase/main.nf @@ -9,6 +9,7 @@ process PERBASE { input: tuple val(meta), path(bam), path(index) + tuple val(meta2), path(fasta), path(fai) output: tuple val(meta), path("*.tsv.gz"), emit: tsv @@ -20,11 +21,13 @@ process PERBASE { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def reference = fasta ? "--ref-fasta ${fasta}" : "" """ perbase \\ base-depth \\ $bam \\ $args \\ + $reference \\ --threads $task.cpus \\ --bgzip \\ --output ${prefix}.tsv.gz diff --git a/modules/nf-core/perbase/meta.yml b/modules/nf-core/perbase/meta.yml index 36fe62d1b87..41867b9eb5f 100644 --- a/modules/nf-core/perbase/meta.yml +++ b/modules/nf-core/perbase/meta.yml @@ -1,4 +1,3 @@ ---- # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json name: "perbase" description: Per-base metrics on BAM/CRAM files. @@ -22,7 +21,6 @@ input: description: | Groovy Map containing sample information e.g. `[ id:'sample1', single_end:false ]` - - bam: type: file description: Sorted BAM/CRAM file @@ -35,7 +33,19 @@ input: type: file description: BAI/CRAI file pattern: "*.{bai,crai}" - + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome' ] + - fasta: + type: file + description: Reference fasta (optional) + pattern: "*.{fasta,fa}" + - fai: + type: file + description: FAI file (optional) + pattern: "*.{fai}" output: - tsv: #Only when we have meta diff --git a/modules/nf-core/perbase/tests/main.nf.test b/modules/nf-core/perbase/tests/main.nf.test index 82d2a2eb7a9..6e120fd203d 100644 --- a/modules/nf-core/perbase/tests/main.nf.test +++ b/modules/nf-core/perbase/tests/main.nf.test @@ -18,7 +18,13 @@ nextflow_process { input[0] = [ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram.crai', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram.crai', checkIfExists: true), + ] + input[1] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] """ } @@ -46,6 +52,11 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.recalibrated.sorted.cram.crai', checkIfExists: true) ] + input[1] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] """ } } @@ -71,6 +82,7 @@ nextflow_process { 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/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true) ] + input[1] = [[],[],[]] """ } } @@ -97,6 +109,7 @@ nextflow_process { 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/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true) ] + input[1] = [[],[],[]] """ } } diff --git a/modules/nf-core/perbase/tests/main.nf.test.snap b/modules/nf-core/perbase/tests/main.nf.test.snap index f97fbe72f33..c60f6573b66 100644 --- a/modules/nf-core/perbase/tests/main.nf.test.snap +++ b/modules/nf-core/perbase/tests/main.nf.test.snap @@ -32,7 +32,7 @@ "nf-test": "0.9.2", "nextflow": "24.10.4" }, - "timestamp": "2025-02-10T09:15:57.123695003" + "timestamp": "2025-02-16T16:02:37.123524445" }, "homo_sapiens - illumina - bam": { "content": [ @@ -67,7 +67,7 @@ "nf-test": "0.9.2", "nextflow": "24.10.4" }, - "timestamp": "2025-02-10T11:52:59.613861207" + "timestamp": "2025-02-16T16:02:13.836789609" }, "homo_sapiens - illumina - cram": { "content": [ @@ -78,7 +78,7 @@ "id": "test", "single_end": false }, - "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.tsv.gz:md5,60a996eab4aa98ca23b845e88219cf02" ] ], "1": [ @@ -90,7 +90,7 @@ "id": "test", "single_end": false }, - "test.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + "test.tsv.gz:md5,60a996eab4aa98ca23b845e88219cf02" ] ], "versions": [ @@ -102,7 +102,7 @@ "nf-test": "0.9.2", "nextflow": "24.10.4" }, - "timestamp": "2025-02-10T09:14:52.87095271" + "timestamp": "2025-02-16T15:57:34.968427944" }, "homo_sapiens - illumina - cram - stub": { "content": [ From 108ad36db66bd599421743fbbd12ff8791ead3df Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Sun, 16 Feb 2025 16:41:04 +0000 Subject: [PATCH 7/8] Add ontology --- modules/nf-core/perbase/meta.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/nf-core/perbase/meta.yml b/modules/nf-core/perbase/meta.yml index 41867b9eb5f..d287d160332 100644 --- a/modules/nf-core/perbase/meta.yml +++ b/modules/nf-core/perbase/meta.yml @@ -42,6 +42,8 @@ input: type: file description: Reference fasta (optional) pattern: "*.{fasta,fa}" + ontologies: + - edam: "http://edamontology.org/format_1929" - fai: type: file description: FAI file (optional) From f656b934c3a4a31c9bb1d73348464c89fd41ae23 Mon Sep 17 00:00:00 2001 From: Cameron Lloyd Date: Mon, 17 Feb 2025 16:10:53 +0000 Subject: [PATCH 8/8] Add ontology --- modules/nf-core/perbase/meta.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/nf-core/perbase/meta.yml b/modules/nf-core/perbase/meta.yml index d287d160332..85a9b533f40 100644 --- a/modules/nf-core/perbase/meta.yml +++ b/modules/nf-core/perbase/meta.yml @@ -33,6 +33,8 @@ input: type: file description: BAI/CRAI file pattern: "*.{bai,crai}" + ontologies: + - edam: "http://edamontology.org/format_3327" - - meta2: type: map description: |