Skip to content

Commit

Permalink
Gridss environment files / port to nf-test (#5932)
Browse files Browse the repository at this point in the history
* add env files

* modify meta

* update names and port to nf-test

* remove pytest

* update tests and meta, remove obsolete folders

* prettier

* just test filenames

* update tests

* Update nftest

* Working gridss/somaticfilter

* Update snapshot

* Simplify nf-test code

---------

Co-authored-by: Maxime U Garcia <[email protected]>
Co-authored-by: Simon Pearce <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent e9b59c8 commit 1f2b32d
Show file tree
Hide file tree
Showing 24 changed files with 493 additions and 210 deletions.
5 changes: 5 additions & 0 deletions modules/nf-core/gridss/generateponbedpe/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::gridss=2.13.2
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
process GRIDSS_GRIDSSGENERATEPONBEDPE {
process GRIDSS_GENERATEPONBEDPE {
tag "$meta.id"
label 'process_high'

conda "bioconda::gridss=2.13.2"
conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gridss:2.13.2--h270b39a_0':
'biocontainers/gridss:2.13.2--h270b39a_0' }"

input:
tuple val(meta), path(vcf), path(bedpe), path(bed)
tuple val(meta) , path(vcf), path(bedpe), path(bed)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fai)
tuple val(meta4), path(bwa_index)
Expand All @@ -24,18 +24,17 @@ process GRIDSS_GRIDSSGENERATEPONBEDPE {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def vcf = vcf ? "INPUT=${vcf}" : ""
def bedpe = bedpe ? "INPUT_BEDPE=${bedpe}" : ""
def bed = bed ? "INPUT_BED=${bed}" : ""
def vcf_command = vcf ? "INPUT=${vcf}" : ""
def bedpe_command = bedpe ? "INPUT_BEDPE=${bedpe}" : ""
def bed_command = bed ? "INPUT_BED=${bed}" : ""
def bwa = bwa_index ? "cp -s ${bwa_index}/* ." : ""
def ref = bwa_index ? "REFERENCE_SEQUENCE=${fasta}" : ""

"""
${bwa}
GeneratePonBedpe \\
${vcf} \\
${bedpe} \\
${bed} \\
${vcf_command} \\
${bedpe_command} \\
${bed_command} \\
${ref} \\
OUTPUT_BEDPE=${prefix}.bedpe \\
OUTPUT_BED=${prefix}.bed \\
Expand All @@ -47,6 +46,7 @@ process GRIDSS_GRIDSSGENERATEPONBEDPE {
GeneratePonBedpe: \$(echo \$(GeneratePonBedpe --version 2>&1))
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "gridss_gridssgenerateponbedpe"
name: "gridss_generateponbedpe"
description: GRIDSS is a module software suite containing tools useful for the detection
of genomic rearrangements.
keywords:
Expand All @@ -8,14 +8,12 @@ keywords:
- bed
- vcf
tools:
- "gridss":
- gridss:
description: "GRIDSS: the Genomic Rearrangement IDentification Software Suite"

documentation: "https://github.com/PapenfussLab/gridss/wiki/GRIDSS-Documentation"
tool_dev_url: "https://github.com/PapenfussLab/gridss"
doi: "10.1186/s13059-021-02423-x"
licence: ["GPL v3"]

identifier: biotools:gridss
input:
- - meta:
Expand Down Expand Up @@ -60,8 +58,8 @@ input:
e.g. [ id:'test']
- bwa_index:
type: directory
description: OPTIONAL - The BWA index created from the reference fasta, will
be generated by Gridss in the setupreference step
description: OPTIONAL - The BWA index created from the reference fasta, will be generated by Gridss in the setupreference step

output:
- bedpe:
- meta:
Expand Down Expand Up @@ -90,3 +88,5 @@ output:
pattern: "versions.yml"
authors:
- "@kubranarci"
maintainers:
- "@famosab"
107 changes: 107 additions & 0 deletions modules/nf-core/gridss/generateponbedpe/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
nextflow_process {

name "Test Process GRIDSS_GENERATEPONBEDPE"
script "../main.nf"
process "GRIDSS_GENERATEPONBEDPE"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "gridss"
tag "gridss/generateponbedpe"
tag "gridss/gridss"
tag "bwa/index"

setup {

run("BWA_INDEX") {
script "../../../bwa/index/main.nf"
process {
"""
input[0] = [ [id:'fasta'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
"""
}
}

run("GRIDSS_GRIDSS") {
script "../../../gridss/gridss/main.nf"
process {
"""
input[0] = [ [ id:'test' ], // meta map
file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), //inputs
[] //assembly
]
input[1] = [ [id:'fasta'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
input[2] = [ [id:'fasta_fai'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
input[3] = BWA_INDEX.out.index
"""
}
}

}

test("human - vcf") {

when {
process {
"""
input[0] = GRIDSS_GRIDSS.out.vcf.map{ it -> tuple( it[0], it[1], [], [] ) }
input[1] = [ [id:'fasta'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
input[2] = [ [id:'fasta_fai'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
input[3] = BWA_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
file(process.out.bed.get(0).get(1)).name,
file(process.out.bedpe.get(0).get(1)).name
).match() }
)
}

}

test("human - vcf - stub") {

options "-stub"

when {
process {
"""
input[0] = GRIDSS_GRIDSS.out.vcf.map{ it -> tuple( it[0], it[1], [], [] ) }
input[1] = [ [id:'fasta'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
input[2] = [ [id:'fasta_fai'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
input[3] = BWA_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
65 changes: 65 additions & 0 deletions modules/nf-core/gridss/generateponbedpe/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"human - vcf": {
"content": [
[
"versions.yml:md5,645a222948827e5376957f8b60fc2a05"
],
"test.bed",
"test.bedpe"
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-02T10:51:47.865144"
},
"human - vcf - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.bedpe:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test"
},
"test.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,645a222948827e5376957f8b60fc2a05"
],
"bed": [
[
{
"id": "test"
},
"test.bed:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"bedpe": [
[
{
"id": "test"
},
"test.bedpe:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,645a222948827e5376957f8b60fc2a05"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-09T16:56:29.984471332"
}
}
8 changes: 8 additions & 0 deletions modules/nf-core/gridss/generateponbedpe/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
process {
withName: BWA_INDEX {
ext.prefix = 'genome.fasta'
}
withName: GRIDSS_GENERATEPONBEDPE {
ext.args = 'NORMAL_ORDINAL=1 MIN_BREAKPOINT_QUAL=10'
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/gridss/generateponbedpe/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gridss/generateponbedpe:
- "modules/nf-core/gridss/generateponbedpe/**"
1 change: 1 addition & 0 deletions modules/nf-core/gridss/gridss/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ process GRIDSS_GRIDSS {
--threads ${task.cpus} \\
--jvmheap ${task.memory.toGiga() - 1}g \\
--otherjvmheap ${task.memory.toGiga() - 1}g \\
$args \\
${inputs}
cat <<-END_VERSIONS > versions.yml
Expand Down
26 changes: 16 additions & 10 deletions modules/nf-core/gridss/gridss/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ nextflow_process {
}

then {
assert process.success
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }
{ assert snapshot(
path(process.out.vcf.get(0).get(1)).vcf.summary, // no SVs exist in the test data
process.out.versions
).match() }
)
}

Expand All @@ -74,10 +76,12 @@ nextflow_process {
}

then {
assert process.success
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }
{ assert snapshot(
path(process.out.vcf.get(0).get(1)).vcf.summary, // no SVs exist in the test data
process.out.versions
).match() }
)
}

Expand All @@ -103,10 +107,12 @@ nextflow_process {
}

then {
assert process.success
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }
{ assert snapshot(
path(process.out.vcf.get(0).get(1)).vcf.summary, // no SVs exist in the test data
process.out.versions
).match() }
)
}

Expand Down Expand Up @@ -134,8 +140,8 @@ nextflow_process {
}

then {
assert process.success
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
Expand Down
Loading

0 comments on commit 1f2b32d

Please sign in to comment.