Skip to content

Commit

Permalink
port gridss/gridss to nf-test (#5933)
Browse files Browse the repository at this point in the history
* port

* remove pytest files

* fix meta

* Update meta.yml

* fix indentation

* update test with bam plugin

* fix indents, try other test

* remove --assembly flag for now

---------

Co-authored-by: Maxime U Garcia <[email protected]>
  • Loading branch information
famosab and maxulysse committed Jul 12, 2024
1 parent b80f5fd commit c349214
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 157 deletions.
11 changes: 3 additions & 8 deletions modules/nf-core/gridss/gridss/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ process GRIDSS_GRIDSS {
'biocontainers/gridss:2.13.2--h270b39a_0' }"

input:
tuple val(meta), path(inputs), path(assembly)
tuple val(meta) , path(inputs)
tuple val(meta2), path(fasta)
tuple val(meta3), path(fasta_fai)
tuple val(meta4), path(bwa_index)

output:
tuple val(meta), path("*.vcf.gz") , emit: vcf, optional:true
tuple val(meta), path("*.assembly.bam") , emit: assembly, optional:true
tuple val(meta), path("*.vcf.gz") , emit: vcf
path "versions.yml" , emit: versions

when:
Expand All @@ -26,7 +25,6 @@ process GRIDSS_GRIDSS {
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '2.13.2' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.

def assembly_bam = assembly ? "--assembly ${assembly}" : ""
def bwa = bwa_index ? "cp -s ${bwa_index}/* ." : ""

"""
Expand All @@ -36,7 +34,6 @@ process GRIDSS_GRIDSS {
--output ${prefix}.vcf.gz \\
--reference ${fasta} \\
--threads ${task.cpus} \\
${assembly} \\
--jvmheap ${task.memory.toGiga() - 1}g \\
--otherjvmheap ${task.memory.toGiga() - 1}g \\
${inputs}
Expand All @@ -55,11 +52,9 @@ process GRIDSS_GRIDSS {
def steps = args.contains("-s ") ? args.split('-s ')[-1].split(" ")[0] :
args.contains("--steps ") ? args.split('--steps ')[-1].split(" ")[0] :
"all"
def vcf = steps.contains("call") || steps.contains("all") ? "touch ${prefix}.vcf.gz" : ""
def assembly_bam = steps.contains("assembly") || steps.contains("all") ? "touch ${prefix}.assembly.bam" : ""
def vcf = steps.contains("call") || steps.contains("all") ? "echo '' | gzip > ${prefix}.vcf.gz" : ""
"""
${vcf}
${assembly_bam}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
18 changes: 5 additions & 13 deletions modules/nf-core/gridss/gridss/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ keywords:
- cram
- 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']"
licence: ["GPL v3"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
e.g. [ id:'test']
- inputs:
type: file(s)
type: file
description: One or more input BAM/CRAM file(s)
pattern: "*.{bam,cram}"
- assembly:
type: file
description: OPTIONAL - An assembly BAM file created by the assembly step of Gridss
pattern: "*.bam"
- fasta:
type: file
description: The reference fasta
Expand All @@ -43,7 +39,7 @@ output:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
e.g. [ id:'test' ]
- versions:
type: file
description: File containing software versions
Expand All @@ -52,10 +48,6 @@ output:
type: file
description: The called VCF file created by Gridss' call step
pattern: "*.vcf.gz"
- assembly:
type: file
description: The assembly BAM file created by Gridss' assembly step
pattern: "*.assembly.bam"
authors:
- "@nvnieuwk"
maintainers:
Expand Down
145 changes: 145 additions & 0 deletions modules/nf-core/gridss/gridss/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
nextflow_process {

name "Test Process GRIDSS_GRIDSS"
script "../main.nf"
process "GRIDSS_GRIDSS"

tag "modules"
tag "modules_nfcore"
tag "gridss"
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)
]
"""
}
}

}

test("human - bam - bwa") {

when {
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
]
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).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }
)
}

}

test("human - bam") {

when {
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
]
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] = [ [], [] ]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }
)
}

}

test("human - cram") {

when {
process {
"""
input[0] = [ [ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), //inputs
]
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] = [ [], [] ]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() },
{ assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }
)
}

}

test("human - bam - stub") {

options "-stub"

when {
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
]
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] = [ [], [] ]
"""
}
}

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

}

}
83 changes: 83 additions & 0 deletions modules/nf-core/gridss/gridss/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"human - bam - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
"versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80"
],
"vcf": [
[
{
"id": "test"
},
"test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-10T11:48:56.7778"
},
"human - bam - bwa": {
"content": [
[
"versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-10T11:47:23.943354"
},
"human - bam": {
"content": [
[
"versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-10T11:48:06.074469"
},
"human - cram": {
"content": [
[
"versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-10T11:48:45.270441"
},
"human - bam - assembly": {
"content": [
[
"versions.yml:md5,139867df5d7eaf22a89ae574f08e8d80"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-09T14:13:21.550069"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/gridss/gridss/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gridss/gridss:
- "modules/nf-core/gridss/gridss/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,6 @@ graphtyper/vcfconcatenate:
grids/gridsssomaticfilter:
- modules/nf-core/grids/gridsssomaticfilter/**
- tests/modules/nf-core/grids/gridsssomaticfilter/**
gridss/gridss:
- modules/nf-core/gridss/gridss/**
- tests/modules/nf-core/gridss/gridss/**
gridss/gridssgenerateponbedpe:
- modules/nf-core/gridss/gridssgenerateponbedpe/**
- tests/modules/nf-core/gridss/gridssgenerateponbedpe/**
Expand Down
Loading

0 comments on commit c349214

Please sign in to comment.