Skip to contents

Run Force-Directed Layout (Fruchterman-Reingold algorithm)

Usage

RunFR(object, ...)

# S3 method for Seurat
RunFR(
  object,
  reduction = NULL,
  dims = NULL,
  features = NULL,
  assay = NULL,
  slot = "data",
  graph = NULL,
  neighbor = NULL,
  k.param = 20,
  ndim = 2,
  niter = 500,
  reduction.name = "FR",
  reduction.key = "FR_",
  verbose = TRUE,
  seed.use = 11L,
  ...
)

# S3 method for default
RunFR(
  object,
  ndim = 2,
  niter = 500,
  reduction.key = "FR_",
  verbose = TRUE,
  seed.use = 11L,
  ...
)

Arguments

object

An object. This can be a Seurat object, a Neighbor object, or a Graph object.

...

Additional arguments to be passed to the layout_with_fr function.

reduction

A character string specifying the reduction to be used. Default is NULL.

dims

An integer vector specifying the dimensions to be used. Default is NULL.

features

A character vector specifying the features to be used. Default is NULL.

assay

A character string specifying the assay to be used. Default is NULL.

slot

A character string specifying the slot name to be used. Default is "data".

graph

A character string specifying the name of the Graph object to be used. Default is NULL.

neighbor

A character string specifying the name of the Neighbor object to be used. Default is NULL.

k.param

An integer specifying the number of nearest neighbors to consider. Default is 20.

ndim

An integer specifying the number of dimensions for the force-directed layout. Default is 2.

niter

An integer specifying the number of iterations for the force-directed layout. Default is 500.

reduction.name

A character string specifying the name of the reduction to be stored in the Seurat object. Default is "fr".

reduction.key

A character string specifying the prefix for the column names of the force-directed layout embeddings. Default is "FR_".

verbose

A logical value indicating whether to print verbose output. Default is TRUE.

seed.use

An integer specifying the random seed to be used. Default is 11.

Examples

pancreas_sub <- Seurat::FindVariableFeatures(pancreas_sub)
pancreas_sub <- RunFR(object = pancreas_sub, features = Seurat::VariableFeatures(pancreas_sub))
#> Computing nearest neighbor graph
#> Computing SNN
#> Error in validObject(.Object): invalid class “DimReduc” object: 'assay.orig' must be a 1-length character
CellDimPlot(pancreas_sub, group.by = "CellType", reduction = "fr")