calculate_celltype_enrichment_limma: Calculate celltype enrichment

View source: R/calculate_celltype_enrichment_limma.r

calculate_celltype_enrichment_limmaR Documentation

Calculate celltype enrichment

Description

Calculate celltype enrichments without MAGMA using adjusted MAGMA Z-statistic from .genes.out files.

Usage

calculate_celltype_enrichment_limma(
  magmaAdjZ,
  ctd,
  ctd_species = infer_ctd_species(ctd = ctd),
  annotLevel = 1,
  prepare_ctd = TRUE,
  thresh = 1e-04,
  celltypes = NULL,
  return_all = FALSE,
  verbose = TRUE,
  ...
)

Arguments

magmaAdjZ

Output from adjust_zstat_in_genesOut.

ctd

Cell type data structure containing specificity_quantiles.

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.

annotLevel

Level within the ctd to use.

prepare_ctd

Whether to run prepare_quantile_groups on the ctd first.

thresh

A threshold on low specificity values (used to drop genes).

celltypes

Cell types to conduct tests for. Defaults to all cell types available in selected ctd level.

return_all

Return a list of both the processed data input and the enrichment results (Default). If FALSE, will only return enrichment results.

verbose

Print messages.

...

Additional arguments passed to standardise_ctd.

Examples

ctd <- ewceData::ctd()

# The package stores an example genesOut file, so save this to a tempfile
myGenesOut <- MAGMA.Celltyping::import_magma_files(
    ids = c("ieu-a-298"),
    file_types = ".genes.out",
    return_dir = FALSE)
    
#### Get adjust gene z-scores ####    
magmaAdjZ <- MAGMA.Celltyping::adjust_zstat_in_genesOut(
    ctd = ctd,
    magma_GenesOut_file = myGenesOut)
    
#### Get cell type enrichment ####
ps <- MAGMA.Celltyping::calculate_celltype_enrichment_limma(
    magmaAdjZ = magmaAdjZ,
    ctd = ctd)

NathanSkene/MAGMA_Celltyping documentation built on Aug. 21, 2023, 8:55 a.m.