pcl.tsne: Perform t-SNE Ordination

pcl.tsneR Documentation

Perform t-SNE Ordination

Description

This function performs t-Distributed Stochastic Neighbor Embedding (t-SNE) ordination on the input data or distance matrix.

Usage

pcl.tsne(
  dat,
  D = NA,
  as = FALSE,
  asinsqrt = as,
  index = "bray/curtis",
  k = 2,
  seed = 1234
)

Arguments

dat

A list containing at least an element 'x' which is the data matrix.

D

Distance matrix. If NA, it will be computed from dat$x. Default is NA.

as

Logical. If TRUE, performs arcsine transformation (deprecated parameter). Default is FALSE.

asinsqrt

Logical. If TRUE, performs arcsine square root transformation. Default is the value of 'as'.

index

Character string specifying the distance index to use when computing D. Default is "bray/curtis".

k

Integer. The number of dimensions for t-SNE. Must be at least 2. Default is 2.

seed

Integer. Random seed for reproducibility. Default is 1234.

Details

The function first checks if a distance matrix D is provided. If not, it computes the distance matrix from the input data using the specified index. If asinsqrt is TRUE, the data is transformed using an arcsine square root transformation before computing distances. The t-SNE algorithm is then applied to the distance matrix.

Value

A list containing two elements:

points

A matrix of t-SNE coordinates

ordnames

A character vector of dimension names

Note

This function requires the 'tsne' and 'labdsv' packages.

Examples

## Not run: 
data <- list(x = matrix(rnorm(1000), ncol = 10))
rownames(data$x) <- paste0("Sample", 1:100)
result <- pcl.tsne(data, k = 3)
plot(result$points[, 1], result$points[, 2], main = "t-SNE plot")

## End(Not run)


omicsEye/omicsArt documentation built on Oct. 8, 2024, 5:46 p.m.