Skip to contents

Add marker genes to reference dendrogram for tree mapping

Usage

addDendrogramMarkers(
  AIT.anndata,
  mode.name = NULL,
  mode = AIT.anndata$uns$mode,
  celltypeColumn = NULL,
  subsample = 100,
  num.markers = 20,
  de.param = scrattch.hicat::de_param(low.th = 0.1, padj.th = 1, lfc.th = 0.01, q1.th =
    0.1, q2.th = NULL, q.diff.th = 0.1, de.score.th = 1, min.cells = 1, min.genes = 1),
  calculate.de.genes = TRUE,
  save.shiny.output = TRUE,
  mc.cores = 1,
  bs.num = 100,
  p = 0.8,
  low.th = 0.1,
  overwriteMarkers = TRUE,
  taxonomyDir = file.path(AIT.anndata$uns$taxonomyDir),
  ...
)

Arguments

AIT.anndata

A reference taxonomy anndata object.

mode.name

Taxonomy mode to determine which version of filtering to use.

celltypeColumn

Column name correspond to the cell type names in the dendrogram. At least two cells per cell type in the dendrogram must be included. Default is to take the highest resolution level of the hierarchy

subsample

The number of cells to retain per cluster (default = 100)

num.markers

The maximum number of markers to calculate per pairwise differential calculation per direction (default = 20)

de.param

Differential expression (DE) parameters for genes and clusters used to define marker genes. By default the values are set to the 10x nuclei defaults from scrattch.hicat, except with min.cells=2 (see notes below).

calculate.de.genes

Default=TRUE. If set to false, the function will search for "de_genes" in a file called "de_genes_mode.RData" in the folder taxonomyDir, and will use those if available.

save.shiny.output

Should standard output files be generated and saved to the AIT file (default=TRUE). These are not required for tree mapping, but are required for building a patch-seq shiny instance. See notes.

mc.cores

Number of cores to use for running this function to speed things up. Default = 1. Values>1 are only supported in an UNIX environment and require foreach and doParallel R libraries.

bs.num

Number of bootstrap runs for creating the dendrogram (default of 100)

p

proportion of marker genes to include in each iteration of the mapping algorithm.

low.th

the minimum difference in Pearson correlation required to decide on which branch

overwriteMarkers

If markers already are calculated a tree, should they be overwritten (default = TRUE)

taxonomyDir

The location to create the directory with taxonomy information. Both the taxonomy and the de.genes_mode.name.RData get saved here.

By default VERY loose parameters are set for de_param in an effort to get extra marker genes for each node. The defaults previously proposed for 10x nuclei are the following de_param(low.th = 1, padj.th = 0.01, lfc.th = 1, q1.th = 0.3, q2.th = NULL, q.diff.th = 0.7, de.score.th = 100, min.cells = 2, min.genes = 5). See the function de_param in the scrattch.hicat for more details.

If save.shiny.output=TRUE, the following two values will get saved to the uns: memb.ref - matrix indicating how much confusion there is the mapping between each cell all of the nodes in the tree (including all cell types) when comparing clustering and mapping results with various subsamplings of the data map.df.ref - Result of tree mapping for each cell in the reference against the clustering tree, including various statistics and marker gene evidence. This is the same output that comes from tree mapping.

Value

An updated dendrogram variable that is the same as dend except with marker genes added to each node.