forvisualData: Prepare data for visualize in less dimention

Description Usage Arguments Value Examples

View source: R/ForVisualizeData.R

Description

Prepare data for visualize in less dimention

Usage

1
forvisualData(data, alg.type = c("tSNE", "PCA", "UMAP"))

Arguments

data

a data matrix with n rows representing samples and m columns representing genes.

alg.type

if alg.type == "tSNE" to reduce the dimension of the data, the tSNE method is used (the default). if alg.type == "PCA" the PCA method is used and if alg.type == "UMAP" the UMAP method is used.

Value

Double matrix of components (PCA) or dimensions (tSNE, UMAP)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data = rbind(matrix(rnorm(1000, mean=50), nrow = 500, ncol = 6),
             matrix(rnorm(100), ncol = 6, nrow = 500))
labels = factor(cbind(rep(1, 500), rep(2, 500)))
get_data <- forvisualData(data, "tSNE")

ggplot(data.frame(get_data), aes(x = get_data[,1], y = get_data[,2])) +
  geom_point(aes(color = labels))+
  ylab("dim2")+
  xlab("dim1")+
  ggtitle("tSNE")

ViktoriaShamkina/RNA-SeqDataNormalization documentation built on Dec. 18, 2021, 6:17 p.m.