esetTsne {esetVis} | R Documentation |
esetTsne
reduces the dimension of the data contained in the eSet via t-Distributed Stochastic Neighbor Embedding
with the Rtsne
function and plot the subsequent biplot, possibly with sample annotation contained in the eSet.
esetTsne( eset, psids = 1:nrow(eset), trace = TRUE, colorVar = character(), color = if (length(colorVar) == 0) "black" else character(), shapeVar = character(), shape = if (length(shapeVar) == 0) 15 else numeric(), sizeVar = character(), size = if (length(sizeVar) == 0) { ifelse(typePlot[1] == "interactive" && packageInteractivity[1] == "rbokeh", 5, 2.5) } else { numeric() }, sizeRange = numeric(), alphaVar = character(), alpha = if (length(alphaVar) == 0) 1 else numeric(), alphaRange = numeric(), title = "", Rtsne.args = list(perplexity = floor((ncol(eset) - 1)/3), theta = 0.5, dims = 2, initial_dims = 50), fctTransformDataForInputTsne = NULL, symmetryAxes = c("combine", "separate", "none"), packageTextLabel = c("ggrepel", "ggplot2"), topSamples = 10, topSamplesCex = 2.5, topSamplesVar = character(), topSamplesJust = c(0.5, 0.5), topSamplesColor = "black", includeLegend = TRUE, includeLineOrigin = TRUE, typePlot = c("static", "interactive"), packageInteractivity = c("rbokeh", "ggvis"), figInteractiveSize = c(600, 400), ggvisAdjustLegend = TRUE, interactiveTooltip = TRUE, interactiveTooltipExtraVars = character(), returnAnalysis = FALSE, returnEsetPlot = FALSE )
eset |
expressionSet (or SummarizedExperiment) object with data |
psids |
featureNames of genes to include in the plot, all by default |
trace |
logical, if TRUE (by default), print some messages during tsne is running |
colorVar |
name of variable (in varLabels of the |
color |
character or factor with specified color(s) for the points,
replicated if needed. This is used only if |
shapeVar |
name of variable (in varLabels of the |
shape |
character or factor with specified shape(s) (pch) for the points,
replicated if needed. This is used only if |
sizeVar |
name of variable (in varLabels of the |
size |
character or factor with specified size(s) (cex) for the points,
replicated if needed.
This is used only if |
sizeRange |
size (cex) range used in the plot, possible only
if the |
alphaVar |
name of variable (in varLabels of the |
alpha |
character or factor with specified transparency(s) for the points,
replicated if needed. This is used only if |
alphaRange |
transparency (alpha) range used in the plot,
possible only if the |
title |
plot title, ” by default |
Rtsne.args |
arguments for the Rtsne function, by default: perplexite parameter = optimal number of neighbours, theta = speed/accuracy trade-off (increase for less accuracy), set to 0.0 for exact TSNE |
fctTransformDataForInputTsne |
function which transform the data in the eSet object before
calling the |
symmetryAxes |
set symmetry for axes, either:
|
packageTextLabel |
package used to label the outlying genes/samples/gene sets,
either |
topSamples |
numeric indicating which percentile (if <1) or number (if >=1) of samples most distant to the origin of the plot to annotate, by default: 10 samples are selected If no samples should be annotated, set this parameter to 0. Currently available for static plot. |
topSamplesCex |
cex for sample annotation (used when |
topSamplesVar |
variable of the phenoData used to label the samples,
by default: empty, the sampleNames are used for labelling
(used when |
topSamplesJust |
text justification for the samples
(used when |
topSamplesColor |
text color for the samples
(used when |
includeLegend |
logical if TRUE (by default) include a legend, otherwise not |
includeLineOrigin |
if TRUE (by default) include vertical line at x = 0 and horizontal line at y = 0 |
typePlot |
type of the plot returned, either 'static' (static) or interactive' (potentially interactive) |
packageInteractivity |
if |
figInteractiveSize |
vector containing the size of the interactive plot,
as [width, height]
by default: c(600, 400). This is passed to the
|
ggvisAdjustLegend |
logical, if TRUE (by default) adjust the legends in |
interactiveTooltip |
logical, if TRUE, add hoover functionality showing sample annotation (variables used in the plot) in the plot |
interactiveTooltipExtraVars |
name of extra variable(s)
(in varLabels of the |
returnAnalysis |
logical, if TRUE (FALSE by default), return also the output of the analysis, and the outlying samples in the topElements element if any, otherwise only the plot object |
returnEsetPlot |
logical, if TRUE return also the esetPlot object |
if returnAnalysis
is TRUE, return a list:
analysis: output of the spectral map analysis, whose elements can be given
to the esetPlotWrapper
function
dataPlotSamples: coordinates of the samples
esetUsed: expressionSet used in the plot
topElements: list with top outlying elements if any, possibly genes, samples and gene sets
plot: the plot output
otherwise return only the plot
Laure Cougnaud
L.J.P. van der Maaten and G.E. Hinton (2008). Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research, 2579–2605
the function used internally: Rtsne
or http://homepage.tudelft.nl/19j49/t-SNE.html
for further explanations about this technique.
library(ALL) data(ALL) ## complete example (most of the parameters are optional) # create custom color palette colorPalette <- c("dodgerblue", colorRampPalette(c("white","dodgerblue2", "darkblue"))(5)[-1], "red", colorRampPalette(c("white", "red3", "darkred"))(5)[-1]) # create tsne print(esetTsne(eset = ALL, title = "Acute lymphoblastic leukemia dataset \n Tsne complete", colorVar = "BT", color = colorPalette, shapeVar = "sex", shape = 15:16, sizeVar = "age", sizeRange = c(2, 6), symmetryAxes = "separate", topSamples = 15, topSamplesVar = "cod", topSamplesColor = "black", topSamplesJust = c(1, 0), topSamplesCex = 3) )