filterPixels {imcRtools} | R Documentation

## Filter pixels based on their assigned masses

### Description

Helper function for estimating the spillover matrix. After assigning each pixel to a spotted mass, this function will filter incorrectly assigned pixels and remove small pixel sets.

### Usage

    filterPixels(
      object,
      bc_id = "bc_id",
      spot_mass = "sample_mass",
      minevents = 40,
      correct_pixels = TRUE
    )

### Arguments

`object` | a `SingleCellExperiment` object containing pixel intensities per channel. Individual pixels are stored as columns and channels are stored as rows.
`bc_id` | character string indicating which `colData(object)` entry stores the estimated mass
`spot_mass` | character string indicating which `colData(object)` entry stores the true isotope mass of the spotted metal.
`minevents` | single numeric indicating the threshold under which pixel sets are excluded from spillover estimation.
`correct_pixels` | logical indicating if incorrectly assigned pixels should be excluded from spillover estimation.

### Value

returns a SingleCellExperiment object in which `colData(object)$bc_id` has been adjusted based on the filter criteria.

### Author(s)

Vito Zanotelli, adapted by Nils Eling (nils.eling@dqbm.uzh.ch)

### Examples

    path <- system.file("extdata/spillover", package = "imcRtools")
    sce <- readSCEfromTXT(path)
    assay(sce, "exprs") <- asinh(counts(sce)/5)

    # Pre-process via CATALYST
    library(CATALYST)

    bc_key <- as.numeric(unique(sce$sample_mass))
    sce <- assignPrelim(sce, bc_key = bc_key)
    sce <- estCutoffs(sce)
    sce <- applyCutoffs(sce)

    sce <- filterPixels(sce)

    table(sce$sample_mass, sce$bc_id)

[Package imcRtools version 1.0.2 Index]