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.

...

Additional arguments to be passed to stats::cmdscale, MASS::isoMDS or MASS::sammon.

assay

The assay to be used for the analysis. Default is NULL.

layer

The layer to be used for the analysis. Default is "data".

features

The features to be used for the analysis. Default is NULL, which uses all variable features.

nmds

The number of dimensions to be computed. Default is 50.

dist.method

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

mds.method

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

rev.mds

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

reduction.name

The name of the reduction to be stored in the Seurat object. Default is "mds".

reduction.key

The prefix for the column names of the basis vectors. Default is "MDS_".

verbose

Whether to print the message. Default is TRUE.

seed.use

The random seed to be used. Default is 11.

Examples

pancreas_sub <- RunMDS(object = pancreas_sub)
#> Warning: Layer ‘data’ is empty
#> Error in apply(X = data_use[features, ], MARGIN = 1, FUN = stats::var): dim(X) must have a positive length
CellDimPlot(
  pancreas_sub,
  group.by = "CellType",
  reduction = "mds"
)
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.