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. Default is NULL.

...

Additional arguments to be passed to igraph::layout_with_fr.

reduction

Which dimensionality reduction to use. Default is "pca".

dims

The dimensions to be used. Default is NULL.

features

A character vector of features to use. Default is NULL.

assay

Which assay to use. If NULL, the default assay of the Seurat object will be used. When the object also contains ChromatinAssay, the default assay and additional ChromatinAssay will be preprocessed sequentially.

layer

Which layer to use. Default is data.

graph

The name of the Graph object to be used. Default is NULL.

neighbor

The name of the Neighbor object to be used. Default is NULL.

k.param

The number of nearest neighbors to consider. Default is 20.

ndim

The number of dimensions for the force-directed layout. Default is 2.

niter

The number of iterations for the force-directed layout. Default is 500.

reduction.name

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

reduction.key

The prefix for the column names of the force-directed layout embeddings. Default is "FR_".

verbose

Whether to print the message. Default is TRUE.

seed.use

Random seed for reproducibility. Default is 11.

Examples

data(pancreas_sub)
pancreas_sub <- standard_scop(pancreas_sub)
#>  [2026-04-26 02:15:47] Start standard processing workflow...
#>  [2026-04-26 02:15:48] Checking a list of <Seurat>...
#> ! [2026-04-26 02:15:48] Data 1/1 of the `srt_list` is "unknown"
#>  [2026-04-26 02:15:48] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-04-26 02:15:51] Perform `Seurat::FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-04-26 02:15:51] Use the separate HVF from `srt_list`
#>  [2026-04-26 02:15:52] Number of available HVF: 2000
#>  [2026-04-26 02:15:52] Finished check
#>  [2026-04-26 02:15:52] Perform `Seurat::ScaleData()`
#>  [2026-04-26 02:15:52] Perform pca linear dimension reduction
#>  [2026-04-26 02:15:53] Use stored estimated dimensions 1:20 for Standardpca
#>  [2026-04-26 02:15:53] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-04-26 02:15:53] Reorder clusters...
#>  [2026-04-26 02:15:54] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-04-26 02:15:54] Perform umap nonlinear dimension reduction
#>  [2026-04-26 02:15:54] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#>  [2026-04-26 02:15:59] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#>  [2026-04-26 02:16:05] Standard processing workflow completed
pancreas_sub <- RunFR(
  object = pancreas_sub,
  features = SeuratObject::VariableFeatures(pancreas_sub)
)
#>  [2026-04-26 02:16:05] Running force-directed layout
#>  [2026-04-26 02:16:05] Computing nearest neighbor graph and SNN
#>  [2026-04-26 02:16:18] Force-directed layout computed
CellDimPlot(
  pancreas_sub,
  group.by = "CellType",
  reduction = "fr"
)