vignettes/iSEE_quickrecipes_03.Rmd
iSEE_quickrecipes_03.Rmd
This vignette consists of a series of (independent) hands-on recipes, aimed at exploring the capabilities of iSEE (Rue-Albrecht et al. 2018) both interactively and programmatically. Each recipe consists of a short task and a screen shot of the desired appearance of the app instance that should be created. For each recipe, we provide a set of hints, as well as detailed instructions on how to solve the task both interactively (by clicking in the app) and programmatically (by directly setting up and launching the desired app instance).
For a general overview of the default iSEE
panels, we
refer to the overview vignette. For
all the details about the panel classes and the associated slots, we
refer to the help pages for the respective panel class (e.g.,
?ReducedDimensionPlot
).
Before starting with the recipes, we need to load the required packages and the demo data set.
library("iSEE")
library("iSEEu")
sce_location <- system.file("datasets", "sce_pbmc3k.RDS", package = "iUSEiSEE")
sce_location
#> [1] "/Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library/iUSEiSEE/datasets/sce_pbmc3k.RDS"
sce <- readRDS(sce_location)
sce
#> class: SingleCellExperiment
#> dim: 32738 2643
#> metadata(0):
#> assays(2): counts logcounts
#> rownames(32738): MIR1302-10 FAM138A ... AC002321.2 AC002321.1
#> rowData names(19): ENSEMBL_ID Symbol_TENx ... FDR_cluster11
#> FDR_cluster12
#> colnames(2643): Cell1 Cell2 ... Cell2699 Cell2700
#> colData names(24): Sample Barcode ... labels_ont cell_ontology_labels
#> reducedDimNames(3): PCA TSNE UMAP
#> mainExpName: NULL
#> altExpNames(0):
What follows is a list of 11 small self contained recipes, that try to address one specific aim - and provide accordingly a simple, targeted solution.
Using the pbmc3k
data set, create an app that contains
only a reduced dimension plot panel, a row data plot panel and a column
data plot panel. The widths of the three panels should be 3, 4 and 5
units, respectively.
Organization
button in the top right corner of the app.
initial
argument to iSEE()
.
str()
function on any instance of a panel object,
e.g. str(ReducedDimensionPlot())
.
Organization
button in the top right corner of
the app, and then click on Organize panels
.
x
next to all the panels that you want to remove (all but the
Reduced dimension plot 1
, Column data plot 1
and Row data plot 1
).
Width
dropdown menu.
Apply settings
.
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(PanelWidth = 3L),
RowDataPlot(PanelWidth = 4L),
ColumnDataPlot(PanelWidth = 5L)
))
Using the pbmc3k
data set, visualize the cell type
assignment against the cluster membership, with the aim to identify the
predominant cell type in each cluster. In this case, since both cell
annotations are categorical, iSEE
will generate a so called
Hinton plot.
ColumnDataPlot
panel.
Cluster
column of
colData(sce)
.
labels_fine
column of colData(sce)
(more coarse-grained assignments are
provided in the labels_main
column).
iSEE
will automatically determine the plot type depending
on the type of selected variables.
ColumnDataPlot
panel spanning the full application window)
app <- iSEE(sce, initial = list(ColumnDataPlot(PanelWidth = 12L)))
shiny::runApp(app)
ColumnDataPlot
panel, click to expand the
Data parameters
collapsible box.
Column of interest (Y-axis)
, select the label column
(e.g., labels_fine
).
X-axis
, select Column data
, and under
Column of interest (X-axis)
, select Cluster
.
app <- iSEE(sce, list(
ColumnDataPlot(
PanelWidth = 12L, XAxis = "Column data",
YAxis = "labels_fine", XAxisColumnData = "Cluster"
)
))
Using the pbmc3k
data set, display both the tSNE and
UMAP representations next to each other.
ReducedDimensionPlot
panels.
reducedDimNames(sce)
lists the
available representations).
ReducedDimensionPlot
panels, each spanning half the application window)
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(PanelWidth = 6L),
ReducedDimensionPlot(PanelWidth = 6L)
))
shiny::runApp(app)
ReducedDimensionPlot
panel, click to expand
the Data parameters
collapsible box.
Type
selection box, choose TSNE
.
ReducedDimensionPlot
panel, repeat the
procedure but instead select UMAP
.
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(PanelWidth = 6L, Type = "TSNE"),
ReducedDimensionPlot(PanelWidth = 6L, Type = "UMAP")
))
Using the pbmc3k
data set, plot the distribution of the
logcount values for the gene CD74
in each of the
clusters.
FeatureAssayPlot
panel.
FeatureAssayPlot
panel,
spanning the full application window)
app <- iSEE(sce, initial = list(FeatureAssayPlot(PanelWidth = 12L)))
shiny::runApp(app)
FeatureAssayPlot
panel, click to expand the
Data parameters
collapsible box.
Y-axis feature
, type or select CD74
.
X-axis
, select Column data
, and under
Column of interest (X-axis)
, select Cluster
.
app <- iSEE(sce, initial = list(
FeatureAssayPlot(
PanelWidth = 12L, XAxis = "Column data",
YAxisFeatureName = "CD74", XAxisColumnData = "Cluster"
)
))
Using the pbmc3k
data set, display two tSNE
representations next to each other. In the first one, color the cells by
the cluster label. In the second one, color the cells by the log10 of
the total UMI count (log10_total
column of
colData(sce)
).
ReducedDimensionPlot
panels.
reducedDimNames(sce)
lists the
available representations).
Cluster
column of
colData(sce)
.
Visual parameters
collapsible box. To display or hide the possible options, check the
corresponding checkboxes (Color
, Shape
,
Size
, Point
).
ReducedDimensionPlot
panels, each spanning half the application window)
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(PanelWidth = 6L),
ReducedDimensionPlot(PanelWidth = 6L)
))
shiny::runApp(app)
ReducedDimensionPlot
panel, click to expand the
Data parameters
collapsible box and under
Type
, choose TSNE
.
ReducedDimensionPlot
panel, click to expand
the Visual parameters
collapsible box.
Color
checkbox is ticked.
Color by
, select Column data
.
Cluster
.
ReducedDimensionPlot
panel, repeat the
procedure but instead select log10_total
.
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
ColorBy = "Column data",
ColorByColumnData = "Cluster"
),
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
ColorBy = "Column data",
ColorByColumnData = "log10_total"
)
))
Using the pbmc3k
data set, display two tSNE
representations next to each other. In the first one, color the cells by
the logcounts expression level of CD3D
. In the second one,
color the cells by the logcounts expression level of
CD79B
.
ReducedDimensionPlot
panels.
reducedDimNames(sce)
lists the
available representations).
Visual parameters
collapsible box. To display or hide the possible options, check the
corresponding checkboxes (Color
, Shape
,
Size
, Point
).
ReducedDimensionPlot
panels, each spanning half the application window)
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(PanelWidth = 6L),
ReducedDimensionPlot(PanelWidth = 6L)
))
shiny::runApp(app)
ReducedDimensionPlot
panel, click to expand the
Data parameters
collapsible box and under
Type
, choose TSNE
.
ReducedDimensionPlot
panel, click to expand
the Visual parameters
collapsible box.
Color
checkbox is ticked.
Color by
, select Feature name
.
CD3D
.
ReducedDimensionPlot
panel, repeat the
procedure but instead select CD79B
.
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
ColorBy = "Feature name",
ColorByFeatureName = "CD3D"
),
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
ColorBy = "Feature name",
ColorByFeatureName = "CD79B"
)
))
Using the pbmc3k
data set, display two tSNE
representations next to each other. In the first one, set the point size
to 0.5. In the second one, set the point size to 3 and the opacity to
0.2.
ReducedDimensionPlot
panels.
reducedDimNames(sce)
lists the
available representations).
Visual parameters
collapsible box. To display or hide the possible options, check the
corresponding checkboxes (Color
, Shape
,
Size
, Point
).
ReducedDimensionPlot
panels, each spanning half the application window)
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(PanelWidth = 6L),
ReducedDimensionPlot(PanelWidth = 6L)
))
shiny::runApp(app)
ReducedDimensionPlot
panel, click to expand the
Data parameters
collapsible box and under
Type
, choose TSNE
.
ReducedDimensionPlot
panel, click to expand
the Visual parameters
collapsible box.
Size
checkbox is ticked.
Size by
, select None
.
ReducedDimensionPlot
panel, click to expand
the Visual parameters
collapsible box.
Size
and Point
checkboxes
are ticked.
Size by
, select None
.
Point opacity
, drag the slider to 0.2.
app <- iSEE(sce, initial = list(
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
PointSize = 0.5
),
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
PointSize = 3, PointAlpha = 0.2
)
))
Using the pbmc3k
data set, display the expression
(logcounts) of CD3D
across the assigned clusters, as well
as a tSNE representation colored by the cluster label. Select all cells
with a logcount expression value of CD3D
between
(approximately) 0.5 and 4, and highlight these in the tSNE plot by means
of transparency.
ReducedDimensionPlot
panels.
reducedDimNames(sce)
lists the
available representations).
FeatureAssayPlot
panel.
Selection parameters
collapsible box.
FeatureAssayPlot
panel
and one ReducedDimensionPlot
panel, each spanning half the
application window)
app <- iSEE(sce, initial = list(
FeatureAssayPlot(PanelWidth = 6L),
ReducedDimensionPlot(PanelWidth = 6L)
))
shiny::runApp(app)
FeatureAssayPlot
panel, click to expand the
Data parameters
collapsible box and under
Y-axis feature
, type or select CD3D
.
X-axis
, select Column data
, and under
X-axis column data
, select Cluster
.
FeatureAssayPlot
panel, use the mouse to drag a
rectangle around all points with a logcount expression value (y-axis)
between approximately 0.5 and 4.
ReducedDimensionPlot
panel, click to expand the
Data parameters
collapsible box and under
Type
, choose TSNE
.
ReducedDimensionPlot
panel, further click to expand
the Visual parameters
collapsible box, make sure that the
Color
checkbox is ticked. Under Color by
,
select Column data
. In the dropdown menu that appears, type
or select Cluster
.
ReducedDimensionPlot
panel, click to expand the
Selection parameters
collapsible box.
Receive column selection from
, select
Feature assay plot 1
.
Selection effect
, make sure that
Transparent
is chosen.
app <- iSEE(sce, initial = list(
FeatureAssayPlot(
PanelWidth = 6L,
BrushData = list(
xmin = 0, xmax = 15,
ymin = 0.5, ymax = 4,
mapping = list(x = "X", y = "Y", group = "GroupBy"),
direction = "xy",
brushId = "FeatureAssayPlot1_Brush",
outputId = "FeatureAssayPlot1"
),
XAxis = "Column data",
XAxisColumnData = "Cluster", YAxisFeatureName = "CD3D"
),
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
ColorBy = "Column data",
ColorByColumnData = "Cluster",
SelectionEffect = "Transparent",
ColumnSelectionSource = "FeatureAssayPlot1"
)
))
#> Warning in .local(.Object, ...): 'SelectionEffect=' is deprecated.
#> Use 'ColumnSelectionRestrict=TRUE' instead.
Using the pbmc3k
data set, create a scatter plots
displaying the (logcounts) expression values of CD79A
vs
CD74
, as well as a Hinton plot of the cluster and cell type
assignment annotations. Select the cells co-expressing
CD79A
and CD74
in the scatter plot. Which cell
type/cluster(s) do these correspond to (color these points in the Hinton
plot)?
FeatureAssayPlot
panel.
ColumnDataPlot
panel.
Cluster
column of
colData(sce)
. Coarse-grained cell type labels are available
in the labels_main
column.
Selection parameters
collapsible box.
FeatureAssayPlot
panel
and one ColumnDataPlot
panel, each spanning half of the
application window)
app <- iSEE(sce, initial = list(
FeatureAssayPlot(PanelWidth = 6L),
ColumnDataPlot(PanelWidth = 6L)
))
shiny::runApp(app)
FeatureAssayPlot
panel, click to expand the
Data parameters
collapsible box.
Y-axis feature
, type or select CD79A
.
X-axis
, select Feature name
, and under
X-axis feature
, type or select CD74
.
ColumnDataPlot
panel, click to expand the
Data parameters
collapsible box.
Column of interest (Y-axis)
, type or select
labels_main
.
X-axis
, select Column data
, and under
Column of interest (X-axis)
, select Cluster
.
FeatureAssayPlot
panel, use the mouse to drag a
rectangle around all points co-expressing CD79A
and
CD74
.
ColumnDataPlot
panel, click to expand the
Selection parameters
collapsible box.
Receive column selection from
, select
Feature assay plot 1
.
Selection effect
, make sure that Color
is chosen.
app <- iSEE(sce, initial = list(
FeatureAssayPlot(
PanelWidth = 6L, XAxis = "Feature name",
YAxisFeatureName = "CD79A",
XAxisFeatureName = "CD74",
BrushData = list(
xmin = 0.3, xmax = 7,
ymin = 0.3, ymax = 7,
mapping = list(x = "X", y = "Y", colour = "ColorBy"),
direction = "xy", brushId = "FeatureAssayPlot1_Brush",
outputId = "FeatureAssayPlot1"
)
),
ColumnDataPlot(
PanelWidth = 6L, XAxis = "Column data",
YAxis = "labels_main",
XAxisColumnData = "Cluster",
ColumnSelectionSource = "FeatureAssayPlot1",
ColumnSelectionRestrict = FALSE
)
))
iSEEu
Using the pbmc3k
data set, load iSEEu
and
use the modeReducedDim
mode to open an app displaying all
the reduced dimension representations stored in the SingleCellExperiment
object. Color the representations by the cell type assignment.
labels_fine
column of colData(sce)
(more coarse-grained assignments are
provided in the labels_main
column).
iSEEu::modeReducedDim()
.
app <- modeReducedDim(sce, colorBy = "labels_main")
Using the pbmc3k
data set, display two tSNE
representations next to each other. In the first one, color the cells by
the logcounts expression level of CD3D
. In the second one,
color the cells by the logcounts expression level of CD79B
.
Also include a small tour that starts with a welcome message, next walks
through the two panels, giving an informative message for each, and
finally ends with a concluding message to the user.
ReducedDimensionPlot
panels.
reducedDimNames(sce)
lists the
available representations).
Visual parameters
collapsible box. To display or hide the possible options, check the
corresponding checkboxes (Color
, Shape
,
Size
, Point
).
tour
argument to
iSEE()
.
element
and intro
. The element
column contains the names of UI elements, prefixed by a hash sign. More
details, including how to find the name of a particular UI elements, can
be found in the Configuring iSEE apps
vignette of
iSEE
.
tour <- data.frame(
element = c(
"#Welcome",
"#ReducedDimensionPlot1",
"#ReducedDimensionPlot2",
"#Conclusion"
),
intro = c(
"Welcome to this tour!",
"This is the first reduced dimension plot",
"And here is the second one",
"Thank you for taking this tour!"
),
stringsAsFactors = FALSE
)
app <- iSEE(sce,
initial = list(
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
ColorBy = "Feature name",
ColorByFeatureName = "CD3D"
),
ReducedDimensionPlot(
PanelWidth = 6L, Type = "TSNE",
ColorBy = "Feature name",
ColorByFeatureName = "CD79B"
)
),
tour = tour
)
sessionInfo()
#> R version 4.4.0 (2024-04-24)
#> Platform: x86_64-apple-darwin20
#> Running under: macOS Monterey 12.7.1
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> time zone: Europe/Berlin
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats4 stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] iSEEu_1.15.1 iSEEhex_1.5.0
#> [3] iSEE_2.15.1 SingleCellExperiment_1.26.0
#> [5] SummarizedExperiment_1.33.3 Biobase_2.64.0
#> [7] GenomicRanges_1.55.4 GenomeInfoDb_1.40.0
#> [9] IRanges_2.38.0 S4Vectors_0.42.0
#> [11] BiocGenerics_0.50.0 MatrixGenerics_1.16.0
#> [13] matrixStats_1.3.0 BiocStyle_2.32.0
#>
#> loaded via a namespace (and not attached):
#> [1] bitops_1.0-7 rlang_1.1.3 magrittr_2.0.3
#> [4] shinydashboard_0.7.2 clue_0.3-65 GetoptLong_1.0.5
#> [7] compiler_4.4.0 mgcv_1.9-1 png_0.1-8
#> [10] systemfonts_1.0.6 vctrs_0.6.5 pkgconfig_2.0.3
#> [13] shape_1.4.6.1 crayon_1.5.2 fastmap_1.1.1
#> [16] XVector_0.44.0 fontawesome_0.5.2 utf8_1.2.4
#> [19] promises_1.3.0 rmarkdown_2.26 shinyAce_0.4.2
#> [22] UCSC.utils_1.0.0 ragg_1.3.0 purrr_1.0.2
#> [25] xfun_0.43 zlibbioc_1.50.0 cachem_1.0.8
#> [28] jsonlite_1.8.8 listviewer_4.0.0 highr_0.10
#> [31] later_1.3.2 DelayedArray_0.30.0 parallel_4.4.0
#> [34] cluster_2.1.6 R6_2.5.1 bslib_0.7.0
#> [37] RColorBrewer_1.1-3 jquerylib_0.1.4 Rcpp_1.0.12
#> [40] iterators_1.0.14 knitr_1.46 httpuv_1.6.15
#> [43] Matrix_1.7-0 splines_4.4.0 igraph_2.0.3
#> [46] tidyselect_1.2.1 rstudioapi_0.16.0 abind_1.4-5
#> [49] yaml_2.3.8 doParallel_1.0.17 codetools_0.2-20
#> [52] miniUI_0.1.1.1 lattice_0.22-6 tibble_3.2.1
#> [55] shiny_1.8.1.1 evaluate_0.23 desc_1.4.3
#> [58] circlize_0.4.16 pillar_1.9.0 BiocManager_1.30.22
#> [61] DT_0.33 foreach_1.5.2 shinyjs_2.1.0
#> [64] generics_0.1.3 RCurl_1.98-1.14 ggplot2_3.5.1
#> [67] munsell_0.5.1 scales_1.3.0 xtable_1.8-4
#> [70] glue_1.7.0 tools_4.4.0 hexbin_1.28.3
#> [73] colourpicker_1.3.0 fs_1.6.4 grid_4.4.0
#> [76] colorspace_2.1-0 nlme_3.1-164 GenomeInfoDbData_1.2.12
#> [79] vipor_0.4.7 cli_3.6.2 textshaping_0.3.7
#> [82] fansi_1.0.6 viridisLite_0.4.2 S4Arrays_1.4.0
#> [85] ComplexHeatmap_2.20.0 dplyr_1.1.4 gtable_0.3.5
#> [88] rintrojs_0.3.4 sass_0.4.9 digest_0.6.35
#> [91] SparseArray_1.4.0 ggrepel_0.9.5 rjson_0.2.21
#> [94] htmlwidgets_1.6.4 memoise_2.0.1 htmltools_0.5.8.1
#> [97] pkgdown_2.0.9 lifecycle_1.0.4 shinyWidgets_0.8.6
#> [100] httr_1.4.7 GlobalOptions_0.1.2 mime_0.12