Functions to analyze Cell-ID's single-cell cytometry data in R, using a tidy and shiny framework.
rcell2
's functionality is split into four packages:
- The main
rcell2
package offers functions to load Cell-ID's output to data.frames, and image manipulation based on EBImage. - Cell-ID, the image segmentation software, has been wrapped in the
rcell2.cellid
package. It offers functions to run CellID from R, and an rmarkdown template showcasing advanced functionality. - Advanced cytometry tools built on R-Shiny and magick. The
rcell2.magick
package provides tools for single-cell image tiling, and graphic filtering apps. It also includes an rmarkdown template with examples and tutorials. - The
rcell2.examples
package contains example images (used by the notebook templates in other packages) and notebooks where we've tested several analyis and classification methods.
This package is very well tested in baker's yeast data, and R version 4+.
The typical pipeline:
- Use
rcell2.cellid
to segment images. - Use this package to load the output, and manipulate it using base R or the tidyverse.
- Use
rcell2.magick
to filter cells graphically with Shiny apps, make single-cell image strips, and advanced plots.
The concept is straightforward: provide a defocused brightfield image to Cell-ID, and voila:
Segmentation of yeast cells in a single position.
The image is segmented, cells are identified and tracked over time, and features are computed from morphology and fluorescent signal distribution.
Time series images of one cell, showing different acquisition channels.
With Rcell2, you can load an analize the CellID results freely, using standard R packages.
Background corrected fluorescent signal concentration VS time, plotted with ggplot2.
These installation instructions correspond to the rcell2
package.
To get the full functionality of the rcell2 suite, also install:
Most of the dependencies are listed in the DESCRIPTION
file, and should install automatically.
We suggest installing the tidyverse
meta-package (and use it, you'll not regret it) and devtools
:
install.packages(c("tidyverse", "devtools"))
In addition, install EBImage
package (required to look at cells) by copying and running the following script:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("EBImage")
Install the packages using remotes
, directly from the GitHub repos:
# Install the remotes package if absent:
if(!require(remotes)) install.packages("remotes")
# rcell2 package
remotes::install_github("darksideoftheshmoo/rcell2")
# cellid package
remotes::install_github("darksideoftheshmoo/rcell2-cellid")
# shiny-magick package
remotes::install_github("darksideoftheshmoo/rcell2-magick")
Example data and analysis notebooks can be found in the examples package: rcell2.examples
.
This feature is available in the new rcell2.cellid
package.
- The package bundles, compiles and wraps our improved Cell-ID binary.
- Save, load and manipulate cell masks and boundaries within R.
- Run it in parallel automagically, backed by R's
foreach
. - Automate scanning parameter ranges, by running Cell-ID programatically.
This feature is available in the new rcell2.magick
package.
- R-Shiny apps will help users filter data graphically, with live image previews.
- Single-cell visualization and image plotting tools, based on magick:
- Read single cells images of any channels into
magick
objects. - You may use any of
magick
's functions to manipulate these images. - Create 1D-tiles and 2D-mosaics of single cells, time courses, of one or many imaging/fluorescence channels.
- Plot of a 2D grid of "representative" single cell images in a scatterplot (similar to EBImage). Implemented in functions: cellSpread, cellSpreadPlot, and "Pics" type plot in shinyCell.
- Read single cells images of any channels into
The graphical filter in this app is general purpose (i.e. useful in standard cell cytometry), and the image-manipulation feature is tailored for data from fluorescence microscopy experiments.
We implemented the Hu moments
descriptors in R, and use them on masks generated by CellID. Note that the masks must be generated by the the CellID mask_mod
branch either by TSV output or by encoding CellIDs in the pixel intensities of boundary and/or interior points.
Use the rcell.cellid
package to generate the required input.
The kmeans algotrithm helps filter cells based on clustering of CellID's variables computed from morphological and fluorescence information.
Use k-means and check out images of cells in each cluster. Then, filter them easily by cluster number.
See: ?rcell2::kmeans_clustering
Example image datasets and analysis notebooks can be found in the rcell2 examples companion package: rcell2.examples
.
The extdata/testings
directory holds many rmarkdown notebooks, where we explore different analysis approaches to single cell images and cytometry:
- Spatial distribution of fluorescent signals.
- Pattern detection in time-series.
- Classification examples.
- Cell boundary curvature analysis and alignment.
- ...
Plot of a 2D grid of "representative" single cell images in a scatterplot (similar to EBImage).Implemented in rcell2.magick`: cellSpread, cellSpreadPlot, and "Pics" type plot in shinyCell.Generic shiny function for filtering points in a custom ggplot. Implemented in rcell2.magick`: plotApp.- 1D / histogram filtering support in the filtering app.
- Per-facet filtering in shinyCell.
- cellStrips support in shinyCell image viewer.