tSNEplot: t-Distributed Stochastic Neighbor embedding with tSNEplot

Description Usage Arguments Value Examples

View source: R/runPlots.R

Description

This function computes and plots t-Distributed Stochastic Neighbor embedding (t-SNE) analysis for unsupervised nonlinear dimensionality reduction of count expression matrix. Internally, it is applied the Rtsne::Rtsne() function, using the exact t-SNE computing with theta=0.0.

Usage

1
2
3
4
5
6
7
8
tSNEplot(
  countMatrix,
  targets,
  plotly = FALSE,
  savePlot = FALSE,
  filePlot = NULL,
  ...
)

Arguments

countMatrix

date.frame or matrix containing raw read counts.

targets

targets data.frame.

plotly

logical: when FALSE (default), the ggplot2 plot will be returned. TRUE option returns the plotly version of the plot.

savePlot

logical: when FALSE (default), the plot will not be saved. If TRUE the plot will be saved, and requires the filePlot argument.

filePlot

file name where the plot will be saved. For more information, please consult the ggplot2::ggsave() function.

...

additional parameters for the Rtsne::Rtsne() function.

Value

returns an object of ggplot or plotly class.

Examples

1
2
3
4
5
6
7
targetspath <- system.file("extdata", "targets.txt", package="systemPipeR")
targets <- read.delim(targetspath, comment="#")
cmp <- systemPipeR::readComp(file=targetspath, format="matrix", delim="-")
countMatrixPath <- system.file("extdata", "countDFeByg.xls", package="systemPipeR")
countMatrix <- read.delim(countMatrixPath, row.names=1)
set.seed(42) ## Set a seed if you want reproducible results
tSNEplot(countMatrix, targets, perplexity = 5)

systemPipeR/spsBio documentation built on Oct. 2, 2020, 9:30 a.m.