Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new module EAGLE2 #7760

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions modules/nf-core/eagle2/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::eagle2=2.4.1"
61 changes: 61 additions & 0 deletions modules/nf-core/eagle2/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
process EAGLE2 {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/eagle2:2.4.1--h6a68c12_0':
'biocontainers/eagle2:2.4.1--h6a68c12_0' }"

input:
tuple val(meta), path(input), path(index), path(ref_vcf), path(ref_index), path(map)

output:
tuple val(meta), path("*.{vcf,vcf.gz,bcf}"), emit: phased_variants
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def input_cmd = ref_vcf ? "--vcfTarget $input" : "--vcf $input"
def vcfref_cmd = ref_vcf ? "--vcfRef $ref_vcf" : ""
def remove_cmd = remove ? "--remove $remove" : ""
def exclude_cmd = exclude ? "--exclude $exclude" : ""
"""
eagle \\
$input_cmd \\
$vcfref_cmd \\
--geneticMapFile $map \\
$remove_cmd \\
$exclude_cmd \\
$args \\
--numThreads $task.cpus \\
--outPrefix ${prefix} \\

cat <<-END_VERSIONS > versions.yml
"${task.process}":
eagle2: \$(eagle --help | sed -n 's/.*Eagle v\\([0-9.]\\+\\).*/\\1/p')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def extension = args.contains("--vcfOutFormat z") ? "vcf.gz" :
args.contains("--vcfOutFormat v") ? "vcf" :
args.contains("--vcfOutFormat b") ? "bcf" :
args.contains("--vcfOutFormat u") ? "bcf" :
"vcf.gz"
def create_cmd = extension.endsWith("gz") ? "echo '' | bgzip >" : "touch"
"""
${create_cmd} ${prefix}.${extension}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
eagle2: \$(eagle --help | sed -n 's/.*Eagle v\\([0-9.]\\+\\).*/\\1/p')
END_VERSIONS
"""
}
80 changes: 80 additions & 0 deletions modules/nf-core/eagle2/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "eagle2"
description: Perform phasing of genotyped cohort
keywords:
- phasing
- haplotypes
- reference panel
- genomics
tools:
- "eagle2":
description: "The Eagle software estimates haplotype phase either within a genotyped cohort or using a phased reference panel."
homepage: "https://alkesgroup.broadinstitute.org/Eagle/"
documentation: "https://alkesgroup.broadinstitute.org/Eagle/"
tool_dev_url: "https://github.com/poruloh/Eagle"
doi: "10.1038/ng.3679"
licence: ['GPL v3-or-later']

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- input:
type: file
description: Vcf file containing genotyped cohort or target samples to phase
pattern: "*.{vcf,vcf.gz,bcf}"
ontologies:
- edam: "http://edamontology.org/format_3016"
- edam: "http://edamontology.org/format_3020"
- index:
type: file
description: Input file index
pattern: "*.{csi,tbi}"
ontologies:
- edam: "http://edamontology.org/format_3700"
- ref_vcf:
type: file
description: Reference panel to phase the genotyped cohort
pattern: "*.{vcf,vcf.gz,bcf}"
ontologies:
- edam: "http://edamontology.org/format_3016"
- edam: "http://edamontology.org/format_3020"
- ref_index:
type: file
description: Reference panel index
pattern: "*.{csi,tbi}"
ontologies:
- edam: "http://edamontology.org/format_3700"
- map:
type: file
description: Genetic map file
pattern: "*.{txt,txt.gz,map,map.gz}"

output:
- phased_variants:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.{vcf,vcf.gz,bcf}":
type: file
description: Input phased variants
pattern: "*.{vcf,vcf.gz,bcf}"
ontologies:
- edam: "http://edamontology.org/format_3016"
- edam: "http://edamontology.org/format_3020"

- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@LouisLeNezet"
maintainers:
- "@LouisLeNezet"
104 changes: 104 additions & 0 deletions modules/nf-core/eagle2/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "eagle2"

config "./nextflow.config"

test("homo sapiens - vcf, [], map") {
when {
params {
eagle2_args = "--vcfOutFormat z --chrom chr22"
}
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),
[], [],
file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.GRCh38.eagle.22.map.gz", checkIfExists: true)
])
"""
}
}

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

test("homo sapiens - vcf, ref, map") {
when {
params {
eagle2_args = "--chrom chr22"
}
process {
"""
input[0] = Channel.of([
[ id:'input', single_end:false ], // meta map
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz", checkIfExists: true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi", checkIfExists: true),
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),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.GRCh38.eagle.22.map.gz", checkIfExists: true)
])
"""
}
}

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

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

options "-stub"

when {
params {
eagle2_args = "--vcfOutFormat b"
}
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),
[], [], []
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out,
path(process.out.versions.get(0)).yaml
).match() }
)
}

}

}
84 changes: 84 additions & 0 deletions modules/nf-core/eagle2/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"homo sapiens - vcf, [], map": {
"content": [
[
[
{
"id": "input",
"single_end": false
},
"input.vcf.gz"
]
],
[
"versions.yml:md5,89d3594c73cc7a875c60ea2762042bbb"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-03-09T19:41:48.000108431"
},
"homo sapiens - vcf, [], [] - stub": {
"content": [
{
"0": [
[
{
"id": "input",
"single_end": false
},
"input.bcf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,89d3594c73cc7a875c60ea2762042bbb"
],
"phased_variants": [
[
{
"id": "input",
"single_end": false
},
"input.bcf:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,89d3594c73cc7a875c60ea2762042bbb"
]
},
{
"EAGLE2": {
"eagle2": "2.4.1"
}
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-03-09T18:27:55.049410748"
},
"homo sapiens - vcf, ref, map": {
"content": [
[
[
{
"id": "input",
"single_end": false
},
"input.vcf.gz"
]
],
[
"versions.yml:md5,89d3594c73cc7a875c60ea2762042bbb"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.4"
},
"timestamp": "2025-03-09T19:41:55.432871651"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/eagle2/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: "EAGLE2" {
ext.args = {"${params.eagle2_args}"}
}
}
Loading