This function saves all the variables required for applying the patchseq QC algorithm patchseqtools (which is an more flexible version of the patchSeqQC algorithm) to AIT.anndata$uns. This is only used for patch-seq analysis. Requirements for input include:

addPatchseqQCMetrics(
  AIT.anndata,
  mode.name = AIT.anndata$uns$mode,
  subclass.column = "subclass_label",
  class.column = "class_label",
  off.target.types = NULL,
  subclass.subsample = 100,
  num.markers = 50,
  taxonomyDir = file.path(AIT.anndata$uns$taxonomyDir),
  add.dendrogram.markers = TRUE,
  subsample = 100,
  save.normalized.data = TRUE,
  ...
)

Arguments

AIT.anndata

A reference taxonomy anndata object.

mode.name

A name to identify the taxonomy mode to add QC metrics for (default is the current mode). If the mode does not yet exist, buildPatchseqTaxonomy will call buildTaxonomyMode using the sampled data from the class.column, subclass.column, and off.target.types.

subclass.column

Column name corresponding to the moderate-resolution cell types used for the cell types of interest (default = "subclass_label").

class.column

Column name corresponding to the low-resolution cell types used for the off-target cell types (default = "class_label").

off.target.types

A character vector of off-target (also known as 'contamination') cell types. This must include at least one of the cell types found in "class.column" and/or "subclass.column" (both columns are checked)

subclass.subsample

The number of cells to retain for PatchseqQC contamination calculation (default = 100, probably no need to change).

num.markers

The maximum number of markers to calculate per node per direction (default = 50)

taxonomyDir

The location to save shiny output (default = current working directory).

add.dendrogram.markers

If TRUE (default=TRUE), will also add dendrogram markers to prep the taxonomy for tree mapping. Default is TRUE because the membership values calculated here as well as the associated tree mapping capabilities is required for a subset of QL metrics, including KL divergence calculations.

subsample

The number of cells to retain per cluster (default = 100). Note that subsampling happens AFTER retain.cells and retail.clusters filtering (only used if buildTaxonomyMode is run).

save.normalized.data

If TRUE (default), will save normalized data when writing out h5ad file. Otherwise, will remove normalized data to save space (in which case it will be recalculated automatically upon loadTaxonomy)

...

Additional variables to be passed to addDendrogramMarkers or buildTaxonomyMode

The following variables are added to AIT.anndata$uns: $dend[mode.name] $filter[mode.name] $QC_markers_[mode.name] ...$markers, ...$countsQC, ...$cpmQC, ...$classBr, ...$subclassF, ...$allMarkers $memb[mode.name] # Only if add.dendrogram.markers=TRUE ...$memb.ref, ...$map.df.ref

Value

AIT.anndata An updated AIT.anndata variable with the above content added to AIT.anndata$uns for the relevant mode.name.