Skip to contents

Normalize data with custom scale factors

Usage

custom_scale_region(
  region,
  to = "NormalizedData",
  from = "Data",
  MARGIN = 1,
  ...
)

Arguments

region

A Region object, or concatenated data generated by .smapply.

to

Which data slot to assign the normalized data to.

from

Which data slot to pull data from.

MARGIN

Whether to apply the function within each biomarker (1) or across all biomarkers in each cell (2).

...

Arguments passed on to custom_scale

sweep.function

The function passed to sweep that will be used to sweep out the scale factors. Defaults to '/'.

scale.factors

A vector of scale factors. Expects the same length as the axis chosen in MARGIN or a single value. Passed to the sweep argument STATS

allow.negatives

If FALSE, scaling that introduces negative values will have those values corrected to zero.

Value

An updated Region object with normalized data added to the slot specified in to. Metadata recording information about the normalization is added to the featureInfo if MARGIN = 1, and to the cellMetadata if MARGIN = 2.

See also

Scroll to top