filter_outliers: Filter per-segment outliers by quantiles.

View source: R/filter_mapped.R

filter_outliersR Documentation

Filter per-segment outliers by quantiles.

Description

After mapping counts data to segments, this function can be used to determine quantiles of mapped data, and identify outliers in each segment and modality.

An outlier is an entry for a cell/segment pair; with this function we compute how often a certain cell is marked as an outlier. Then the function removes cells that are flagged as containing outliers more then a certain input cutoff. This helps picking up which cells are often showing counts that seem deviating from the main signal in the data. In case of multiome data, cells flagged as outliers in one modality are also removed from the other modality.

The function requires and returns an (R)CONGAS+ object.

Usage

filter_outliers(
  x,
  frequency_cutoff = 0.2 * stat(x)$nsegments,
  lower_quantile = 0.03,
  upper_quantile = 0.97
)

Arguments

x

An rcongasplus object.

frequency_cutoff

The cutoff to determine if a cell should be removed or not from the data because it has too many outliers. By default, this cut is 20% of the input number of segments.

lower_quantile

The lower quantile, default 3%.

upper_quantile

The upper quantile, default 97%.

Value

The object x where outlier cells have been identified and removed.

Examples

data('example_object')

# Default
print(example_object)

example_object %>% 
  filter_outliers() %>% 
  print()

example_object %>% 
  filter_outliers(, action = 'remove') %>% 
  print()

Militeee/rcongas documentation built on Nov. 1, 2024, 2:38 a.m.