Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New module jvarkit/wgscoverageplotter #6633

Merged
merged 10 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/nf-core/jvarkit/wgscoverageplotter/environment.yml
Original file line number Diff line number Diff line change
@@ -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"
51 changes: 51 additions & 0 deletions modules/nf-core/jvarkit/wgscoverageplotter/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
79 changes: 79 additions & 0 deletions modules/nf-core/jvarkit/wgscoverageplotter/meta.yml
Original file line number Diff line number Diff line change
@@ -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"
71 changes: 71 additions & 0 deletions modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// nf-core modules test jvarkit/wgscoverageplotter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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() }
)
}
}
}
28 changes: 28 additions & 0 deletions modules/nf-core/jvarkit/wgscoverageplotter/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process {

withName: JVARKIT_WGSCOVERAGEPLOTTER {
ext.args1 =" --max-depth 5 "
}

}
2 changes: 2 additions & 0 deletions modules/nf-core/jvarkit/wgscoverageplotter/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jvarkit/wgscoverageplotter:
- "modules/nf-core/jvarkit/wgscoverageplotter/**"
Loading