Skip to content

Commit

Permalink
Update shapeit5 phaserare
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisLeNezet committed Dec 4, 2024
1 parent 6aed502 commit 08a702c
Show file tree
Hide file tree
Showing 10 changed files with 180 additions and 77 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/shapeit5/phaserare/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::shapeit5=1.0.0
- bioconda::shapeit5=5.1.1
17 changes: 9 additions & 8 deletions modules/nf-core/shapeit5/phaserare/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ process SHAPEIT5_PHASERARE {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/shapeit5:1.0.0--h0c8ee15_0':
'biocontainers/shapeit5:1.0.0--h0c8ee15_0' }"
'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0':
'biocontainers/shapeit5:5.1.1--hb60d31d_0' }"

input:
tuple val(meta) , path(input_plain), path(input_plain_index), path(pedigree), val(input_region)
tuple val(meta2), path(scaffold) , path(scaffold_index) , val(scaffold_region)
tuple val(meta) , path(input) , path(input_index) , path(pedigree), val(input_region)
tuple val(meta2), path(scaffold) , path(scaffold_index) , val(scaffold_region)
tuple val(meta3), path(map)

output:
Expand All @@ -34,15 +34,16 @@ process SHAPEIT5_PHASERARE {
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "vcf.gz"

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

def map_command = map ? "--map $map" : ""
def pedigree_command = pedigree ? "--pedigree $pedigree" : ""

"""
SHAPEIT5_phase_rare \\
$args \\
--input-plain $input_plain \\
--input $input \\
--scaffold $scaffold \\
$map_command \\
$pedigree_command \\
Expand All @@ -58,11 +59,11 @@ process SHAPEIT5_PHASERARE {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def suffix = task.ext.suffix ?: "vcf.gz"
def create_cmd = suffix.endsWith(".gz") ? "echo '' | gzip >" : "touch"
"""
touch ${prefix}.${suffix}
${create_cmd} ${prefix}.${suffix}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
4 changes: 2 additions & 2 deletions modules/nf-core/shapeit5/phaserare/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- input_plain:
- input:
type: file
description: |
Genotypes to be phased in plain VCF/BCF format.
pattern: "*.{vcf,bcf,vcf.gz,bcf.gz}"
- input_plain_index:
- input_index:
type: file
description: Index file of the input_plain VCF/BCF file containing genotype
likelihoods.
Expand Down
105 changes: 105 additions & 0 deletions modules/nf-core/shapeit5/phaserare/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "shapeit5"
tag "shapeit5/phaserare"
tag "shapeit5/phasecommon"
tag "bcftools/index"

test("homo sapiens - vcf, scaffold, []") {
config "./nextflow.config"
setup {
run("SHAPEIT5_PHASECOMMON") {
script "../../../shapeit5/phasecommon"
params {
shapeit5_phasecommon_args = "--filter-maf 0.001"
}
process {
"""
input[0] = Channel.of([
[ id:'scaffold', 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",
])
input[1] = Channel.of([[],[],[]])
input[2] = Channel.of([[],[],[]])
input[3] = Channel.of([[],[]])
"""
}
}
run("BCFTOOLS_INDEX") {
script "../../../bcftools/index"
process {
"""
input[0] = SHAPEIT5_PHASECOMMON.out.phased_variant
"""
}
}
}

when {
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:16580000-16600000",
])
input[1] = SHAPEIT5_PHASECOMMON.out.phased_variant
.join(BCFTOOLS_INDEX.out.csi)
.combine(Channel.of("chr22:16570000-16610000"))
input[2] = Channel.of([[],[]])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.phased_variant.collect { meta, vcf -> [ meta, file(vcf).name ] },
process.out.versions
).match() }
)
}

}

test("homo sapiens - vcf, scaffold, [] - stub") {
options "-stub"

when {
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:16580000-16600000",
])
input[1] = Channel.of([[],[],[],[]])
input[2] = Channel.of([[],[]])
"""
}
}

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

}

}
58 changes: 58 additions & 0 deletions modules/nf-core/shapeit5/phaserare/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"homo sapiens - vcf, scaffold, [] - stub": {
"content": [
{
"0": [
[
{
"id": "input",
"single_end": false
},
"input.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
"versions.yml:md5,c8092f58dd64199400ee9b9bfd96032e"
],
"phased_variant": [
[
{
"id": "input",
"single_end": false
},
"input.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,c8092f58dd64199400ee9b9bfd96032e"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T18:11:56.868657182"
},
"homo sapiens - vcf, scaffold, []": {
"content": [
[
[
{
"id": "input",
"single_end": false
},
"input.vcf.gz"
]
],
[
"versions.yml:md5,c8092f58dd64199400ee9b9bfd96032e"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-22T18:35:35.056441054"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/shapeit5/phaserare/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: SHAPEIT5_PHASECOMMON {
ext.args = params.shapeit5_phasecommon_args
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,6 @@ sgdemux:
shapeit5/ligate:
- modules/nf-core/shapeit5/ligate/**
- tests/modules/nf-core/shapeit5/ligate/**
shapeit5/phaserare:
- modules/nf-core/shapeit5/phaserare/**
- tests/modules/nf-core/shapeit5/phaserare/**
shapeit5/switch:
- modules/nf-core/shapeit5/switch/**
- tests/modules/nf-core/shapeit5/switch/**
Expand Down
40 changes: 0 additions & 40 deletions tests/modules/nf-core/shapeit5/phaserare/main.nf

This file was deleted.

12 changes: 0 additions & 12 deletions tests/modules/nf-core/shapeit5/phaserare/nextflow.config

This file was deleted.

11 changes: 0 additions & 11 deletions tests/modules/nf-core/shapeit5/phaserare/test.yml

This file was deleted.

0 comments on commit 08a702c

Please sign in to comment.