Skip to content

Commit

Permalink
Unit testing for COBALT
Browse files Browse the repository at this point in the history
  • Loading branch information
rhassaine committed Feb 4, 2025
1 parent c9a16b1 commit cb2a0f5
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions tests/modules/local/cobalt/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
nextflow_process {

name "Test Process COBALT"
script "modules/local/cobalt/main.nf"
process "COBALT"

test("COBALT testing tumor + normal") {

when {
params {
test_sample_data = 'https://raw.githubusercontent.com/nf-core/test-datasets/oncoanalyser/sample_data/simulated_reads/wgts/markdups_bam/'// define parameters here. Example:
}
process {
"""
// define inputs of the process here. Example:
// input[0] = file("test-file.txt")
input[0] = [
[id: 'test',
tumor_id: 'tumor_test',
normal_id: 'normal_test'
],
file(params.test_sample_data + 'subject_a.tumor.dna.bwa-mem2_2.2.1.markdups.bam', checkIfExists: true),
file(params.test_sample_data + 'subject_a.normal.dna.bwa-mem2_2.2.1.markdups.bam', checkIfExists: true),
file(params.test_sample_data + 'subject_a.tumor.dna.bwa-mem2_2.2.1.markdups.bam.bai', checkIfExists: true),
file(params.test_sample_data + 'subject_a.normal.dna.bwa-mem2_2.2.1.markdups.bam.bai', checkIfExists: true),
]
input[1] = file("https://raw.githubusercontent.com/nf-core/test-datasets/oncoanalyser/reference_data/hmftools/5.34_38--2/dna_pipeline/copy_number/GC_profile.1000bp.38.cnp")
input[2] = []
input[3] = []
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert path(process.out.cobalt_ratio).exists() },
{ assert path(process.out.cobalt_ratio).getText().contains("Chromosome\tPosition\tRatio") },
{ assert path(process.out.cobalt_pcf).exists() },
{ assert path(process.out.cobalt_pcf).getText().contains("Chromosome\tPosition\tRatio") },
{ assert path(process.out.cobalt_gc).exists() },
{ assert path(process.out.cobalt_gc).getText().contains("Chromosome\tPosition\tGCContent") }
)
}

}

test("COBALT with tumor only") {
when {
params {
// publish_dir_mode = "symlink"
test_sample_data = 'https://raw.githubusercontent.com/nf-core/test-datasets/oncoanalyser/sample_data/simulated_reads/wgts/markdups_bam/'
}
process {
"""
input[0] = [
[id: 'test', tumor_id: 'tumor_test'],
file(params.test_sample_data + 'subject_a.tumor.dna.bwa-mem2_2.2.1.markdups.bam', checkIfExists: true),
[],
file(params.test_sample_data + 'subject_a.tumor.dna.bwa-mem2_2.2.1.markdups.bam.bai', checkIfExists: true),
[]
]
input[1] = file("https://raw.githubusercontent.com/nf-core/test-datasets/oncoanalyser/reference_data/hmftools/5.34_38--2/dna_pipeline/copy_number/GC_profile.1000bp.38.cnp")
input[2] = file("https://raw.githubusercontent.com/nf-core/test-datasets/oncoanalyser/reference_data/hmftools/5.34_38--2/dna_pipeline/copy_number/DiploidRegions.38.bed.gz")
input[3] = []
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() },
{ assert path(process.out.cobalt_ratio).exists() },
{ assert path(process.out.cobalt_ratio).getText().contains("Chromosome\tPosition\tRatio") },
{ assert path(process.out.cobalt_pcf).exists() },
{ assert path(process.out.cobalt_pcf).getText().contains("Chromosome\tPosition\tRatio") },
{ assert path(process.out.cobalt_gc).exists() },
{ assert path(process.out.cobalt_gc).getText().contains("Chromosome\tPosition\tGCContent") },
{ assert path(process.out.cobalt_diploid_bed).exists() },
{ assert path(process.out.cobalt_diploid_bed).getText().contains("chr\tstart\tend") }
)
}
}

}

0 comments on commit cb2a0f5

Please sign in to comment.