cytoMEM
Workflows
Standard Workflow
Perform Marker Enrichment Modeling (MEM) analysis on single-cell data to generate quantitative population labels, visualize them via heatmaps, and calculate similarity scores between populations.
library(cytoMEM)
data(PBMC)
# Run MEM analysis on the PBMC dataset
MEM_values <- MEM(
PBMC,
transform = TRUE,
cofactor = 15,
choose.markers = FALSE,
markers = "all",
choose.ref = FALSE,
zero.ref = FALSE,
rename.markers = FALSE,
new.marker.names = "none",
IQR.thresh = NULL
)
# Generate population labels and heatmaps
build_heatmaps(
MEM_values,
cluster.MEM = "both",
cluster.medians = "none",
cluster.IQRs = "none",
display.thresh = 1,
output.files = FALSE,
labels = FALSE,
only.MEMheatmap = FALSE
)
# Calculate similarity (RMSD) scores between populations
MEM_RMSD(
MEM_values[[5]][[1]],
format = NULL,
output.matrix = FALSE
)
Input/Output Note: Inputs a matrix or data frame of single-cell expression data with a cluster ID column; outputs MEM scores, enrichment labels, heatmaps, and population similarity matrices.
When to Use
- To automatically generate quantitative, human-readable enrichment labels for pre-clustered or pre-gated cell populations from single-cell data (e.g., mass cytometry or flow cytometry) using
MEM().
- To visualize marker enrichment and population medians across clusters using
build_heatmaps().
- To compare the similarity of MEM labels across different populations or datasets using root-mean-square deviation (RMSD) via
MEM_RMSD().
When NOT to Use
- For clustering raw single-cell data from scratch; use packages like
Seurat or scran because cytoMEM requires pre-clustered or pre-gated populations.
- For differential expression analysis of single-cell RNA-seq data; use
edgeR or DESeq2 because cytoMEM is designed to generate descriptive enrichment labels rather than statistical hypothesis testing.
- For raw flow cytometry compensation or gating; use
flowCore because cytoMEM expects pre-processed, gated, or clustered expression matrices.
Data Requirements
- Input format: Matrix, data frame, or file paths (
.txt, .csv, .fcs).
- Structure: Cells in rows, markers/features in columns. The last column must be the cluster ID (unless
file.is.clust = TRUE).
- Normalization/Transformation: Optionally transformed using hyperbolic arcsine (
transform = TRUE with a specified cofactor, e.g., cofactor = 15 for mass cytometry).
Key Parameters
- transform (
FALSE): Logical indicating whether to apply a hyperbolic arcsine transformation to the data.
- cofactor (
15): The cofactor used in the hyperbolic arcsine transformation.
- choose.markers (
FALSE): Logical indicating whether to select markers interactively via the console.
- markers (
"all"): Character string specifying which markers to include in the analysis.
- choose.ref (
FALSE): Logical indicating whether to choose an alternative reference population.
- zero.ref (
FALSE): Logical indicating whether to use a zero (synthetic negative) reference.
- IQR.thresh (
NULL): Threshold for interquartile range to avoid artificial inflation of MEM values (defaults internally to 0.5).
- display.thresh (
0): Numeric value (0-10) specifying the minimum MEM score required for a marker to be displayed.
Best Practices
- Apply channel-specific transformations prior to running
MEM() and set transform = FALSE if different cofactors are required for different fluorescence channels.
- Keep the default
IQR.thresh of 0.5 unless you have a deep understanding of the dataset and the implications of changing it.
- Set
labels = TRUE in build_heatmaps() to display the full MEM labels directly on the generated heatmap.
- Save the heatmap as a PDF file (
output.files = TRUE) to prevent row names (MEM labels) from being cut off due to R window dimensions.
Common Pitfalls
- Row names cut off in heatmaps: Occurs due to R window dimensions. Fix: Set
output.files = TRUE to save the heatmap as a PDF and open it in a PDF viewer, or read the full labels from the generated enrichment score-rownames.txt file.
- Artificial inflation of MEM values: Occurs when a population has a very small IQR due to background-level expression. Fix: Ensure
IQR.thresh is set to at least 0.5 (the default) to threshold low IQR values.
- Mismatched columns across multiple files: Occurs when reading multiple files with different formats. Fix: Ensure all files have identical columns (features) and are of the same file type.
Alternatives
Seurat: For comprehensive single-cell RNA-seq clustering and marker identification using differential expression.
scater: For single-cell quality control and visualization of expression patterns.
scran: For formal statistical testing of marker genes using differential expression.
flowCore: For low-level flow cytometry data import, compensation, and transformation.
Citations
- Diggins, K. et al. (2017), Nature Methods.
References
1---2name: cytomem3description: cytoMEM4---56# cytoMEM78## Workflows910### Standard Workflow1112Perform Marker Enrichment Modeling (MEM) analysis on single-cell data to generate quantitative population labels, visualize them via heatmaps, and calculate similarity scores between populations.1314```r15library(cytoMEM)16data(PBMC)1718# Run MEM analysis on the PBMC dataset19MEM_values <- MEM(20 PBMC,21 transform = TRUE,22 cofactor = 15,23 choose.markers = FALSE,24 markers = "all",25 choose.ref = FALSE,26 zero.ref = FALSE,27 rename.markers = FALSE,28 new.marker.names = "none",29 IQR.thresh = NULL30)3132# Generate population labels and heatmaps33build_heatmaps(34 MEM_values,35 cluster.MEM = "both",36 cluster.medians = "none",37 cluster.IQRs = "none",38 display.thresh = 1,39 output.files = FALSE,40 labels = FALSE,41 only.MEMheatmap = FALSE42)4344# Calculate similarity (RMSD) scores between populations45MEM_RMSD(46 MEM_values[[5]][[1]],47 format = NULL,48 output.matrix = FALSE49)50```51*Input/Output Note*: Inputs a matrix or data frame of single-cell expression data with a cluster ID column; outputs MEM scores, enrichment labels, heatmaps, and population similarity matrices.5253## When to Use54- To automatically generate quantitative, human-readable enrichment labels for pre-clustered or pre-gated cell populations from single-cell data (e.g., mass cytometry or flow cytometry) using `MEM()`.55- To visualize marker enrichment and population medians across clusters using `build_heatmaps()`.56- To compare the similarity of MEM labels across different populations or datasets using root-mean-square deviation (RMSD) via `MEM_RMSD()`.5758## When NOT to Use59- For clustering raw single-cell data from scratch; use packages like `Seurat` or `scran` because `cytoMEM` requires pre-clustered or pre-gated populations.60- For differential expression analysis of single-cell RNA-seq data; use `edgeR` or `DESeq2` because `cytoMEM` is designed to generate descriptive enrichment labels rather than statistical hypothesis testing.61- For raw flow cytometry compensation or gating; use `flowCore` because `cytoMEM` expects pre-processed, gated, or clustered expression matrices.6263## Data Requirements64- **Input format**: Matrix, data frame, or file paths (`.txt`, `.csv`, `.fcs`).65- **Structure**: Cells in rows, markers/features in columns. The last column must be the cluster ID (unless `file.is.clust = TRUE`).66- **Normalization/Transformation**: Optionally transformed using hyperbolic arcsine (`transform = TRUE` with a specified `cofactor`, e.g., `cofactor = 15` for mass cytometry).6768## Key Parameters69- **transform** (`FALSE`): Logical indicating whether to apply a hyperbolic arcsine transformation to the data.70- **cofactor** (`15`): The cofactor used in the hyperbolic arcsine transformation.71- **choose.markers** (`FALSE`): Logical indicating whether to select markers interactively via the console.72- **markers** (`"all"`): Character string specifying which markers to include in the analysis.73- **choose.ref** (`FALSE`): Logical indicating whether to choose an alternative reference population.74- **zero.ref** (`FALSE`): Logical indicating whether to use a zero (synthetic negative) reference.75- **IQR.thresh** (`NULL`): Threshold for interquartile range to avoid artificial inflation of MEM values (defaults internally to `0.5`).76- **display.thresh** (`0`): Numeric value (0-10) specifying the minimum MEM score required for a marker to be displayed.7778## Best Practices79- Apply channel-specific transformations prior to running `MEM()` and set `transform = FALSE` if different cofactors are required for different fluorescence channels.80- Keep the default `IQR.thresh` of `0.5` unless you have a deep understanding of the dataset and the implications of changing it.81- Set `labels = TRUE` in `build_heatmaps()` to display the full MEM labels directly on the generated heatmap.82- Save the heatmap as a PDF file (`output.files = TRUE`) to prevent row names (MEM labels) from being cut off due to R window dimensions.8384## Common Pitfalls85- **Row names cut off in heatmaps**: Occurs due to R window dimensions. Fix: Set `output.files = TRUE` to save the heatmap as a PDF and open it in a PDF viewer, or read the full labels from the generated `enrichment score-rownames.txt` file.86- **Artificial inflation of MEM values**: Occurs when a population has a very small IQR due to background-level expression. Fix: Ensure `IQR.thresh` is set to at least `0.5` (the default) to threshold low IQR values.87- **Mismatched columns across multiple files**: Occurs when reading multiple files with different formats. Fix: Ensure all files have identical columns (features) and are of the same file type.8889## Alternatives90- `Seurat`: For comprehensive single-cell RNA-seq clustering and marker identification using differential expression.91- `scater`: For single-cell quality control and visualization of expression patterns.92- `scran`: For formal statistical testing of marker genes using differential expression.93- `flowCore`: For low-level flow cytometry data import, compensation, and transformation.9495## Citations96- Diggins, K. et al. (2017), Nature Methods.9798## References99- Homepage: bioconductor.org/packages/cytoMEM100- Vignette: https://bioconductor.org/packages/release/bioc/vignettes/cytoMEM/inst/doc/Intro_to_Marker_Enrichment_Modeling_Analysis.html