Skip to contents

Run MDS (multi-dimensional scaling)

Usage

RunMDS(object, ...)

# S3 method for class 'Seurat'
RunMDS(
  object,
  assay = NULL,
  layer = "data",
  features = NULL,
  nmds = 50,
  dist.method = "euclidean",
  mds.method = "cmdscale",
  rev.mds = FALSE,
  reduction.name = "mds",
  reduction.key = "MDS_",
  verbose = TRUE,
  seed.use = 11,
  ...
)

# S3 method for class 'Assay'
RunMDS(
  object,
  assay = NULL,
  layer = "data",
  features = NULL,
  nmds = 50,
  dist.method = "euclidean",
  mds.method = "cmdscale",
  rev.mds = FALSE,
  reduction.key = "MDS_",
  verbose = TRUE,
  seed.use = 11,
  ...
)

# S3 method for class 'Assay5'
RunMDS(
  object,
  assay = NULL,
  layer = "data",
  features = NULL,
  nmds = 50,
  dist.method = "euclidean",
  mds.method = "cmdscale",
  rev.mds = FALSE,
  reduction.key = "MDS_",
  verbose = TRUE,
  seed.use = 11,
  ...
)

# Default S3 method
RunMDS(
  object,
  assay = NULL,
  layer = "data",
  nmds = 50,
  dist.method = "euclidean",
  mds.method = "cmdscale",
  rev.mds = FALSE,
  reduction.key = "MDS_",
  verbose = TRUE,
  seed.use = 11,
  ...
)

Arguments

object

An object. This can be a Seurat object, an assay object, or a matrix-like object.

...

Passed to stats::cmdscale, MASS::isoMDS or MASS::sammon.

assay

Assay to use. NULL uses the default assay.

layer

Assay layer to use.

features

Features used instead of a reduction.

nmds

The number of dimensions to be computed.

dist.method

The distance metric to be used. Currently supported values are "euclidean", "chisquared", "kullback", "jeffreys", "jensen", "manhattan", "maximum", "canberra", "minkowski", and "hamming".

mds.method

The MDS algorithm to be used. Currently supported values are "cmdscale", "isoMDS", and "sammon".

rev.mds

Whether to perform reverse MDS (i.e., transpose the input matrix) before running the analysis.

reduction.name

Reduction to be stored in the Seurat object.

reduction.key

The prefix for the column names of the basis vectors.

verbose

Whether to print the message. Default is TRUE.

seed.use

Random seed.

Examples

data(pancreas_sub)
pancreas_sub <- RunStandardWorkflow(pancreas_sub)
#>  [2026-08-30 05:16:59] Start standard processing workflow...
#>  [2026-08-30 05:16:59] Checking a list of <Seurat>...
#> ! [2026-08-30 05:17:00] Data 1/1 of the `srt_list` is "unknown"
#> Warning: Data 1/1 of the `srt_list` is "unknown"
#>  [2026-08-30 05:17:00] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-08-30 05:17:00] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-08-30 05:17:00] Use the separate HVF from `srt_list`
#>  [2026-08-30 05:17:00] Number of available HVF: 2000
#>  [2026-08-30 05:17:00] Finished check
#>  [2026-08-30 05:17:00] Perform `ScaleData()`
#>  [2026-08-30 05:17:00] Perform pca linear dimension reduction
#>  [2026-08-30 05:17:01] Use stored estimated dimensions 1:23 for Standardpca
#>  [2026-08-30 05:17:01] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-08-30 05:17:01] Reorder clusters...
#>  [2026-08-30 05:17:01] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-08-30 05:17:01] Perform umap nonlinear dimension reduction
#>  [2026-08-30 05:17:10] Standard processing workflow completed
pancreas_sub <- RunMDS(pancreas_sub)
CellDimPlot(
  pancreas_sub,
  group.by = "CellType",
  reduction = "mds"
)