diff --git a/modules/nf-core/jvarkit/wgscoverageplotter/environment.yml b/modules/nf-core/jvarkit/wgscoverageplotter/environment.yml new file mode 100644 index 00000000000..14d0e3387c5 --- /dev/null +++ b/modules/nf-core/jvarkit/wgscoverageplotter/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::jvarkit=2024.08.25" diff --git a/modules/nf-core/jvarkit/wgscoverageplotter/main.nf b/modules/nf-core/jvarkit/wgscoverageplotter/main.nf new file mode 100644 index 00000000000..43d81688504 --- /dev/null +++ b/modules/nf-core/jvarkit/wgscoverageplotter/main.nf @@ -0,0 +1,51 @@ +process JVARKIT_WGSCOVERAGEPLOTTER { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/jvarkit:2024.08.25--hdfd78af_1': + 'biocontainers/jvarkit:2024.08.25--hdfd78af_1' }" + + input: + tuple val(meta), path(bam), path(bai) + tuple val(meta2), path(fasta) + tuple val(meta3), path(fai) + tuple val(meta4), path(dict) + output: + tuple val(meta), path("*.svg"), emit: output + 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}" + """ + mkdir -p TMP + + jvarkit -Xmx${task.memory.giga}g -XX:-UsePerfData -Djava.io.tmpdir=TMP wgscoverageplotter \\ + -R ${fasta} \\ + ${args} \\ + ${bam} > "${prefix}.svg" + + rm -rf TMP + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + jvarkit: \$(jvarkit -v) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch "${prefix}.svg" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + jvarkit: \$(jvarkit -v) + END_VERSIONS + """ +} diff --git a/modules/nf-core/jvarkit/wgscoverageplotter/meta.yml b/modules/nf-core/jvarkit/wgscoverageplotter/meta.yml new file mode 100644 index 00000000000..f087b0d89b3 --- /dev/null +++ b/modules/nf-core/jvarkit/wgscoverageplotter/meta.yml @@ -0,0 +1,79 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "jvarkit_wgscoverageplotter" +description: Plot whole genome coverage from BAM/CRAM file as SVG +keywords: + - bam + - cram + - depth + - coverage + - xml + - svg + - visualization +tools: + - "jvarkit": + description: "Java utilities for Bioinformatics." + homepage: "https://github.com/lindenb/jvarkit" + documentation: "https://jvarkit.readthedocs.io/" + tool_dev_url: "https://github.com/lindenb/jvarkit" + doi: "10.6084/m9.figshare.1425030" + licence: ["MIT License"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - bam: + type: file + description: BAM/CRAM file from alignment + pattern: "*.{bam,cram}" + - bai: + type: file + description: BAI/CRAI file from alignment + pattern: "*.{bai,crai}" + - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test_reference' ] + - fasta: + type: file + description: The reference fasta file + pattern: "*.fasta" + - meta3: + type: map + description: | + Groovy Map containing reference fai information + e.g. [ id:'test_reference' ] + - fai: + type: file + description: Index of reference fasta file + pattern: "fasta.fai" + - meta4: + type: map + description: | + Groovy Map containing reference dict information + e.g. [ id:'test_reference' ] + - dict: + type: file + description: GATK sequence dictionary + pattern: "*.dict" +output: + - meta: + type: map + description: | + Groovy Map containing Sample information + e.g. [ id:'test', single_end:false ] + - output: + type: file + description: Output SVG file + pattern: "*.svg" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@lindenb" +maintainers: + - "@lindenb" diff --git a/modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test b/modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test new file mode 100644 index 00000000000..f4f0d7cfcc6 --- /dev/null +++ b/modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test @@ -0,0 +1,71 @@ +// nf-core modules test jvarkit/wgscoverageplotter +nextflow_process { + + name "Test Process JVARKIT_WGSCOVERAGEPLOTTER" + script "../main.nf" + process "JVARKIT_WGSCOVERAGEPLOTTER" + config "./nextflow.config" + + + tag "modules" + tag "modules_nfcore" + tag "jvarkit" + tag "jvarkit/wgscoverageplotter" + + test("sarscov2 - bam") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + input[1] = [ [:] , file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] + input[2] = [ [:] , file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) ] + input[3] = [ [:] , file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.dict', checkIfExists: true) ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert file(process.out.output[0][1]).exists() }, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] =[ + [id:"test"], + [], + [] + ] + input[1] = [ [] , [] ] + input[2] = [ [] , [] ] + input[3] = [ [] , [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert file(process.out.output[0][1]).exists() }, + { assert snapshot(process.out.versions).match() } + ) + } + } +} diff --git a/modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test.snap b/modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test.snap new file mode 100644 index 00000000000..aa6149101ee --- /dev/null +++ b/modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test.snap @@ -0,0 +1,28 @@ +{ + "sarscov2 - bam": { + "content": [ + [ + "versions.yml:md5,b0860cf56f5babf5590a1fed61e8792f" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-03T14:00:13.118369362" + }, + + "sarscov2 - bam - stub": { + "content": [ + [ + "versions.yml:md5,b0860cf56f5babf5590a1fed61e8792f" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-03T14:00:13.118369362" + } + +} diff --git a/modules/nf-core/jvarkit/wgscoverageplotter/tests/nextflow.config b/modules/nf-core/jvarkit/wgscoverageplotter/tests/nextflow.config new file mode 100644 index 00000000000..4e7cacb5563 --- /dev/null +++ b/modules/nf-core/jvarkit/wgscoverageplotter/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: JVARKIT_WGSCOVERAGEPLOTTER { + ext.args1 =" --max-depth 5 " + } + +} diff --git a/modules/nf-core/jvarkit/wgscoverageplotter/tests/tags.yml b/modules/nf-core/jvarkit/wgscoverageplotter/tests/tags.yml new file mode 100644 index 00000000000..67385596e7b --- /dev/null +++ b/modules/nf-core/jvarkit/wgscoverageplotter/tests/tags.yml @@ -0,0 +1,2 @@ +jvarkit/wgscoverageplotter: + - "modules/nf-core/jvarkit/wgscoverageplotter/**"