Skip to contents

Run Force-Directed Layout (Fruchterman-Reingold algorithm)

Usage

RunFR(object, ...)

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

# Default S3 method
RunFR(
  object,
  assay = NULL,
  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.

...

Passed to igraph::layout_with_fr.

reduction

Linear reduction used as input.

dims

Dimensions to use. Supply only one of dims, features, neighbor, or graph.

features

Features used instead of a reduction.

assay

Assay to use. NULL uses the default assay.

layer

Assay layer to use.

graph

Neighbor-graph edges.

neighbor

Neighbor object to be used.

k.param

The number of nearest neighbors to consider.

ndim

The number of dimensions for the force-directed layout.

niter

The number of iterations for the force-directed layout.

reduction.name

Reduction to be stored in the Seurat object.

reduction.key

The prefix for the column names of the force-directed layout embeddings.

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:00:23] Start standard processing workflow...
#>  [2026-08-30 05:00:23] Checking a list of <Seurat>...
#> ! [2026-08-30 05:00:23] Data 1/1 of the `srt_list` is "unknown"
#> Warning: Data 1/1 of the `srt_list` is "unknown"
#>  [2026-08-30 05:00:23] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-08-30 05:00:23] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-08-30 05:00:23] Use the separate HVF from `srt_list`
#>  [2026-08-30 05:00:23] Number of available HVF: 2000
#>  [2026-08-30 05:00:23] Finished check
#>  [2026-08-30 05:00:23] Perform `ScaleData()`
#>  [2026-08-30 05:00:23] Perform pca linear dimension reduction
#>  [2026-08-30 05:00:24] Use stored estimated dimensions 1:23 for Standardpca
#>  [2026-08-30 05:00:24] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-08-30 05:00:24] Reorder clusters...
#>  [2026-08-30 05:00:24] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-08-30 05:00:24] Perform umap nonlinear dimension reduction
#>  [2026-08-30 05:00:33] Standard processing workflow completed
pancreas_sub <- RunFR(
  object = pancreas_sub,
  graph = "Standardpca_SNN",
  niter = 100
)
#>  [2026-08-30 05:00:33] Running force-directed layout
#> Warning: No assay specified, setting assay as RNA by default.
#> Warning: Adding a command log without an assay associated with it
#>  [2026-08-30 05:00:33] Force-directed layout computed
CellDimPlot(
  pancreas_sub,
  group.by = "CellType",
  reduction = "fr"
)