darksideoftheshmoo / rcell2-old-with-sample-images

R packages to produce and analyze Cell-ID data in a tidy and shiny framework
Other
0 stars 0 forks source link

rcell2

Codecov test coverage

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:

This package is very well tested in baker's yeast data, and R version 4+.

Preview

The typical pipeline:

  1. Use rcell2.cellid to segment images.
  2. Use this package to load the output, and manipulate it using base R or the tidyverse.
  3. 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.

Installation

These installation instructions correspond to the rcell2 package.

To get the full functionality of the rcell2 suite, also install:

R Dependencies

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")

Installing the packages

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.

New tools

CellID bundled in R

This feature is available in the new rcell2.cellid package.

R-Shiny tools for cytometry data

This feature is available in the new rcell2.magick package.

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.

Hu Moment functions for raw cell segmentation data

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.

K-means filtering functions

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

Development notebooks

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:

Todo

'Automating' comes from the roots 'auto-' meaning 'self-', and 'mating', meaning 'screwing'.