run.CSIDE.single: Runs CSIDE on a 'RCTD' object with a single explanatory...

View source: R/CSIDE.R

run.CSIDE.singleR Documentation

Runs CSIDE on a RCTD object with a single explanatory variable

Description

Identifies cell type specific differential expression (DE) as a function of the explanatory variable. The design matrix contains an intercept column and a column of the explanatory variable. Uses maximum likelihood estimation to estimate DE and standard errors for each gene and each cell type. Selects genes with significant nonzero DE.

Usage

run.CSIDE.single(
  myRCTD,
  explanatory.variable,
  cell_types = NULL,
  cell_type_threshold = 125,
  gene_threshold = 5e-05,
  doublet_mode = T,
  weight_threshold = NULL,
  sigma_gene = T,
  PRECISION.THRESHOLD = 0.05,
  cell_types_present = NULL,
  fdr = 0.01,
  test_genes_sig = T,
  normalize_expr = F,
  logs = F,
  log_fc_thresh = 0.4,
  test_error = F,
  fdr_method = "BH",
  medv = 0.5
)

Arguments

myRCTD

an RCTD object with annotated cell types e.g. from the run.RCTD function.

explanatory.variable

a named numeric vector representing the explanatory variable used for explaining differential expression in CSIDE. Names of the variable are the SpatialRNA pixel names, and values should be standardized between 0 and 1.

cell_types

the cell types used for CSIDE. If null, cell types will be chosen with aggregate occurrences of at least 'cell_type_threshold', as aggregated by aggregate_cell_types

cell_type_threshold

(default 125) min occurrence of number of cells for each cell type to be used, as aggregated by aggregate_cell_types

gene_threshold

(default 5e-5) minimum average normalized expression required for selecting genes

doublet_mode

(default TRUE) if TRUE, uses RCTD doublet mode weights. Otherwise, uses RCTD full mode weights

weight_threshold

(default NULL) the threshold of total normalized weights across all cell types in cell_types per pixel to be included in the model. Default 0.99 for doublet_mode or 0.8 for full_mode.

sigma_gene

(default TRUE) if TRUE, fits gene specific overdispersion parameter. If FALSE, overdispersion parameter is same across all genes.

PRECISION.THRESHOLD

(default 0.05) for checking for convergence, the maximum parameter change per algorithm step

cell_types_present

cell types (a superset of 'cell_types') to be considered as occurring often enough to consider for gene expression contamination during the step filtering out marker genes of other cell types.

fdr

(default 0.01) false discovery rate for hypothesis testing

test_genes_sig

(default TRUE) logical controlling whether genes will be tested for significance

normalize_expr

(default FALSE) if TRUE, constrains total gene expression to sum to 1 in each condition.

logs

(default FALSE) if TRUE, writes progress to logs/de_logs.txt

log_fc_thresh

(default 0.4) the natural log fold change cutoff for differential expression

test_error

(default FALSE) if TRUE, exits after testing for error messages without running CSIDE. If set to TRUE, this can be used to quickly evaluate if CSIDE will run without error.

fdr_method

(default BH) if BH, uses the Benjamini-Hochberg method. Otherwise, uses local fdr with an empirical null.

medv

(default 0.5) the cutoff value of explanatory.variable (after 0-1 normalization) for determining if enough pixels for each cell type have explanatory-variable greater than or less than this value (minimum cell_type_threshold/2 required).

Value

an RCTD object containing the results of the CSIDE algorithm. Contains objects de_results, which contain the results of the CSIDE algorithm including 'gene_fits', which contains the results of fits on individual genes, in addition 'sig_gene_list', a list, for each cell type, of significant genes detected by CSIDE. Additionally, the object contains 'internal_vars_de' a list of variables that are used internally by CSIDE


dmcable/RCTD documentation built on Feb. 24, 2024, 11:03 p.m.