plotSankey {rliger} | R Documentation |
Make Riverplot/Sankey diagram that shows label mapping across datasets
Description
Creates a riverplot/Sankey diagram to show how independent cluster
assignments from two datasets map onto a joint clustering. Prior knowledge of
cell annotation for the given datasets is required to make sense from the
visualization. Dataset original annotation can be added with the syntax shown
in example code in this manual. The joint clustering could be generated with
runCluster
or set by any other metadata annotation.
Dataset original annotation can be inserted before running this function
using cellMeta<-
method. Please see example below.
This function depends on CRAN available package "sankey" and it has to be installed in order to make this function work.
Usage
plotSankey(
object,
cluster1,
cluster2,
clusterConsensus = NULL,
minFrac = 0.01,
minCell = 10,
titles = NULL,
prefixes = NULL,
labelCex = 1,
titleCex = 1.1,
colorValues = scPalette,
mar = c(2, 2, 4, 2)
)
Arguments
object |
A liger object with all three clustering variables available. |
cluster1 , cluster2 |
Name of the variables in |
clusterConsensus |
Name of the joint cluster variable to use. Default
uses the default clustering of the object. Can select a variable name in
|
minFrac |
Numeric. Minimum fraction of cluster for an edge to be shown.
Default |
minCell |
Numeric. Minimum number of cells for an edge to be shown.
Default |
titles |
Character vector of three. Customizes the column title text
shown. Default uses the variable names |
prefixes |
Character vector of three. Cluster names have to be unique
across all three variables, so this is provided to deduplicate the clusters
by adding |
labelCex |
Numeric. Amount by which node label text should be magnified
relative to the default. Default |
titleCex |
Numeric. Amount by which node label text should be magnified
relative to the default. Default |
colorValues |
Character vector of color codes to set color for each
level in the consensus clustering. Default |
mar |
Numeric vector of the form |
Value
No returned value. The sankey diagram will be displayed instead.
Note
This function works as a replacement of the function makeRiverplot
in rliger <1.99. We decide to make a new function because the dependency
adopted by the older version is archived on CRAN and will be no longer
available.
Examples
# Make fake dataset specific labels from joint clustering result
cellMeta(pbmcPlot, "ctrl_cluster", "ctrl") <-
cellMeta(pbmcPlot, "leiden_cluster", "ctrl")
cellMeta(pbmcPlot, "stim_cluster", "stim") <-
cellMeta(pbmcPlot, "leiden_cluster", "stim")
if (requireNamespace("sankey", quietly = TRUE)) {
plotSankey(pbmcPlot, "ctrl_cluster", "stim_cluster",
titles = c("control", "LIGER", "stim"),
prefixes = c("c", NA, "s"))
}