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.
- ...
Additional arguments to be passed to igraph::layout_with_fr.
- reduction
The reduction to be used. Default is
NULL
.- dims
The dimensions to be used. Default is
NULL
.- features
The features to be used. Default is
NULL
.- assay
The assay to be used. Default is
NULL
.- layer
The layer to be used. 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
The random seed to be used. Default is
11
.
Examples
pancreas_sub <- Seurat::FindVariableFeatures(pancreas_sub)
#> Finding variable features for layer counts
pancreas_sub <- RunFR(
object = pancreas_sub,
features = SeuratObject::VariableFeatures(pancreas_sub)
)
#> ℹ [2025-09-20 13:42:57] Running force-directed layout
#> Warning: Layer ‘data’ is empty
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 't': subscript out of bounds
CellDimPlot(
pancreas_sub,
group.by = "CellType",
reduction = "fr"
)
#> Warning: No shared levels found between `names(values)` of the manual scale and the
#> data's fill values.