-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Plink2 hwe #8227
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
Plink2 hwe #8227
Changes from 11 commits
eb60cd7
7eeb1a9
5bc448d
654fbee
0e5795e
d35a85b
2110ac6
c113e4c
b926581
85cf2e6
87a0a49
514fec6
8394501
7b9b322
d80ac92
7b0a0d5
82080df
173b65b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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 | ||
|
|
||
| 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!" | ||
|
|
||
|
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 | ||
| """ | ||
|
|
||
| } | ||
| 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: | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ] | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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: [] | ||||||
|
|
||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||||||
|
jodennehy marked this conversation as resolved.
Outdated
|
||||||
|
|
||||||
| authors: | ||||||
| - "@jodennehy" | ||||||
| maintainers: | ||||||
| - "@jodennehy" | ||||||
| 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() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
Uh oh!
There was an error while loading. Please reload this page.