celltype_associations_pipeline: Calculate cell type associations using MAGMA

View source: R/celltype_associations_pipeline.r

celltype_associations_pipelineR Documentation

Calculate cell type associations using MAGMA

Description

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.

Usage

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
)

Arguments

ctd

Cell type data structure containing specificity_quantiles.

ctd_levels

Which levels of ctd to iterate the enrichment analysis over.

ctd_name

Used in file names

ctd_species

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.

standardise

Whether to run standardise_ctd first. Provides gene ortholog conversion.

magma_dirs

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_linear

Run in linear mode.

run_top10

Run in top 10% mode.

run_conditional

Run in conditional mode.

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?

suffix_linear

This will be added to the linear results file name.

suffix_top10

This will be added to the top 10% results file name.

suffix_condition

This will be added to the conditional results file name.

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?

force_new

[Optional] Force new MAGMA analyses even if the pre-existing results files are detected.

save_dir

Folder to save results in (save_dir=NULL to not save any results).

nThread

Number of threads to parallelise analyses across.

version

MAGMA version to use.

verbose

Print messages.

Value

A list containing the results of each selected celltype associations analysis.

Examples

magma_dirs <- MAGMA.Celltyping::import_magma_files(ids = c("ieu-a-298"))
ctd <- ewceData::ctd()

res <- MAGMA.Celltyping::celltype_associations_pipeline(
    ctd = ctd,
    ctd_levels = 1,
    ctd_name = "Zeisel2015",
    ctd_species = "mouse",
    magma_dirs = magma_dirs)

NathanSkene/MAGMA_Celltyping documentation built on Oct. 11, 2024, 7:19 a.m.