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
7 changes: 7 additions & 0 deletions modules/nf-core/gcta/fastgwa/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::gcta=1.94.1
60 changes: 60 additions & 0 deletions modules/nf-core/gcta/fastgwa/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
process GCTA_FASTGWA {
tag "${meta.id}:${mpheno}"
label 'process_medium'
conda "${moduleDir}/environment.yml"
container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/46/46b0d05f0daa47561d87d2a9cac5e51edc2c78e26f1bbab439c688386241a274/data'
: 'community.wave.seqera.io/library/gcta:1.94.1--9bc35dc424fcf6e9'}"

input:
tuple val(meta), path(bed_pgen), path(bim_pvar), path(fam_psam)
tuple val(meta2), path(sparse_grm_files)
tuple val(meta3), path(phenotype_file), val(mpheno), val(is_binary)
tuple val(meta4), path(quant_covariates_file)
tuple val(meta5), path(cat_covariates_file)
val mlm_exact

output:
tuple val(meta), path("*.fastGWA"), val(mpheno), val(is_binary), emit: results
tuple val(meta), path("*.log"), val(mpheno), val(is_binary), emit: log
tuple val("${task.process}"), val("gcta"), eval("gcta --version | sed -En 's/^[*] version v([0-9.]*).*/\\1/p'"), emit: versions_gcta, topic: versions

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

script:
def genotype_suffix = bed_pgen.name.tokenize('.').last()
def genotype_flag = genotype_suffix == 'pgen' ? '--pfile' : '--bfile'
def genotype_prefix = bed_pgen.baseName
def grm_arg = sparse_grm_files ? "--grm-sparse ${meta2.id}" : ''
def mode_arg = is_binary ? '--fastGWA-lr' : (mlm_exact ? '--fastGWA-mlm-exact' : '--fastGWA-mlm')
def qcovar_arg = quant_covariates_file ? "--qcovar ${quant_covariates_file}" : ''
def covar_arg = cat_covariates_file ? "--covar ${cat_covariates_file}" : ''
def mpheno_arg = mpheno ? "--mpheno ${mpheno}" : ''
def prefix = task.ext.prefix ?: "${meta.id}"
def out = mpheno ? "${prefix}_${mpheno}" : "${prefix}"
def extra_args = task.ext.args ?: ''

"""
set -euo pipefail

gcta \\
${genotype_flag} ${genotype_prefix} \\
${grm_arg} \\
${mode_arg} \\
--pheno ${phenotype_file} \\
${qcovar_arg} \\
${covar_arg} \\
${mpheno_arg} \\
--thread-num ${task.cpus} \\
--out ${out} ${extra_args}
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def out = mpheno ? "${prefix}_${mpheno}" : "${prefix}"
"""
touch ${out}.fastGWA
touch ${out}.log
"""
}
161 changes: 161 additions & 0 deletions modules/nf-core/gcta/fastgwa/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "gcta_fastgwa"
description: Run GCTA fastGWA association modes (`--fastGWA-mlm`, `--fastGWA-mlm-exact`, and `--fastGWA-lr`) with PLINK genotype inputs
keywords:
- gcta
- genome-wide complex trait analysis
- fastgwa
- fast genome-wide association
- gwas
- genome-wide association study
- genetics
tools:
- "gcta":
description: "Genome-wide Complex Trait Analysis (GCTA) estimates genetic relationships, variance components, and association statistics from genome-wide data."
homepage: "https://yanglab.westlake.edu.cn/software/gcta/"
documentation: "https://yanglab.westlake.edu.cn/software/gcta/static/gcta_doc_latest.pdf"
tool_dev_url: "https://yanglab.westlake.edu.cn/software/gcta/"
licence: ["GPL-3.0-only"]
identifier: "biotools:gcta"
input:
- - meta:
type: map
description: |
Groovy map containing PLINK genotype metadata
e.g. `[ id:'plink_simulated' ]`
- bed_pgen:
type: file
description: PLINK primary genotype file, either `.bed` or `.pgen`
pattern: "*.{bed,pgen}"
ontologies:
- edam: "http://edamontology.org/format_3003"
- bim_pvar:
type: file
description: PLINK sidecar file, either `.bim` or `.pvar`
pattern: "*.{bim,pvar}"
ontologies: []
- fam_psam:
type: file
description: PLINK sidecar file, either `.fam` or `.psam`
pattern: "*.{fam,psam}"
ontologies: []
- - meta2:
type: map
description: |
Groovy map containing sparse GRM metadata
e.g. `[ id:'plink_simulated_sp' ]`
Used when sparse GRM files are supplied
- sparse_grm_files:
type: file
description: Sparse GRM sidecar files, pass `[]` when absent
pattern: "*.grm.{id,sp}"
ontologies: []
- - meta3:
type: map
description: |
Groovy map containing phenotype metadata
Keep only stable phenotype metadata in this map
e.g. `[ id:'plink_simulated' ]`
- phenotype_file:
type: file
description: Phenotype file
pattern: "*.{phe,pheno,txt,tsv}"
ontologies:
- edam: "http://edamontology.org/format_3475"
- mpheno:
type: integer
description: |
Phenotype column selector passed to `--mpheno`.
Pass `[]` when absent.
- is_binary:
type: boolean
description: Whether to run logistic fastGWA mode for a binary trait
- - meta4:
type: map
description: |
Groovy map containing quantitative covariate metadata
e.g. `[ id:'covariates_quant' ]`
- quant_covariates_file:
type: file
description: Quantitative covariates file, pass `[]` when absent
pattern: "*.{covar,cov,txt,tsv}"
ontologies:
- edam: "http://edamontology.org/format_3475"
- - meta5:
type: map
description: |
Groovy map containing categorical covariate metadata
e.g. `[ id:'covariates_cat' ]`
- cat_covariates_file:
type: file
description: Categorical covariates file, pass `[]` when absent
pattern: "*.{covar,cov,txt,tsv}"
ontologies:
- edam: "http://edamontology.org/format_3475"
- mlm_exact:
type: boolean
description: |
Apply `--fastGWA-mlm-exact` for non-binary phenotypes.
Ignored when `is_binary` is true because binary phenotypes use `--fastGWA-lr`.
output:
results:
- - meta:
type: map
description: |
Groovy map containing PLINK genotype metadata
e.g. `[ id:'plink_simulated' ]`
- "*.fastGWA":
type: file
description: FastGWA association results
pattern: "*.fastGWA"
ontologies:
- edam: "http://edamontology.org/format_2330"
- mpheno:
type: integer
description: Phenotype column selector used for the emitted result
- is_binary:
type: boolean
description: Whether `--fastGWA-lr` was used for the emitted result
log:
- - meta:
type: map
description: |
Groovy map containing PLINK genotype metadata
e.g. `[ id:'plink_simulated' ]`
- "*.log":
type: file
description: GCTA fastGWA log file
pattern: "*.log"
ontologies:
- edam: "http://edamontology.org/format_2330"
- mpheno:
type: integer
description: Phenotype column selector used for the emitted log
- is_binary:
type: boolean
description: Whether `--fastGWA-lr` was used for the emitted log
versions_gcta:
- - "${task.process}":
type: string
description: The process the version was collected from
- "gcta":
type: string
description: The tool name
- "gcta --version | sed -En 's/^[*] version v([0-9.]*).*/\\1/p'":
type: eval
description: The command used to retrieve the GCTA version
topics:
versions:
- - ${task.process}:
type: string
description: The process the version was collected from
- gcta:
type: string
description: The tool name
- "gcta --version | sed -En 's/^[*] version v([0-9.]*).*/\\1/p'":
type: eval
description: The command used to retrieve the GCTA version
authors:
- "@lyh970817"
maintainers:
- "@lyh970817"
Loading
Loading