Remove unwanted observations from the object.

  • removeObs(): Allows to specify the observations to remove manually.

  • removeObsZeroCounts(): Identifies and removes observations with no molecule counts from the SPATA2 object.

removeObs(object, barcodes, spatial_proc = TRUE, verbose = NULL)

removeObsZeroCounts(
  object,
  spatial_proc = TRUE,
  assay_name = activeAssay(object),
  verbose = NULL
)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

barcodes

Character vector or barcodes that are removed.

spatial_proc

Logical value. Indicates whether the new sub-object is processed spatially. If TRUE, a new tissue outline is identified based on the remaining observations via identifyTissueOutline(). Then, spatial annotations are tested on being located on either of the remaining tissue sections. If they are not, they are removed.

If FALSE, these processing steps are skipped. Generally speaking, this is not recommended. Only set to FALSE, if you know what you're doing.

Only relevant, if barcodes is not NULL.

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

assay_name

Only relevant if the SPATA2 object contains more than one assay: Denotes the assay of interest and thus the molecular modality to use. Defaults to the active assay as set by activateAssay().

Value

The updated input object, containing the added, removed or computed results.

Details

After removal of observations, unused levels of factor variables in the feature data.frame are dropped. Analysis results are not affected.

Examples

library(SPATA2)

data("example_data")
object <- example_data$object_UKF269T_diet

# the function tells you if / how many observations were removed
object <- removeObsZeroCounts(object, verbose = TRUE)