R/calculate_celltype_associations.r
calculate_celltype_associations.Rd
Assumes that you have already run map_snps_to_genes.
calculate_celltype_associations(
ctd,
ctd_levels = seq_len(length(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,
genesOutCOND = NA,
EnrichmentMode = "Linear",
force_new = FALSE,
version = NULL,
verbose = TRUE
)
Cell type data structure containing
specificity_quantiles
.
Which levels of ctd
to
iterate the enrichment analysis over.
Species name relevant to the CellTypeDataset (ctd
).
See list_species for all available species.
If ctd_species=NULL
(default),
the ctd
species will automatically
be inferred using infer_species.
File path of the summary statistics file.
Path to folder containing the pre-computed MAGMA GWAS files (.gsa.rawand .gsa.out).
Used in file names which area created.
Whether to run
prepare_quantile_groups on the ctd
first.
How many kb upstream of the gene should SNPs be included?
How many kb downstream of the gene should SNPs be included?
[Optional] Path to a genes.out file to condition on. Used if you want to condition on a different GWAS.
[Optional] Should either 'Linear' or 'Top 10%' mode be used for testing enrichment?
[Optional] Force new MAGMA analyses even if the pre-existing results files are detected.
MAGMA version to use.
Print messages.
File path for the genes.out file
#### Prepare cell-type data ####
ctd <- ewceData::ctd()
#> see ?ewceData and browseVignettes('ewceData') for documentation
#> loading from cache
#### Prepare GWAS MAGMA data ####
magma_dir <- MAGMA.Celltyping::import_magma_files(ids = "ieu-a-298")
#> Using built-in example files: ieu-a-298.tsv.gz.35UP.10DOWN
#> Returning MAGMA directories.
#### Run pipeline ####
ctAssocs <- calculate_celltype_associations(
ctd = ctd,
ctd_levels = 1,
magma_dir = magma_dir,
ctd_species = "mouse")
#> Installed MAGMA version: v1.10
#> Skipping MAGMA installation.
#> The desired_version of MAGMA is currently installed: v1.10
#> Using: magma_v1.10
#> Standardising CellTypeDataset
#> Found 5 matrix types across 2 CTD levels.
#> Processing level: 1
#> Processing level: 2
#> Converting to sparse matrix.
#> Converting to sparse matrix.
#> Running MAGMA: Linear mode
#> Mapping gene symbols in specificity_quantiles matrix to entrez IDs.
#> Reading enrichment results file into R.