tof_reduce_tsne: Perform t-distributed stochastic neighborhood embedding on...

View source: R/dimensionality_reduction.R

tof_reduce_tsneR Documentation

Perform t-distributed stochastic neighborhood embedding on single-cell data

Description

This function calculates a tSNE embedding using single-cell data from a 'tof_tibble'.

Usage

tof_reduce_tsne(
  tof_tibble,
  tsne_cols = where(tof_is_numeric),
  num_comp = 2,
  perplexity = 30,
  theta = 0.5,
  max_iterations = 1000,
  verbose = FALSE,
  ...
)

Arguments

tof_tibble

A 'tof_tbl' or 'tibble'.

tsne_cols

Unquoted column names indicating which columns in 'tof_tibble' to use in computing the tSNE embedding. Defaults to all numeric columns in 'tof_tibble'. Supports tidyselect helpers.

num_comp

The number of tSNE components to calculate for the embedding. Defaults to 2.

perplexity

A positive numeric value that represents represents the rough balance between the input data’s local and global structure emphasized in the embedding. Smaller values emphasize local structure; larger values emphasize global structure. The recommended range is generally 5-50. Defaults to 30.

theta

A numeric value representing the speed/accuracy tradeoff for the embedding. Set to 0 for the exact tSNE; increase for a faster approximation. Defaults to 0.5

max_iterations

An integer number of iterations to use during embedding calculation. Defaults to 1000.

verbose

A boolean value indicating whether progress updates should be printed during embedding calculation. Default is FALSE.

...

Additional arguments to pass to Rtsne.

Value

A tibble with the same number of rows as 'tof_tibble', each representing a single cell. Each of the ‘num_comp' columns represents each cell’s embedding in the calculated tSNE space.

See Also

Other dimensionality reduction functions: tof_reduce_dimensions(), tof_reduce_pca(), tof_reduce_umap()

Examples

# simulate single-cell data
sim_data <-
    dplyr::tibble(
        cd45 = rnorm(n = 200),
        cd38 = rnorm(n = 200),
        cd34 = rnorm(n = 200),
        cd19 = rnorm(n = 200)
    )

# calculate tsne
tof_reduce_tsne(tof_tibble = sim_data)

# calculate tsne with only 2 columns
tof_reduce_tsne(tof_tibble = sim_data, tsne_cols = c(cd34, cd38))


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