Skip to content
Open
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
2 changes: 1 addition & 1 deletion modules/nf-core/shapeit5/ligate/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ process SHAPEIT5_LIGATE {
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "vcf.gz"
"""
printf "%s\\n" $input_list | tr -d '[],' > all_files.txt
printf "%s\\n" $input_list | tr -d '[],' | sort -V > all_files.txt
SHAPEIT5_ligate \\
$args \\
Expand Down
57 changes: 23 additions & 34 deletions modules/nf-core/shapeit5/ligate/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ nextflow_process {
script "../main.nf"
process "SHAPEIT5_LIGATE"

config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "shapeit5"
Expand All @@ -13,36 +15,17 @@ nextflow_process {
test("homo sapiens - map, [vcf], [tbi]") {
config "./nextflow.config"
setup {
run("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_1") {
script "../../../bcftools/view"
params {
bcftools_args = "--regions chr22:16570000-16600000 -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'"
}
process {
"""
input[0] = [
[ id:'NA12878_1' ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz.csi", checkIfExists: true),
]
input[1] = []
input[2] = []
input[3] = []
"""
}
}
run("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_2") {
run("BCFTOOLS_VIEW") {
script "../../../bcftools/view"
params {
bcftools_args = "--regions chr22:16580000-16610000 -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'"
}
process {
"""
input[0] = [
[ id:'NA12878_2' ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz.csi", checkIfExists: true),
]
input[0] = channel.of(
[ id:'NA12878', region: "chr22:16570000-16600000" ],
[ id:'NA12878', region: "chr22:16580000-16610000" ]
).combine(channel.of([
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr21_22.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr21_22.vcf.gz.csi", checkIfExists: true),
]))
input[1] = []
input[2] = []
input[3] = []
Expand All @@ -54,9 +37,8 @@ nextflow_process {
when {
process {
"""
input[0] = BCFTOOLS_VIEW_1.out.vcf.join(BCFTOOLS_VIEW_1.out.csi)
.mix(BCFTOOLS_VIEW_2.out.vcf.join(BCFTOOLS_VIEW_2.out.csi))
.map { meta, vcf, csi -> [ [id : "NA12878"], vcf, csi ] }
input[0] = BCFTOOLS_VIEW.out.vcf.join(BCFTOOLS_VIEW.out.csi)
.map{ meta, vcf, index -> [meta.subMap("id"), vcf, index]}
.groupTuple()
"""
}
Expand All @@ -66,8 +48,15 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.merged_variants.collect {meta, vcf -> [ meta, path(vcf).vcf.summary ]},
process.out.versions
process.out.merged_variants.collect {
meta, vcf -> [
meta,
file(vcf).name,
path(vcf).vcf.summary,
path(vcf).vcf.variantsMD5
]
},
["versions": process.out.versions]
).match() }
)
}
Expand All @@ -81,8 +70,8 @@ nextflow_process {
"""
input[0] = [
[id: 'NA12878'],
[file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz", checkIfExists: true)],
[file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr22.vcf.gz.csi", checkIfExists: true)]
[file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr21_22.vcf.gz", checkIfExists: true)],
[file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr21_22.vcf.gz.csi", checkIfExists: true)]
]
"""
}
Expand Down
24 changes: 14 additions & 10 deletions modules/nf-core/shapeit5/ligate/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2024-11-22T17:22:34.235879155"
"timestamp": "2025-11-26T17:58:05.130390005"
},
"homo sapiens - map, [vcf], [tbi]": {
"content": [
Expand All @@ -39,17 +39,21 @@
{
"id": "NA12878"
},
"VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=60, phased=false, phasedAutodetect=false]"
"NA12878.vcf.gz",
"VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=81, phased=false, phasedAutodetect=false]",
"e0d8b01df09f70f7ccd010f42a7e07c5"
]
],
[
"versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b"
]
{
"versions": [
"versions.yml:md5,4b66c655a4fd210ca7bc47b6fe35230b"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2024-12-04T10:07:53.185018802"
"timestamp": "2025-11-26T18:01:39.348167832"
}
}
6 changes: 3 additions & 3 deletions modules/nf-core/shapeit5/ligate/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process {
withName: "BCFTOOLS_VIEW_*" {
ext.args = params.bcftools_args
ext.prefix = { "${meta.id}" }
withName: "BCFTOOLS_VIEW" {
ext.args = { "--regions ${meta.region} -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'" }
ext.prefix = { "${meta.id}_${meta.region}" }
}
}
27 changes: 15 additions & 12 deletions modules/nf-core/shapeit5/phasecommon/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ process SHAPEIT5_PHASECOMMON {
'biocontainers/shapeit5:5.1.1--hb60d31d_0'}"

input:
tuple val(meta) , path(input), path(input_index), path(pedigree), val(region)
tuple val(meta2), path(reference), path(reference_index)
tuple val(meta3), path(scaffold), path(scaffold_index)
tuple val(meta4), path(map)
tuple val(meta), path(input), path(input_index), path(pedigree), val(region), path(reference), path(reference_index), path(scaffold), path(scaffold_index), path(map)

output:
tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: phased_variant
Expand All @@ -23,9 +20,13 @@ process SHAPEIT5_PHASECOMMON {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "bcf"

if ("$input" == "${prefix}.${suffix}") error "Input and output names are the same, set prefix in module configuration to disambiguate!"
def extension = args.contains("--output-format bcf") ? "bcf" :
args.contains("--output-format graph") ? "graph" :
args.contains("--output-format bh") ? "bh" :
"bcf"

if ("$input" == "${prefix}.${extension}") error "Input and output names are the same, set prefix in module configuration to disambiguate!"

def map_command = map ? "--map $map" : ""
def reference_command = reference ? "--reference $reference" : ""
Expand All @@ -42,24 +43,26 @@ process SHAPEIT5_PHASECOMMON {
$pedigree_command \\
--region $region \\
--thread $task.cpus \\
--output ${prefix}.${suffix}
--output ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
shapeit5: "\$(SHAPEIT5_phase_common | sed -nr '/Version/p' | grep -o -E '([0-9]+.){1,2}[0-9]' | head -1)"
shapeit5: "\$(SHAPEIT5_phase_common | sed -nr '/Version/p' | grep -o -E '([0-9]+.){1,2}[0-9]' | head -n 1)"
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "bcf"
def create_cmd = suffix.endsWith(".gz") ? "echo '' | gzip >" : "touch"
def extension = args.contains("--output-format bcf") ? "bcf" :
args.contains("--output-format graph") ? "graph" :
args.contains("--output-format bh") ? "bh" :
"bcf"
"""
${create_cmd} ${prefix}.${suffix}
touch ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
shapeit5: "\$(SHAPEIT5_phase_common | sed -nr '/Version/p' | grep -o -E '([0-9]+.){1,2}[0-9]' | head -1)"
shapeit5: "\$(SHAPEIT5_phase_common | sed -nr '/Version/p' | grep -o -E '([0-9]+.){1,2}[0-9]' | head -n 1)"
END_VERSIONS
"""
}
17 changes: 1 addition & 16 deletions modules/nf-core/shapeit5/phasecommon/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ input:
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.
pattern: "chrXX:leftBufferPosition-rightBufferPosition"
- - meta2:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reference:
type: file
description: Reference panel of haplotypes in VCF/BCF format.
Expand All @@ -60,11 +55,6 @@ input:
description: Index file of the Reference panel file.
pattern: "*.{vcf.gz.csi,bcf.gz.csi}"
ontologies: []
- - meta3:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- scaffold:
type: file
description: Scaffold of haplotypes in VCF/BCF format.
Expand All @@ -75,14 +65,9 @@ input:
description: Index file of the scaffold file.
pattern: "*.{vcf.gz.csi,bcf.gz.csi}"
ontologies: []
- - meta4:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- map:
type: file
description: File containing the genetic map.
description: File containing the genetic map in Glimpse format.
pattern: "*.gmap"
ontologies: []
output:
Expand Down
66 changes: 53 additions & 13 deletions modules/nf-core/shapeit5/phasecommon/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,30 @@ nextflow_process {
script "../main.nf"
process "SHAPEIT5_PHASECOMMON"

config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "shapeit5"
tag "shapeit5/phasecommon"

test("homo sapiens - vcf, [], [], []") {
test("homo sapiens - vcf, no reference, no scaffold, no map") {
when {
params {
shapeit5_phasecommon_args = "--seed 1"
}
process {
"""
input[0] = Channel.of([
[ id:'input', single_end:false ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists: true),
[],
"chr22"
"chr22",
[],[], // reference
[],[], // scaffold
[] // map
])
input[1] = Channel.of([[],[],[]])
input[2] = Channel.of([[],[],[]])
input[3] = Channel.of([[],[]])
"""
}
}
Expand All @@ -31,30 +36,65 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.phased_variant.collect{ meta, vcf -> [meta, file(vcf).name]},
process.out.versions
process.out.phased_variant.collect{
meta, vcf -> [ meta, file(vcf).name ] // Only file name tested due to bcf format
},
["versions": process.out.versions]
).match() }
)
}

}

test("homo sapiens - vcf, [], [], [] - stub") {
options '-stub'
test("homo sapiens - vcf, no reference, no scaffold, with map") {
when {
params {
shapeit5_phasecommon_args = "--seed 1"
}
process {
"""
input[0] = Channel.of([
[ id:'input', single_end:false ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists: true),
[],
"chr22"
"chr22",
[],[], // reference
[],[], // scaffold
file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExists: true)
])
"""
}
}

input[1] = Channel.of([[],[],[]])
input[2] = Channel.of([[],[],[]])
input[3] = Channel.of([[],[]])
then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.phased_variant.collect{
meta, vcf -> [ meta, file(vcf).name ] // Only file name tested due to bcf format
},
["versions": process.out.versions]
).match() }
)
}

}

test("homo sapiens - vcf, [], [], [] - stub") {
options '-stub'
when {
params {
shapeit5_phasecommon_args = "--seed 1"
}
process {
"""
input[0] = Channel.of([
[ id:'input', single_end:false ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists: true),
[], "chr22", [], [], [], [], []
])
"""
}
}
Expand Down
Loading
Loading