
Filter CODEX cell data
FilterCodex.Rd
Function to filter Regions in a SpatialMap based on parameters defined in the
settings()
. Values for each cell must have already been computed by QCMetrics()
.
Usage
FilterCodex(
object,
recompute = T,
remove.filtered.cells = NULL,
analyze = NULL,
spatial.qc = FALSE,
qc.var = ".qc_result",
qc.var.logical = ".pass_qc",
custom.qc.vars = NULL,
custom.qc.mappings = NULL,
custom.qc.labels = NULL
)
Arguments
- object
A SpatialMap object
- recompute
Whether to recompute filtering results (for example, if settings have been changed)
- remove.filtered.cells
Whether to remove filtered cells from the returned object.
- analyze
What to analyze (and how). The options are "regions", NULL (activeAnalysis), the name of a currently existing formal analysis, or the name of a column in
object
'sprojectMetadata
(an "informal" analysis).- spatial.qc
Whether to use spatial QC parameters when filtering
- qc.var
The name of the QC results column in cellMetadata that will detail the QC results for each cell. Should represent a categorical variable, with values including "pass" and comma-separated reasons for why a cell failed QC (e.g., "DNA, signal sum").
- qc.var.logical
The name of the QC results column in cellMetadata that will specify whether a cell passes QC. Should represent a logical variable.
- custom.qc.vars
Column names of existing annotations in cellMetadata, to be used for custom QC filtering
- custom.qc.mappings
Named list of lists, where names correspond to each
custom.qc.vars
and values to a named list of labels that should map to pass and fail. Example format:list(custom_qc1 = list(pass = c("..."), fail = c("...")), custom_qc2 = list(pass = c("..."), fail = c("...")))
- custom.qc.labels
Named character vector where names correspond to each
custom.qc.vars
and values to the desired label used for the corresponding failing cells
Value
A SpatialMap
object with some new columns added to the cellMetadata
slot, named based on the values
passed to the arguments qc.var
and qc.var.logical
. See the descriptions for those parameters for more info.
Details
See vignette("AnalysisGuide2_QC_with_SpatialMap")
for a representative workflow that uses this function.