Reorder idents by the gene expression
Usage
srt_reorder(
srt,
features = NULL,
reorder_by = NULL,
layer = "data",
assay = NULL,
log = TRUE,
distance_metric = "euclidean",
verbose = TRUE
)Arguments
- srt
A Seurat object.
- features
A character vector or a named list of features to plot. Features can be gene names in Assay or names of numeric columns in meta.data.
- reorder_by
Reorder groups instead of idents.
- layer
Which layer to use. Default is
data.- assay
Which assay to use. If
NULL, the default assay of the Seurat object will be used.- log
Whether log1p transformation needs to be applied. Default is
TRUE.- distance_metric
Metric to compute distance. Default is
"euclidean".- verbose
Whether to print the message. Default is
TRUE.
Examples
data(pancreas_sub)
pancreas_sub <- standard_scop(pancreas_sub)
#> ℹ [2026-01-27 08:39:00] Start standard scop workflow...
#> ℹ [2026-01-27 08:39:00] Checking a list of <Seurat>...
#> ! [2026-01-27 08:39:00] Data 1/1 of the `srt_list` is "unknown"
#> ℹ [2026-01-27 08:39:00] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on the data 1/1 of the `srt_list`...
#> ℹ [2026-01-27 08:39:03] Perform `Seurat::FindVariableFeatures()` on the data 1/1 of the `srt_list`...
#> ℹ [2026-01-27 08:39:03] Use the separate HVF from srt_list
#> ℹ [2026-01-27 08:39:03] Number of available HVF: 2000
#> ℹ [2026-01-27 08:39:04] Finished check
#> ℹ [2026-01-27 08:39:04] Perform `Seurat::ScaleData()`
#> ℹ [2026-01-27 08:39:04] Perform pca linear dimension reduction
#> ℹ [2026-01-27 08:39:05] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#> ℹ [2026-01-27 08:39:05] Reorder clusters...
#> ℹ [2026-01-27 08:39:05] Perform umap nonlinear dimension reduction
#> ℹ [2026-01-27 08:39:05] Non-linear dimensionality reduction (umap) using (Standardpca) dims (1-50) as input
#> ℹ [2026-01-27 08:39:10] Non-linear dimensionality reduction (umap) using (Standardpca) dims (1-50) as input
#> ✔ [2026-01-27 08:39:15] Run scop standard workflow completed
pancreas_sub <- srt_reorder(
pancreas_sub,
reorder_by = "SubCellType",
layer = "data"
)