tof_postprocess: Post-process transformed CyTOF data.

View source: R/preprocessing.R

tof_postprocessR Documentation

Post-process transformed CyTOF data.

Description

This function transforms a 'tof_tibble' of transformed ion counts from a mass cytometer back into something that looks more like an .fcs file that Fluidigm software generates.

Usage

tof_postprocess(
  tof_tibble = NULL,
  channel_cols = where(tof_is_numeric),
  redo_noise = FALSE,
  transform_fun = function(x) rev_asinh(x, shift_factor = 0, scale_factor = 0.2)
)

Arguments

tof_tibble

A 'tof_tibble' or a 'tibble'.

channel_cols

A vector of non-quoted column names indicating which columns in 'tof_tibble' contain protein measurements. Supports tidyselect helpers. If nothing is specified, the default is to transform all numeric columns.

redo_noise

A boolean value indicating whether to add uniform noise that to each CyTOF measurement for aesthetic and visualization purposes. See this paper. Defaults to FALSE

transform_fun

A vectorized function to apply to each column specified by 'channel_cols' for post-processing. Defaults to rev_asinh transformation (with a cofactor of 5).

Value

A 'tof_tbl' with identical dimensions to the input 'tof_tibble', with all columns specified in channel_cols transformed using 'transform_fun' (with noise added or not removed depending on 'redo_noise').

See Also

[tof_preprocess()]

Examples


# read in an example .fcs file from tidytof's internal datasets
input_file <- dir(tidytof_example_data("aml"), full.names = TRUE)[[1]]
tof_tibble <- tof_read_data(input_file)

# preprocess all numeric columns with default behavior
# arcsinh transformation with a cofactor of 5
preprocessed_tof_tibble <- tof_preprocess(tof_tibble)

# postprocess all numeric columns to reverse the preprocessing
tof_postprocess(tof_tibble)


keyes-timothy/tidytof documentation built on May 7, 2024, 12:33 p.m.