View source: R/calculate_conditional_geneset_enrichment.R
calculate_conditional_geneset_enrichment | R Documentation |
Run gene set enrichment analysis with a given geneset
on a GWAS previously mapped to genes
(using map_snps_to_genes),
while conditioning on a given cell-type or list of cell-types
(controlledCTs
), as defined by the "specificity_quantiles" matrix
in a given level (controlledAnnotLevel
) of the provide
CellTypeDataset (ctd
). This allows one to conduct gene set enrichment
analyses while controlling for strong cell-type-specific signatures.
calculate_conditional_geneset_enrichment(
geneset,
ctd,
ctd_species = infer_ctd_species(ctd),
controlledAnnotLevel = 1,
controlledCTs,
prepare_ctd = TRUE,
gwas_sumstats_path = NULL,
magma_dir = NULL,
analysis_name = "MainRun",
upstream_kb = 35,
downstream_kb = 10,
geneset_species = infer_geneset_species(geneset),
version = NULL,
verbose = TRUE
)
geneset |
Genes which are to be tested. Can be gene symbols (or other gene IDs) from any species listed in list_species. |
ctd |
Cell type data structure containing
|
ctd_species |
Species name relevant to the CellTypeDataset ( |
controlledAnnotLevel |
Annotation level of the celltypes being controlled for. |
controlledCTs |
Array of the celltype to be controlled for, e.g. c("Interneuron type 16","Medium Spiny Neuron). |
prepare_ctd |
Whether to run
prepare_quantile_groups on the |
gwas_sumstats_path |
File path of the summary statistics file. |
magma_dir |
Path to folder containing the pre-computed MAGMA GWAS files (.gsa.rawand .gsa.out). |
analysis_name |
Used in file names which area created. |
upstream_kb |
How many kb upstream of the gene should SNPs be included? |
downstream_kb |
How many kb downstream of the gene should SNPs be included? |
geneset_species |
Species that the |
version |
MAGMA version to use. |
verbose |
Print messages. |
data.table of baseline (column name prefix "BASELINE_") and conditioned (column name prefix "COND_") gene set enrichment results.
#### Import data ####
ctd <- MAGMA.Celltyping::get_ctd("ctd_allKI")
magma_dir <- MAGMA.Celltyping::import_magma_files(ids = "ieu-a-298")
geneset <- MAGMA.Celltyping::rbfox_binding
res <- MAGMA.Celltyping::calculate_conditional_geneset_enrichment(
geneset = geneset,
ctd = ctd,
controlledAnnotLevel = 1,
controlledCTs = "pyramidal SS",
magma_dir = magma_dir,
analysis_name = "Rbfox_16_pyrSS",
geneset_species = "mouse",
ctd_species = "mouse")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.