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/bivariatereml/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
62 changes: 62 additions & 0 deletions modules/nf-core/gcta/bivariatereml/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
process GCTA_BIVARIATEREML {
tag "bivariate_reml_${meta.id}_${meta2.id}"
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(phenotype_file), val(mpheno), val(prevalence)
tuple val(meta2), path(grm_files)
tuple val(meta3), path(quant_covariates_file)
tuple val(meta4), path(cat_covariates_file)

output:
tuple val(meta), path("*.hsq"), emit: bivariate_results
tuple val(meta), path("*.log"), emit: log_file
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 prefix = task.ext.prefix ?: "${meta.id}"
def pair_id = prefix
def qcovar_param = quant_covariates_file ? "--qcovar ${quant_covariates_file}" : ''
def covar_param = cat_covariates_file ? "--covar ${cat_covariates_file}" : ''
def extra_args = task.ext.args ?: ''
def bivar_traits = mpheno ?: '1 2'
def prevalence_param = prevalence ? "--reml-bivar-prevalence ${prevalence}" : ''
def grm_file_list = grm_files instanceof List ? grm_files : [grm_files]
def grm_id = grm_file_list.find { grm_file -> grm_file.name.endsWith('.grm.id') }
if (!grm_id) {
throw new IllegalArgumentException("GCTA_BIVARIATEREML contract violation: grm_files must include a .grm.id file")
}
def expected_grm_basename = grm_id.name.replaceFirst(/\.grm\.id$/, '')
if (meta2.id != expected_grm_basename) {
throw new IllegalArgumentException("GCTA_BIVARIATEREML contract violation: meta2.id '${meta2.id}' must match GRM basename '${expected_grm_basename}'")
}

"""
set -euo pipefail

gcta \\
--reml-bivar ${bivar_traits} \\
--grm ${meta2.id} \\
--pheno "${phenotype_file}" \\
${prevalence_param} \\
${qcovar_param} \\
${covar_param} \\
--out "${pair_id}" \\
--thread-num ${task.cpus} ${extra_args}
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def pair_id = prefix
"""
touch "${pair_id}.hsq"
touch "${pair_id}.log"
"""
}
126 changes: 126 additions & 0 deletions modules/nf-core/gcta/bivariatereml/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "gcta_bivariatereml"
description: Run bivariate REML analysis with a single dense GRM
keywords:
- gcta
- genome-wide complex trait analysis
- reml
- restricted maximum likelihood
- bivariate
- grm
- genetic relationship matrix
- 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 shared bivariate phenotype metadata
`meta.id` must contain both trait names, for example `trait1__trait2`
- phenotype_file:
type: file
description: Shared bivariate phenotype file passed to `--pheno`
pattern: "*.{phe,pheno,txt,tsv}"
ontologies:
- edam: "http://edamontology.org/format_3475"
- mpheno:
type: string
description: |
Optional pair of phenotype column indices passed to `--reml-bivar`;
pass `[]` to use the module default of `1 2`
- prevalence:
type: string
description: |
Optional pair of disease prevalence values passed to `--reml-bivar-prevalence`
for binary traits; pass `[]` for quantitative traits
- - meta2:
type: map
description: |
Groovy map containing dense GRM metadata
Public contract: `meta2.id` must be the GRM basename passed to `--grm`
(for example `plink_simulated_dense` for `plink_simulated_dense.grm.{id,bin,N.bin}`)
- grm_files:
type: file
description: Dense GRM bundle containing sample identifier, binary matrix,
and sample-count matrix files
pattern: "*.grm.*"
ontologies: []
- - meta3:
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"
- - meta4:
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"
output:
bivariate_results:
- - meta:
type: map
description: |
Groovy map containing shared bivariate phenotype metadata
`meta.id` must contain both trait names, for example `trait1__trait2`
- "*.hsq":
type: file
description: Bivariate REML result file
pattern: "*.{hsq}"
ontologies:
- edam: "http://edamontology.org/format_2330"
log_file:
- - meta:
type: map
description: |
Groovy map containing shared bivariate phenotype metadata
`meta.id` must contain both trait names, for example `trait1__trait2`
- "*.log":
type: file
description: Bivariate REML log file
pattern: "*.{log}"
ontologies:
- edam: "http://edamontology.org/format_2330"
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