cellink.tl.external.get_magma_gene_loc#
- cellink.tl.external.get_magma_gene_loc(genome_build='GRCh38', data_home=None, overwrite=False)#
Download and cache a MAGMA-compatible gene location file from Ensembl BioMart.
The file is in the headless four-column format expected by MAGMA’s
--gene-locargument:ENSG_ID CHR START END(tab-separated, no header, numeric chromosome names). It is cached to<data_home>/magma/gene_loc_<genome_build>.txtand only re-fetched whenoverwrite=True.- Parameters:
genome_build ({"GRCh38", "GRCh37"}, default "GRCh38") – Genome assembly to query from Ensembl BioMart.
data_home (str or Path, optional) – Directory for caching. Defaults to
~/cellink_data(or theCELLINK_DATAenvironment variable).overwrite (bool, default False) – Re-fetch from BioMart even if the cached file already exists.
- Return type:
- Returns:
str Absolute path to the cached gene location file.
Examples
>>> from cellink.tl.external import get_magma_gene_loc >>> gene_loc = get_magma_gene_loc() # GRCh38, cached >>> run_magma_annotate(snp_loc=..., gene_loc=gene_loc, out_prefix=...)
See also
generate_gene_coord_fileHeaded GENE/CHR/START/END format for S-LDSC.
run_magma_annotateMAGMA Step I — uses the gene location file.