standR
Workflows
Standard Workflow
Perform quality control, TMM normalization, and RUV4 batch correction on NanoString GeoMx DSP data.
library(standR)
library(SpatialExperiment)
library(limma)
library(ExperimentHub)
# Load data
eh <- ExperimentHub()
countFile <- eh[["EH7364"]]
sampleAnnoFile <- eh[["EH7365"]]
featureAnnoFile <- eh[["EH7366"]]
spe <- readGeoMx(countFile, sampleAnnoFile, featureAnnoFile = featureAnnoFile, rmNegProbe = TRUE)
# Preprocess and QC
colData(spe)$regions <- paste0(colData(spe)$region,"_",colData(spe)$SegmentLabel) |>
(\(.) gsub("_Geometric Segment","",.))() |>
paste0("_",colData(spe)$pathology) |>
(\(.) gsub("_NA","_ns",.))()
spe <- addPerROIQC(spe, rm_genes = TRUE)
spe <- spe[,rownames(colData(spe))[colData(spe)$lib_size > 50000]]
# Normalization
colData(spe)$biology <- paste0(colData(spe)$disease_status, "_", colData(spe)$regions)
spe_tmm <- geomxNorm(spe, method = "TMM")
# Batch correction
spe <- findNCGs(spe, batch_name = "SlideName", top_n = 500)
spe_ruv <- geomxBatchCorrection(spe, factors = "biology", NCGs = metadata(spe)$NCGs, k = 5)
Input: Raw NanoString GeoMx DSP count and annotation files from ExperimentHub; Output: A normalized, batch-corrected SpatialExperiment object.
When to Use
- Analyzing NanoString GeoMx DSP data using
SpatialExperiment structures.
- Performing gene-level and ROI-level quality control using
addPerROIQC and filtering based on library size (lib_size).
- Normalizing spatial transcriptomics data with TMM or other methods via
geomxNorm.
- Removing slide-associated batch effects using
findNCGs and geomxBatchCorrection.
When NOT to Use
- For single-cell RNA-seq data without spatial coordinates, use standard packages like
scran or Seurat because standR is tailored for GeoMx DSP spatial data.
- For spatial datasets requiring continuous cell state modeling across microenvironments, use
Statial because standR focuses on ROI-level profiling and batch correction.
Data Requirements
- Input counts, sample annotations, and feature annotations loaded into a
SpatialExperiment object using readGeoMx.
- Requires metadata columns such as
lib_size for ROI filtering, and slide/batch information (e.g., SlideName) for batch correction.
Key Parameters
- rmNegProbe (TRUE): Parameter in
readGeoMx to remove negative probes.
- rm_genes (TRUE): Parameter in
addPerROIQC to remove non-expressed genes.
- y_threshold (50000): Library size threshold used in
plotROIQC to identify low-quality ROIs.
- method ("TMM"): Normalization method in
geomxNorm.
- batch_name ("SlideName"): Column name in
colData representing the batch variable in findNCGs.
- top_n (500): Number of top least variable genes to select as negative control genes in
findNCGs.
- factors ("biology"): Biological factors to preserve during batch correction in
geomxBatchCorrection.
- k (5): Number of factors of unwanted variation to remove in
geomxBatchCorrection.
Best Practices
- Merge region-related annotations (e.g.,
region, SegmentLabel, pathology) to avoid collinearity before batch correction.
- Run gene-level QC using
addPerROIQC and visualize removed genes with plotGeneQC.
- Perform ROI-level QC using
plotROIQC to identify low library size or low cell count regions.
- Inspect technical variations using Relative Log Expression (
plotRLExpr) and Principal Component Analysis (drawPCA) before and after normalization.
Common Pitfalls
- Collinearity in batch correction: Avoid by merging overlapping annotations in
colData before running geomxBatchCorrection.
- Incorrect normalization method: Using
"RPKM" or "TPM" in geomxNorm without adding a genelength column to rowData will fail.
- Low library size ROIs confounding downstream analysis: Filter out low-quality ROIs (e.g.,
lib_size > 50000) before normalization.
Alternatives
edgeR: For general differential expression and TMM normalization without spatial-specific workflows.
limma: For linear modeling of expression data without built-in GeoMx-specific QC and batch correction.
DESeq2: For alternative normalization and differential testing on count data.
Citations
- Ning Liu, Dharmesh Bhuva, Ahmed Mohamed, Chin Wee Tan, Melissa Davis (2026). standR: An R package for NanoString GeoMx DSP data analysis.
References
1---2name: standr3description: standR4---56# standR78## Workflows910### Standard Workflow1112Perform quality control, TMM normalization, and RUV4 batch correction on NanoString GeoMx DSP data.1314```r15library(standR)16library(SpatialExperiment)17library(limma)18library(ExperimentHub)1920# Load data21eh <- ExperimentHub()22countFile <- eh[["EH7364"]]23sampleAnnoFile <- eh[["EH7365"]]24featureAnnoFile <- eh[["EH7366"]]2526spe <- readGeoMx(countFile, sampleAnnoFile, featureAnnoFile = featureAnnoFile, rmNegProbe = TRUE)2728# Preprocess and QC29colData(spe)$regions <- paste0(colData(spe)$region,"_",colData(spe)$SegmentLabel) |> 30 (\(.) gsub("_Geometric Segment","",.))() |>31 paste0("_",colData(spe)$pathology) |>32 (\(.) gsub("_NA","_ns",.))()3334spe <- addPerROIQC(spe, rm_genes = TRUE)35spe <- spe[,rownames(colData(spe))[colData(spe)$lib_size > 50000]]3637# Normalization38colData(spe)$biology <- paste0(colData(spe)$disease_status, "_", colData(spe)$regions)39spe_tmm <- geomxNorm(spe, method = "TMM")4041# Batch correction42spe <- findNCGs(spe, batch_name = "SlideName", top_n = 500)43spe_ruv <- geomxBatchCorrection(spe, factors = "biology", NCGs = metadata(spe)$NCGs, k = 5)44```45*Input: Raw NanoString GeoMx DSP count and annotation files from ExperimentHub; Output: A normalized, batch-corrected SpatialExperiment object.*4647## When to Use48- Analyzing NanoString GeoMx DSP data using `SpatialExperiment` structures.49- Performing gene-level and ROI-level quality control using `addPerROIQC` and filtering based on library size (`lib_size`).50- Normalizing spatial transcriptomics data with TMM or other methods via `geomxNorm`.51- Removing slide-associated batch effects using `findNCGs` and `geomxBatchCorrection`.5253## When NOT to Use54- For single-cell RNA-seq data without spatial coordinates, use standard packages like `scran` or `Seurat` because `standR` is tailored for GeoMx DSP spatial data.55- For spatial datasets requiring continuous cell state modeling across microenvironments, use `Statial` because `standR` focuses on ROI-level profiling and batch correction.5657## Data Requirements58- Input counts, sample annotations, and feature annotations loaded into a `SpatialExperiment` object using `readGeoMx`.59- Requires metadata columns such as `lib_size` for ROI filtering, and slide/batch information (e.g., `SlideName`) for batch correction.6061## Key Parameters62- **rmNegProbe** (TRUE): Parameter in `readGeoMx` to remove negative probes.63- **rm_genes** (TRUE): Parameter in `addPerROIQC` to remove non-expressed genes.64- **y_threshold** (50000): Library size threshold used in `plotROIQC` to identify low-quality ROIs.65- **method** ("TMM"): Normalization method in `geomxNorm`.66- **batch_name** ("SlideName"): Column name in `colData` representing the batch variable in `findNCGs`.67- **top_n** (500): Number of top least variable genes to select as negative control genes in `findNCGs`.68- **factors** ("biology"): Biological factors to preserve during batch correction in `geomxBatchCorrection`.69- **k** (5): Number of factors of unwanted variation to remove in `geomxBatchCorrection`.7071## Best Practices72- Merge region-related annotations (e.g., `region`, `SegmentLabel`, `pathology`) to avoid collinearity before batch correction.73- Run gene-level QC using `addPerROIQC` and visualize removed genes with `plotGeneQC`.74- Perform ROI-level QC using `plotROIQC` to identify low library size or low cell count regions.75- Inspect technical variations using Relative Log Expression (`plotRLExpr`) and Principal Component Analysis (`drawPCA`) before and after normalization.7677## Common Pitfalls78- Collinearity in batch correction: Avoid by merging overlapping annotations in `colData` before running `geomxBatchCorrection`.79- Incorrect normalization method: Using `"RPKM"` or `"TPM"` in `geomxNorm` without adding a `genelength` column to `rowData` will fail.80- Low library size ROIs confounding downstream analysis: Filter out low-quality ROIs (e.g., `lib_size > 50000`) before normalization.8182## Alternatives83- `edgeR`: For general differential expression and TMM normalization without spatial-specific workflows.84- `limma`: For linear modeling of expression data without built-in GeoMx-specific QC and batch correction.85- `DESeq2`: For alternative normalization and differential testing on count data.8687## Citations88- Ning Liu, Dharmesh Bhuva, Ahmed Mohamed, Chin Wee Tan, Melissa Davis (2026). standR: An R package for NanoString GeoMx DSP data analysis.8990## References91- Homepage: bioconductor.org/packages/standr92- Vignette: https://bioconductor.org/packages/release/bioc/vignettes/standr/inst/doc/standR_introduction.html