cellink.tl.external.run_magma_annotate#
- cellink.tl.external.run_magma_annotate(snp_loc, gene_loc, out_prefix, magma_bin='magma', window_kb=0, run=True, **kwargs)#
Run MAGMA Step I — annotate SNPs to genes.
Maps each SNP to the gene(s) whose transcribed region (±
window_kbkb) overlaps its position. Creates a.genes.annotfile consumed byrun_magma_gene_analysis().- Parameters:
snp_loc (
str) – Tab-delimited SNP location file with columnsSNP,CHR,BP. Can be derived from a GWAS summary statistics file.gene_loc (
str) – NCBI/Ensembl gene location file. MAGMA shipsNCBI37.3.gene.locandNCBI38.gene.locfor GRCh37/38. Format:ENTREZID CHR START END STRAND SYMBOL(tab-delimited, no header).out_prefix (
str) – Prefix for output files. Creates{out_prefix}.genes.annot.magma_bin (
str(default:'magma')) – Path to the MAGMA binary (default:"magma"assumes it is on PATH).window_kb (
int(default:0)) – Flanking window in kb added around each gene’s transcribed region (default 0 = gene body only). Use e.g. 35 for ±35 kb.run (
bool(default:True)) – IfFalse, return the command string without executing.**kwargs – Additional flags passed verbatim to MAGMA as
--key value.
- Return type:
- Returns:
dict
annot_file— path to.genes.annot.files_created— list of output paths (ifrun=True).command— command list (ifrun=False).
Examples
>>> run_magma_annotate( ... snp_loc="gwas_snps.txt", ... gene_loc="NCBI37.3.gene.loc", ... out_prefix="results/my_gwas", ... window_kb=35, ... )
See also
run_magma_gene_analysisStep II — compute gene-level p-values.