esetPlotWrapper: wrapper for biplot of features/samples contained in a eSet...

Description Usage Arguments Value Author(s) Examples

View source: R/esetPlotWrapper.R

Description

Wrapper function used for all plots of the visualizations contained in the package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
esetPlotWrapper(dataPlotSamples, dataPlotGenes = data.frame(), esetUsed,
  xlab = "", ylab = "", colorVar = character(0), color = if
  (length(colorVar) == 0) "black" else character(0),
  shapeVar = character(0), shape = if (length(shapeVar) == 0) 15 else
  numeric(0), sizeVar = character(0), size = if (length(sizeVar) == 0)
  {     ifelse(typePlot == "interactive" && length(packageInteractivity) ==
  1 && packageInteractivity == "rbokeh", 5, 2.5) } else {     numeric() },
  sizeRange = numeric(0), alphaVar = character(0), alpha = if
  (length(alphaVar) == 0) 1 else numeric(0), alphaRange = numeric(0),
  title = "", symmetryAxes = c("combine", "separate", "none"),
  cloudGenes = TRUE, cloudGenesColor = "black", cloudGenesNBins = if
  (nrow(dataPlotGenes) > 0) sqrt(nrow(dataPlotGenes)) else numeric(),
  cloudGenesIncludeLegend = FALSE, cloudGenesTitleLegend = "nGenes",
  packageTextLabel = c("ggrepel", "ggplot2"), topGenes = 10,
  topGenesCex = 2.5, topGenesVar = character(0),
  topGenesJust = c(0.5, 0.5), topGenesColor = "black",
  topSamples = 10, topSamplesCex = 2.5, topSamplesVar = character(0),
  topSamplesJust = c(0.5, 0.5), topSamplesColor = "black",
  geneSets = list(), geneSetsVar = character(0),
  geneSetsMaxNChar = numeric(0), topGeneSets = 10,
  topGeneSetsCex = 2.5, topGeneSetsJust = c(0.5, 0.5),
  topGeneSetsColor = "black", includeLegend = TRUE,
  includeLineOrigin = TRUE, typePlot = c("static", "interactive"),
  figInteractiveSize = c(600, 400), ggvisAdjustLegend = TRUE,
  interactiveTooltip = TRUE,
  interactiveTooltipExtraVars = character(0),
  packageInteractivity = c("rbokeh", "ggvis"),
  returnTopElements = FALSE, returnEsetPlot = FALSE)

Arguments

dataPlotSamples

data.frame with columns 'X', 'Y' with coordinates for the samples and with rownames which should correspond and be in the same order as the sampleNames of esetUsed

dataPlotGenes

data.frame with two columns 'X' and 'Y' with coordinates for the genes

esetUsed

expressionSet (or SummarizedExperiment) object with data

xlab

label for the x axis

ylab

label for the y axis

colorVar

name of variable (in varLabels of the eset) used for coloring, empty by default

color

character or factor with specified color(s) for the points, replicated if needed. This is used only if colorVar is empty. By default: 'black' if colorVar is not specified and default ggplot palette otherwise

shapeVar

name of variable (in varLabels of the eset) used for the shape, empty by default

shape

character or factor with specified shape(s) (pch) for the points, replicated if needed. This is used only if shapeVar is empty. By default: '15' (filled square) if shapeVar is not specified and default ggplot shape(s) otherwise

sizeVar

name of variable (in varLabels of the eset) used for the size, empty by default

size

character or factor with specified size(s) (cex) for the points, replicated if needed. This is used only if sizeVar is empty. By default: '2.5' if sizeVar is not specified and default ggplot size(s) otherwise

sizeRange,

size (cex) range used in the plot, possible only if the sizeVar is 'numeric' or 'integer'

alphaVar

name of variable (in varLabels of the eset) used for the transparency, empty by default. This parameter is currently only available for static plot and ggvis (only numeric in this case).

alpha

character or factor with specified transparency(s) for the points, replicated if needed. This is used only if shapeVar is empty. By default: '1' if alphaVar is not specified and default ggplot alpha otherwise This parameter is currently only available for static and ggvis.

alphaRange

transparency (alpha) range used in the plot, possible only if the alphaVar is 'numeric' or 'integer' This parameter is currently only available for static and ggvis plot.

title

plot title, ” by default

symmetryAxes

set symmetry for axes, either:

  • 'combine' (by default): both axes are symmetric and with the same limits

  • 'separate': each axis is symmetric and has its own limits

  • 'none': axes by default (plot limits)

cloudGenes

logical, if TRUE (by default), include the cloud of genes in the plot

cloudGenesColor

if cloudGenes is TRUE, color for the cloud of genes, black by default

cloudGenesNBins

number of bins to used for the clouds of genes, by default the square root of the number of genes

cloudGenesIncludeLegend

logical, if TRUE (FALSE by default) include the legend for the cloud of genes (in the top position if multiple legends)

cloudGenesTitleLegend

string with title for the legend for the cloud of genes 'nGenes' by default

packageTextLabel

package used to label the outlying genes/samples/gene sets, either ggrepel (by default, only used if package ggrepel is available), or ggplot2

topGenes

numeric indicating which percentile (if <1) or number (if >=1) of genes most distant to the origin of the plot to annotate, by default: 10 genes are selected If no genes should be annotated, set this parameter to 0 Currently only available for static plot.

topGenesCex

cex for gene annotation (used when topGenes > 0)

topGenesVar

variable of the featureData used to label the genes, by default: empty, the featureNames are used for labelling (used when topGenes > 0)

topGenesJust

text justification for the genes (used when topGenes > 0 and if packageTextLabel is ggplot2), by default: c(0.5, 0.5) so centered

topGenesColor

text color for the genes (used when topGenes > 0), black by default

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 topSamples > 0)

topSamplesVar

variable of the phenoData used to label the samples, by default: empty, the sampleNames are used for labelling (used when topSamples > 0)

topSamplesJust

text justification for the samples (used when topSamples > 0 and if packageTextLabel is ggplot2), by default: c(0.5, 0.5) so centered

topSamplesColor

text color for the samples (used when topSamples > 0), black by default

geneSets

list of gene sets/pathways, each containing identifiers of genes contained in the set. E.g. pathways from Gene Ontology databases output from the getGeneSetsForPlot function or any custom list of pathways. The genes identifiers should correspond to the variable geneSetsVar contained in the phenoData, if not specified the featureNames are used. If several gene sets have the same name, they will be combine to extract the top gene sets.

geneSetsVar

variable of the featureData used to match the genes contained in geneSets, most probably ENTREZID, if not specified the featureNames of the eSet are used Only used when topGeneSets > 0 and the parameter geneSets is specified.

geneSetsMaxNChar

maximum number of characters for pathway names, by default keep entire names Only used when topGeneSets > 0 and the parameter geneSets is specified. If returnAnalysis is set to TRUE and geneSetsMaxNChar specified, the top pathways will be returned in the output object, named with the identifiers used in the plot (so with maximum geneSetsMaxNChar number of characters)

topGeneSets

numeric indicating which percentile (if <=1) or number (if >1) of gene sets most distant to the origin of the plot to annotate, by default: 10 gene sets are selected If no gene sets should be annotated, set this parameter to 0. Currently available for static plot. Only used when topGeneSets > 0 and the parameter geneSets is specified.

topGeneSetsCex

cex for gene sets annotation Only used when topGeneSets > 0 and the parameter geneSets is specified.

topGeneSetsJust

text justification for the gene sets by default: c(0.5, 0.5) so centered Only used when topGeneSets > 0, the parameter geneSets is specified and if packageTextLabel is ggplot2.

topGeneSetsColor

color for the gene sets (used when topGeneSets > 0 and geneSets is specified), black by default Only used when topGeneSets > 0 and the parameter geneSets is specified.

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)

figInteractiveSize

vector containing the size of the interactive plot, as [width, height] by default: c(600, 400). This is passed to the width and height parameters of:

  • for rbokeh plots: the bokeh::figure function

  • for ggvis plots: the ggvis::set_options function

ggvisAdjustLegend

logical, if TRUE (by default) adjust the legends in ggvis to avoid overlapping legends when multiple legends

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 eset) to add in rbokehEsetPlot to label the samples, empty by default

packageInteractivity

if typePlot is 'interactive', package used for interactive plot, either 'rbokeh' (by default) or 'ggvis'

returnTopElements

logical, if TRUE return also the top elements

returnEsetPlot

logical, if TRUE return also the esetPlot object

Value

if typePlot is:

Author(s)

Laure Cougnaud

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(ALL)
data(ALL)

## run one spectral map analysis

# create custom color palette
colorPalette <- c("dodgerblue", colorRampPalette(c("white","dodgerblue2", "darkblue"))(5)[-1], 
	"red", colorRampPalette(c("white", "red3", "darkred"))(5)[-1])

# run the analysis
# with 'returnAnalysis' set to TRUE to have all objects required for the esetPlotWrapper
outputEsetSPM <- esetSpectralMap(eset = ALL, 
	title = "Acute lymphoblastic leukemia dataset \n Spectral map complete",
	colorVar = "BT", color = colorPalette,
	shapeVar = "sex", shape = 15:16,
	sizeVar = "age", sizeRange = c(2, 6),
	symmetryAxes = "separate",
	topGenes = 10, topGenesJust = c(1, 0), topGenesCex = 2, topGenesColor = "darkgrey",
	topSamples = 15, topSamplesVar = "cod", topSamplesColor = "black",
	topSamplesJust = c(1, 0), topSamplesCex = 3, returnAnalysis = TRUE)

# plot the biplot
print(outputEsetSPM$plot)


## re-call the plot function, to change some visualizations parameters
esetPlotWrapper(
	dataPlotSamples = outputEsetSPM$analysis$dataPlotSamples,
	dataPlotGenes = outputEsetSPM$analysis$dataPlotGenes,
	esetUsed = outputEsetSPM$analysis$esetUsed,
	title = paste("Acute lymphoblastic leukemia dataset \n Spectral map"),
	colorVar = "BT", color = colorPalette,
	shapeVar = "relapse", 
	sizeVar = "age", sizeRange = c(2, 6),
	topSamplesVar = "cod", topGenesVar = "SYMBOL"
)

esetVis documentation built on Nov. 8, 2020, 4:51 p.m.