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

port tiddit-sv to nf-test and add --threads #5371

Merged
merged 9 commits into from
Mar 22, 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
1 change: 1 addition & 0 deletions modules/nf-core/tiddit/sv/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ process TIDDIT_SV {
tiddit \\
--sv \\
$args \\
--threads $task.cpus \\
--bam $input \\
--ref $fasta \\
-o $prefix
Expand Down
12 changes: 11 additions & 1 deletion modules/nf-core/tiddit/sv/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,24 @@ input:
type: file
description: BAM/CRAM file
pattern: "*.{bam,cram}"
- index:
- input_index:
type: file
description: BAM/CRAM index file
pattern: "*.{bai,crai}"
- meta2:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test_fasta']`
- fasta:
type: file
description: Input FASTA file
pattern: "*.{fasta,fa}"
- meta3:
type: map
description: |
Groovy Map containing sample information from bwa index
e.g. `[ id:'test_bwa-index' ]`
- bwa_index:
type: file
description: BWA genome index files
Expand Down
193 changes: 193 additions & 0 deletions modules/nf-core/tiddit/sv/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "tiddit"
tag "tiddit/sv"
tag "bwa/index"

test("sarscov2 - bam - bwa") {

setup {

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

when {
process {
"""
input[0] = [ [ id:'test' ], // 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/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
]
// fasta
input[1] = [ [id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
// bwa_index
input[2] = BWA_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") },
{ assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") },
{ assert snapshot(process.out.versions).match("bam_bwa_version") }
)
}

}

test("sarscov2 - bam - no_bwa") {

config "./nextflow.config"

when {
process {
"""
input[0] = [ [ id:'test' ], // 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/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
]
// fasta
input[1] = [ [id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
// bwa_index
input[2] = [ [], [] ]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") },
{ assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") },
{ assert snapshot(process.out.versions).match("bam_version") }
)
}

}

test("human - cram - bwa") {

setup {

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

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),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true)
]
// fasta
input[1] = [ [id: 'test'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
// bwa_index
input[2] = BWA_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") },
{ assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") },
{ assert snapshot(process.out.versions).match("cram_bwa_version") })
}

}

test("human - cram - no_bwa") {

config "./nextflow.config"

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),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true)
]
// fasta
input[1] = [ [id: 'test'],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
]
// bwa_index
input[2] = [ [], [] ]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") },
{ assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") },
{ assert snapshot(process.out.versions).match("cram_version") })
}

}

test("sarscov2 - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [ [ id:'test' ], // 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/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
]
// fasta
input[1] = [ [id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
// bwa_index
input[2] = [ [], [] ]
"""
}
}

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

}

}
99 changes: 99 additions & 0 deletions modules/nf-core/tiddit/sv/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions modules/nf-core/tiddit/sv/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: 'TIDDIT_SV' {
ext.args = '--skip_assembly'
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/tiddit/sv/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tiddit/sv:
- "modules/nf-core/tiddit/sv/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2192,9 +2192,6 @@ tbprofiler/profile:
tiara/tiara:
- modules/nf-core/tiara/tiara/**
- tests/modules/nf-core/tiara/tiara/**
tiddit/sv:
- modules/nf-core/tiddit/sv/**
- tests/modules/nf-core/tiddit/sv/**
topas/gencons:
- modules/nf-core/topas/gencons/**
- tests/modules/nf-core/topas/gencons/**
Expand Down
Loading
Loading