Skip to content

Commit

Permalink
Swap ngscheckmate/ncm to nftest (nf-core#5679)
Browse files Browse the repository at this point in the history
* Swap ngscheckmate/ncm to nftest

* Update main.nf.test
  • Loading branch information
SPPearce authored and tstoeriko committed May 23, 2024
1 parent ffcbc31 commit 7603354
Show file tree
Hide file tree
Showing 10 changed files with 448 additions and 131 deletions.
1 change: 1 addition & 0 deletions modules/nf-core/ngscheckmate/ncm/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ process NGSCHECKMATE_NCM {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "$meta.id"
"""
touch ${prefix}_output_corr_matrix.txt
Expand Down
5 changes: 5 additions & 0 deletions modules/nf-core/ngscheckmate/ncm/tests/bam.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: NGSCHECKMATE_NCM {
ext.args = '-B'
}
}
184 changes: 184 additions & 0 deletions modules/nf-core/ngscheckmate/ncm/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "ngscheckmate"
tag "ngscheckmate/ncm"
tag "bedtools/makewindows"
tag "bcftools/mpileup"

setup {

run("BEDTOOLS_MAKEWINDOWS") {
script "../../../bedtools/makewindows/main.nf"
process {
"""
input[0] = [ [ id:'test' ],
file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)
]
"""
}
}

run("BCFTOOLS_MPILEUP", alias: "BCFTOOLS_MPILEUP1") {
script "../../../bcftools/mpileup/main.nf"
process {
"""
input[0] = [
[ id:'test1' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)
]
input[1] = [ [ id:'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
input[2] = false
"""
}
}

run("BCFTOOLS_MPILEUP", alias: "BCFTOOLS_MPILEUP2") {
script "../../../bcftools/mpileup/main.nf"
process {
"""
input[0] = [
[ id:'test2' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true),
file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)
]
input[1] = [ [ id:'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
input[2] = false
"""
}
}

}


test("sarscov2 - bam") {
config "./bam.config"
when {
process {
"""
input[0] = [ [ id: 'combined_bams' ],
[file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'] , checkIfExists: true ),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'] , checkIfExists: true ),
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam'] , checkIfExists: true ),
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam_bai'], checkIfExists: true )
]
]
input[1] = BEDTOOLS_MAKEWINDOWS.out.bed
input[2] = [ [ id:'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.corr_matrix,
process.out.matched,
process.out.all,
process.out.versions
).match() }
)
}

}

test("sarscov2 - vcf") {
config "./vcf.config"
when {
process {
"""
input[0] = BCFTOOLS_MPILEUP1.out.vcf.combine(BCFTOOLS_MPILEUP2.out.vcf.map{it[1]}).map{meta, one, two -> [meta, [one, two]]}.map{meta, stuff -> [meta, stuff.flatten()]}
input[1] = BEDTOOLS_MAKEWINDOWS.out.bed
input[2] = [ [ id:'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.corr_matrix,
process.out.matched,
process.out.all,
file(process.out.pdf[0][1]).name,
process.out.versions
).match() }
)
}

}

test("sarscov2 - bam - stub") {

options "-stub"
config "./bam.config"
when {
process {
"""
input[0] = [ [ id: 'combined_bams' ],
[file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'] , checkIfExists: true ),
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'] , checkIfExists: true ),
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam'] , checkIfExists: true ),
file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam_bai'], checkIfExists: true )
]
]
input[1] = BEDTOOLS_MAKEWINDOWS.out.bed
input[2] = [ [ id:'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
"""
}
}

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

}

test("sarscov2 - vcf - stub") {

options "-stub"
config "./vcf.config"
when {
process {
"""
input[0] = BCFTOOLS_MPILEUP1.out.vcf.combine(BCFTOOLS_MPILEUP2.out.vcf.map{it[1]})
input[1] = BEDTOOLS_MAKEWINDOWS.out.bed
input[2] = [ [ id:'sarscov2' ],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
"""
}
}

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

}

}
Loading

0 comments on commit 7603354

Please sign in to comment.