cellink.tl.external.run_magma_gene_analysis#
- cellink.tl.external.run_magma_gene_analysis(bfile, pval_file, gene_annot, out_prefix, n_samples=None, ncol=None, magma_bin='magma', run=True, **kwargs)#
Run MAGMA Step II — gene-level association analysis.
Computes gene-level p-values and z-scores from GWAS SNP-level summary statistics, taking LD structure into account using a reference genotype panel. The output
{out_prefix}.genes.rawis the input to bothrun_magma_gsa()andrun_magma_gpa().- Parameters:
bfile (
str) – PLINK bfile prefix (without extension) for the LD reference panel, e.g."g1000_eur/g1000_eur".pval_file (
str) – GWAS p-value file. Must contain at leastSNPandPcolumns (tab or space delimited).gene_annot (
str) – Path to the.genes.annotfile fromrun_magma_annotate().out_prefix (
str) – Prefix for output files. Creates{out_prefix}.genes.rawand{out_prefix}.genes.out.n_samples (
int|None(default:None)) – Total GWAS sample size, used when every SNP shares the same N. Passed asN=<value>in the--pvalargument. Mutually exclusive withncol— MAGMA requires exactly one of the two.ncol (
str|None(default:None)) – Name of a column inpval_fileholding a per-SNP sample size (e.g. for a meta-analysis where N varies across SNPs). Passed asncol=<name>in the--pvalargument. A column merely being named"N"is not enough on its own — MAGMA always requires an explicitN=orncol=modifier.magma_bin (
str(default:'magma')) – Path to the MAGMA binary.run (
bool(default:True)) – IfFalse, return the command without executing.**kwargs – Additional flags passed verbatim to MAGMA as
--key value.
- Return type:
- Returns:
dict
gene_results— path to.genes.raw.files_created— list of output paths (ifrun=True).command— command list (ifrun=False).
Examples
>>> run_magma_gene_analysis( ... bfile="g1000_eur/g1000_eur", ... pval_file="scz_gwas.txt", ... gene_annot="results/my_gwas.genes.annot", ... out_prefix="results/scz", ... n_samples=67390, ... )
See also
run_magma_annotateStep I — SNP-to-gene annotation.
run_magma_gsaStep III — gene-set analysis.
run_magma_gpaStep III — gene property analysis.