Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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/plink2/hwe/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::plink2=2.00a5.10
63 changes: 63 additions & 0 deletions modules/nf-core/plink2/hwe/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
process PLINK2_HWE {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/plink2:2.00a5.10--h4ac6f70_0':
'biocontainers/plink2:2.00a5.10--h4ac6f70_0' }"

input:
tuple val(meta), path(plink_genotype_file), path(plink_variant_file), path(plink_sample_file)
val (hwe)

output:
tuple val(meta), path("*.bim") , emit: bim, optional: true
tuple val(meta), path("*.bed") , emit: bed, optional: true
tuple val(meta), path("*.fam") , emit: fam, optional: true
tuple val(meta), path("*.pgen") , emit: pgen, optional: true
tuple val(meta), path("*.psam") , emit: psam, optional: true
tuple val(meta), path("*.pvar") , emit: pvar, optional: true
path "versions.yml" , emit: versions
Comment thread
jodennehy marked this conversation as resolved.
Outdated

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def mode = plink_genotype_file.extension == 'pgen' ? '--pfile' : '--bfile'
def outtype = plink_genotype_file.extension == "pgen" ? '--make-pgen' : '--make-bed'
def input = "${plink_genotype_file.getBaseName()}"
if( "${input}" == "${prefix}" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"

Comment thread
jodennehy marked this conversation as resolved.
Outdated
"""
plink2 \\
$mode $input \\
$args \\
--hwe $hwe \\
--threads $task.cpus \\
$outtype \\
--out $prefix

cat <<-END_VERSIONS > versions.yml
"${task.process}":
plink2: \$(plink2 --version 2>&1 | sed 's/^PLINK v//; s/ 64.*\$//' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def trio = plink_genotype_file.extension == 'pgen' ? "${prefix}.pgen ${prefix}.psam ${prefix}.pvar" : "${prefix}.bed ${prefix}.bim ${prefix}.fam"
if( "${plink_genotype_file.getBaseName()}" == "${prefix}" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
touch ${trio}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
plink2: \$(plink2 --version 2>&1 | sed 's/^PLINK v//; s/ 64.*\$//' )
END_VERSIONS
"""

}
131 changes: 131 additions & 0 deletions modules/nf-core/plink2/hwe/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
name: "plink2_hwe"
description: Filters plink bfiles or pfiles with maf filters
keywords:
- plink2
- filter
- samples
- variants
- hwe
- qualty
tools:
- "plink2":
description: |
Whole genome association analysis toolset, designed to perform a range
of basic, large-scale analyses in a computationally efficient manner
homepage: http://www.cog-genomics.org/plink/2.0/
documentation: http://www.cog-genomics.org/plink/2.0/general_usage
doi: "10.1186/s13742-015-0047-8"
licence: ["GPL v3"]
identifier: ""

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- plink_genotype_file:
type: file
description: PLINK binary genotype table file or PLINK 2 binary genotype table file
pattern: "*.{bed,pgen}"
ontologies:
- edam: http://edamontology.org/format_3003
- plink_variant_file:
type: file
description: PLINK extended MAP file or PLINK 2 variant information file
pattern: "*.{bim,pvar}"
- plink_sample_file:
type: file
description: PLINK sample information file or PLINK 2 sample information file
pattern: "*.{fam,psam}"
- - hwe:
type: float
description: Threshold to use for maf filtering

output:
- bed:
- meta:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta is being inherited from the input should be the same

type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
e.g. [ id:'test', single_end:false ]
e.g. [ id:'test', single_end:false ]

you could remove the single_end when its not applicable :)

- "*.bed":
type: file
description: PLINK binary allelic genotype table
pattern: "*.bed"
ontologies:
- edam: http://edamontology.org/format_3003
- bim:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.bim":
type: file
description: PLINK extended map file
pattern: "*.bim"
ontologies: []
- fam:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.fam":
type: file
description: PLINK sample information file
pattern: "*.fam"
ontologies: []
- pgen:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.pgen":
type: file
description: PLINK 2 binary genotype table
pattern: "*.pgen"
ontologies:
- edam: http://edamontology.org/format_3003
- pvar:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.pvar":
type: file
description: PLINK 2 variant information file
pattern: "*.pvar"
ontologies: []
- psam:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.psam":
type: file
description: PLINK 2 sample information file
pattern: "*.psam"
ontologies: []
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies: []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two versions entrance

- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"
Comment thread
jodennehy marked this conversation as resolved.
Outdated

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

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

tag "modules"
tag "modules_nfcore"
tag "plink2"
tag "plink2/hwe"

test("plink2 - plink1_input - hwe") {

when {
process {

"""

input[0] = [
[id:"test"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
]
input[1] = 0.01
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("plink2 - plink2_input - hwe") {


when {
process {

"""

input[0] = [
[id:"test"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pgen', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pvar', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.psam', checkIfExists: true)
]
input[1] = 0.01
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("plink2 - plink1_input - hwe - stub") {

options "-stub"

when {
process {
"""

input[0] = [
[id:"test"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bed', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.bim', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.fam', checkIfExists: true)
]
input[1] = 0.01
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("plink2 - plink2_input - hwe - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[id:"test"],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pgen', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.pvar', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/plink_simulated.psam', checkIfExists: true)
]
input[1] = 0.01
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
Loading
Loading