R/celltype_associations_pipeline.r
celltype_associations_pipeline.Rd
Has the option of running multiple analyses with a single function. Assumes that you already have all MAGMA GWAS files precomputed. Precomputed MAGMA GWAS files can be downloaded via the import_magma_files function.
celltype_associations_pipeline(
ctd,
ctd_levels = seq_len(length(ctd)),
ctd_name,
ctd_species = infer_ctd_species(ctd),
standardise = TRUE,
magma_dirs,
run_linear = TRUE,
run_top10 = TRUE,
run_conditional = FALSE,
upstream_kb = 35,
downstream_kb = 10,
suffix_linear = "linear",
suffix_top10 = "top10",
suffix_condition = "condition",
controlledAnnotLevel = 1,
controlTopNcells = 1,
force_new = FALSE,
save_dir = tempdir(),
nThread = 1,
version = NULL,
verbose = TRUE
)
Cell type data structure containing
specificity_quantiles
.
Which levels of ctd
to
iterate the enrichment analysis over.
Used in file names
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.
Whether to run standardise_ctd first. Provides gene ortholog conversion.
Path to folders containing the pre-computed MAGMA GWAS files (.gsa.rawand .gsa.out). NOTE: Files within these folders must have the same naming scheme as the folders themselves.
Run in linear mode.
Run in top 10% mode.
Run in conditional mode.
How many kb upstream of the gene should SNPs be included?
How many kb downstream of the gene should SNPs be included?
This will be added to the linear results file name.
This will be added to the top 10% results file name.
This will be added to the conditional results file name.
Which annotation level should be controlled for.
How many of the most significant cell types at that annotation level should be controlled for?
[Optional] Force new MAGMA analyses even if the pre-existing results files are detected.
Folder to save results in (save_dir=NULL
to not save any results).
Number of threads to parallelise analyses across.
MAGMA version to use.
Print messages.
A list containing the results of each selected celltype associations analysis.
magma_dirs <- MAGMA.Celltyping::import_magma_files(ids = c("ieu-a-298"))
#> Using built-in example files: ieu-a-298.tsv.gz.35UP.10DOWN
#> Returning MAGMA directories.
ctd <- ewceData::ctd()
#> see ?ewceData and browseVignettes('ewceData') for documentation
#> loading from cache
res <- MAGMA.Celltyping::celltype_associations_pipeline(
ctd = ctd,
ctd_levels = 1,
ctd_name = "Zeisel2015",
ctd_species = "mouse",
magma_dirs = magma_dirs)
#> Preparing CellTypeDataset.
#> Converting to sparse matrix.
#> Converting to sparse matrix.
#> ieu-a-298.tsv.gz.35UP.10DOWN
#> ======= Calculating celltype associations: linear mode =======
#> Installed MAGMA version: v1.10
#> Skipping MAGMA installation.
#> The desired_version of MAGMA is currently installed: v1.10
#> Using: magma_v1.10
#> Running MAGMA: Linear mode
#> Mapping gene symbols in specificity_quantiles matrix to entrez IDs.
#> Reading enrichment results file into R.
#> ======= Calculating celltype associations: top10% mode =======
#> Installed MAGMA version: v1.10
#> Skipping MAGMA installation.
#> The desired_version of MAGMA is currently installed: v1.10
#> Using: magma_v1.10
#> Running MAGMA: Top 10% mode
#> Mapping gene symbols in specificity_deciles matrix to entrez IDs.
#> Constructing top10% gene marker sets for 8 cell-types.
#> Reading enrichment results file into R.
#> Merging linear and top10% results
#> Saving results ==> /tmp/RtmpUbtMhH/Zeisel2015/MAGMA_celltyping.Zeisel2015.rds