View source: R/calculate_conditional_celltype_associations.R
calculate_conditional_celltype_associations | R Documentation |
Run cell-type enrichment analysis on a GWAS previously mapped to genes (using map_snps_to_genes) while controlling for certain cell-types. This allows one to conduct cell-type enrichment analyses while controlling for the strongest cell-type-specific signatures. Which cell-types are controlled for can be specified by either of the following arguments:
controlTopNcells
Automatically
selects the top N mostly significantly enriched cell-types.
controlledCTs
A user-provided list of cell-types
present in the ctd
.
Three sets of analyses are run:
Baseline enrichment resultsNo conditioning.
Conditional results: separate conditioning on each specified cell-type separately
Conditional results: grouped conditioning all specified cell-types at once.
calculate_conditional_celltype_associations(
ctd,
ctd_species = infer_ctd_species(ctd),
gwas_sumstats_path = NULL,
magma_dir = NULL,
analysis_name = "MainRun",
prepare_ctd = TRUE,
upstream_kb = 35,
downstream_kb = 10,
controlledAnnotLevel = 1,
controlTopNcells = NA,
controlledCTs = NA,
EnrichmentMode = "Linear",
qvalue_thresh = 0.05,
force_new = FALSE,
version = NULL,
verbose = TRUE
)
ctd |
Cell type data structure containing
|
ctd_species |
Species name relevant to the CellTypeDataset ( |
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. |
prepare_ctd |
Whether to run
prepare_quantile_groups on the |
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? |
controlledAnnotLevel |
Which annotation level should be controlled for. |
controlTopNcells |
How many of the most significant cell types at that annotation level should be controlled for? |
controlledCTs |
Array of the celltype to be controlled for,
e.g. |
EnrichmentMode |
[Optional] Should either 'Linear' or 'Top 10%' mode be used for testing enrichment? |
qvalue_thresh |
Multiple-testing corrected p-value threshold to filter by when determining which celltypes to condition with. |
force_new |
[Optional] Force new MAGMA analyses even if the pre-existing results files are detected. |
version |
MAGMA version to use. |
verbose |
Print messages. |
A concatenated results table containing:
Baseline enrichment results.
Conditional results: conditioning on each specified cell-type individually.
Conditional results: conditioning all specified cell-types at once.
#### Prepare cell-type data ####
ctd <- ewceData::ctd()
#### Prepare GWAS MAGMA data ####
magma_dir <- MAGMA.Celltyping::import_magma_files(ids = "ieu-a-298")
#### Run pipeline ####
ctAssocs <- calculate_conditional_celltype_associations(
ctd = ctd,
controlledAnnotLevel = 1,
controlTopNcells = 1,
qvalue_thresh = 1,
magma_dir = magma_dir,
ctd_species = "mouse",
force = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.