Skip to content

Commit

Permalink
Update glimpse2 modules (nf-core#6825)
Browse files Browse the repository at this point in the history
* Update glimpse2 modules

* Update glimpse2 phase tuple

* Update snapshot

* Add versions

---------

Co-authored-by: LouisLeNezet <[email protected]>
Co-authored-by: Sateesh_Peri <[email protected]>
  • Loading branch information
3 people authored Oct 27, 2024
1 parent 567c24f commit cc64e71
Show file tree
Hide file tree
Showing 17 changed files with 434 additions and 200 deletions.
3 changes: 1 addition & 2 deletions modules/nf-core/glimpse2/chunk/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ process GLIMPSE2_CHUNK {
'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }"

input:
tuple val(meta) , path(input), path(input_index), val(region)
tuple val(meta2), path(map)
tuple val(meta), path(input), path(input_index), val(region), path(map)
val(model)

output:
Expand Down
5 changes: 0 additions & 5 deletions modules/nf-core/glimpse2/chunk/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ input:
description: |
Target region, usually a full chromosome (e.g. chr20:1000000-2000000 or chr20).
For chrX, please treat PAR and non-PAR regions as different choromosome in order to avoid mixing ploidy.
- - meta2:
type: map
description: |
Groovy Map containing genomic map information
e.g. [ map:'GRCh38' ]
- map:
type: file
description: File containing the genetic map.
Expand Down
23 changes: 11 additions & 12 deletions modules/nf-core/glimpse2/chunk/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ nextflow_process {
tag "modules"

test("Should run without map") {
config "modules/nf-core/glimpse2/chunk/tests/nextflow.config"
config "./nextflow.config"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true),
"chr21"
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true),
"chr21", []
]
input[1]= [[ id:'map'],[]]
input[2]= "recursive"
input[1]= "recursive"
"""
}
}
Expand All @@ -36,19 +35,19 @@ nextflow_process {
}

test("Should run with map") {
config "modules/nf-core/glimpse2/chunk/tests/nextflow.config"
config "./nextflow.config"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true),
"chr21"
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true),
"chr21",
file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true)
]
input[1]= [[ id:'map'],file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true)]
input[2]= "recursive"
input[1]= "recursive"
"""
}
}
Expand Down
199 changes: 199 additions & 0 deletions modules/nf-core/glimpse2/concordance/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
nextflow_process {

name "Test Process GLIMPSE2_CONCORDANCE"
script "../main.nf"
process "GLIMPSE2_CONCORDANCE"
tag "glimpse2"
tag "glimpse2/concordance"
tag "glimpse2/phase"
tag "bcftools/index"
tag "modules_nfcore"
tag "modules"

setup {
run("GLIMPSE2_PHASE") {
script "../../phase/main.nf"
process {
"""
input_vcf = Channel.of([
[ id:'input'], // meta map
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true),
[]
])
samples_infos = Channel.of('NA12878 2').collectFile(name: 'sampleinfos.txt')
region = Channel.of(["chr21:16600000-16800000","chr21:16650000-16750000"])
ch_ref_panel = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true)
])
ch_map = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true),
])
// [meta, vcf, index, sample_infos, regionin, regionout, regionindex, ref, ref_index, map]
input[0] = input_vcf
.combine(samples_infos)
.combine(region)
.combine( ch_ref_panel )
.combine( ch_map )
input[1]= Channel.of([[],[],[]])
"""
}
}

run("BCFTOOLS_INDEX") {
script "../../../bcftools/index/main.nf"
process {
"""
input[0] = GLIMPSE2_PHASE.output.phased_variants
"""
}
}
}


test("test_glimpse2_concordance") {
config "./nextflow.config"

when {
process {
"""
allele_freq = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true)
])
truth = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true)
])
list_inputs = GLIMPSE2_PHASE.output.phased_variants
.join( BCFTOOLS_INDEX.out.csi )
.combine( truth )
.combine( allele_freq )
.combine( Channel.of([[]]) )
.combine( Channel.of(["chr21"]) )
input[0] = list_inputs
input[1] = Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]])
input[2] = 0.9999
input[3] = 8
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.errors_cal.collect{ file(it[1]).name },
process.out.errors_grp.collect{ file(it[1]).name },
process.out.errors_spl.collect{ file(it[1]).name },
process.out.rsquare_grp.collect{ file(it[1]).name },
process.out.rsquare_spl.collect{ file(it[1]).name },
process.out.versions
).match() }
)
}

}

test("test_list_region") {
config "./nextflow.config"

when {
process {
"""
allele_freq = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true)
])
truth = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true)
])
list_inputs = GLIMPSE2_PHASE.output.phased_variants
.join( BCFTOOLS_INDEX.out.csi )
.combine( truth )
.combine( allele_freq )
.combine( Channel.of([[]]) )
.combine( Channel.of(["chr21", "chr21"]) )
input[0] = list_inputs
input[1] = Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]])
input[2] = 0.9999
input[3] = 8
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.errors_cal.collect{ file(it[1]).name },
process.out.errors_grp.collect{ file(it[1]).name },
process.out.errors_spl.collect{ file(it[1]).name },
process.out.rsquare_grp.collect{ file(it[1]).name },
process.out.rsquare_spl.collect{ file(it[1]).name },
process.out.versions
).match()
}
)
}

}

test("test_r2_per_site") {
config "./nextflow_R2.config"

when {
process {
"""
allele_freq = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true)
])
truth = Channel.of([
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true),
file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true)
])
list_inputs = GLIMPSE2_PHASE.output.phased_variants
.join( BCFTOOLS_INDEX.out.csi )
.combine( truth )
.combine( allele_freq )
.combine( Channel.of([[]]) )
.combine( Channel.of(["chr21"]) )
input[0] = list_inputs
input[1] = Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]])
input[2] = 0.9999
input[3] = 8
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.errors_cal.collect{ file(it[1]).name },
process.out.errors_grp.collect{ file(it[1]).name },
process.out.errors_spl.collect{ file(it[1]).name },
process.out.rsquare_grp.collect{ file(it[1]).name },
process.out.rsquare_spl.collect{ file(it[1]).name },
process.out.rsquare_per_site.collect{ file(it[1]).name },
process.out.versions
).match()
}
)
}

}

}
86 changes: 86 additions & 0 deletions modules/nf-core/glimpse2/concordance/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"test_r2_per_site": {
"content": [
[
"input.error.cal.txt.gz"
],
[
"input.error.grp.txt.gz"
],
[
"input.error.spl.txt.gz"
],
[
"input.rsquare.grp.txt.gz"
],
[
"input.rsquare.spl.txt.gz"
],
[
"input_r2_sites.txt.gz"
],
[
"versions.yml:md5,ba729289bab6b9fbb8c36a620c86bb82"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.3"
},
"timestamp": "2024-10-22T16:23:00.623182365"
},
"test_glimpse2_concordance": {
"content": [
[
"input.error.cal.txt.gz"
],
[
"input.error.grp.txt.gz"
],
[
"input.error.spl.txt.gz"
],
[
"input.rsquare.grp.txt.gz"
],
[
"input.rsquare.spl.txt.gz"
],
[
"versions.yml:md5,ba729289bab6b9fbb8c36a620c86bb82"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.3"
},
"timestamp": "2024-10-22T16:22:26.823581573"
},
"test_list_region": {
"content": [
[
"input.error.cal.txt.gz"
],
[
"input.error.grp.txt.gz"
],
[
"input.error.spl.txt.gz"
],
[
"input.rsquare.grp.txt.gz"
],
[
"input.rsquare.spl.txt.gz"
],
[
"versions.yml:md5,ba729289bab6b9fbb8c36a620c86bb82"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.3"
},
"timestamp": "2024-10-22T16:22:43.352729014"
}
}
6 changes: 6 additions & 0 deletions modules/nf-core/glimpse2/concordance/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {
withName: GLIMPSE2_CHUNK {
ext.prefix = { "${meta.id}" }
}
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

withName:GLIMPSE2_CONCORDANCE_R2_PER_SITE {
ext.args = "--out-r2-per-site"
}
}
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

withName:GLIMPSE2_CONCORDANCE {
ext.args = "--out-r2-per-site"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/glimpse2/concordance/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
glimpse2/concordance:
- modules/nf-core/glimpse2/concordance/**
2 changes: 1 addition & 1 deletion modules/nf-core/glimpse2/ligate/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ nextflow_process {
[ id:'input' ], // meta map
file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true),
[],
[], [],
"chr21:16600000-16800000",
"chr21:16650000-16750000"
])
Expand Down
Loading

0 comments on commit cc64e71

Please sign in to comment.