plotTernary | R Documentation |
Create ternary plots that show similarity between single cells and selected three terminals in a ternary baricentric coordinate.
plotTernary(x, ...)
## Default S3 method:
plotTernary(
x,
clusterVar,
vertices,
features = NULL,
veloGraph = NULL,
byCluster = NULL,
processed = FALSE,
method = c("euclidean", "cosine", "pearson", "spearman"),
force = FALSE,
sigma = 0.08,
scale = TRUE,
dotColorBy = NULL,
dotColor = NULL,
palette = "D",
direction = 1,
breaks = NULL,
legendTitle = NULL,
returnData = FALSE,
...
)
x |
Input data. Can be a |
... |
Arguments passed on to
|
clusterVar |
A vector/factor assigning the cluster variable to each
column of the matrix object. For "Seurat" method, |
vertices |
Vector of three unique cluster names that will be used for plotting. Or a named list that groups clusters as three terminal vertices. There must not be any overlap between groups. |
features |
Valid matrix row subsetting index to select features for
similarity calculation. Default |
veloGraph |
Cell x cell |
byCluster |
Default |
processed |
Logical. Whether the input matrix is already processed.
|
method |
Similarity calculation method. Default |
force |
Whether to force calculate the similarity when more then 500
features are detected, which is generally not recommended. Default
|
sigma |
Gaussian kernel parameter that controls the effect of variance.
Only effective when using a distance metric (i.e. |
scale |
Whether to min-max scale the distance matrix by clusters.
Default |
dotColorBy |
A vector/factor for coloring dots, can be either categorical
(must be character or factor) or continuous. Default |
dotColor |
Character vector of color codes. When |
palette |
Color palette to use when |
direction |
Sets the order of colors in the scale. Default |
breaks |
Number of breaks for continuous color scale passed to
non-interactive "plot3D::scatter3D" call. Default |
legendTitle |
Title on the legend/colorbar. Default |
returnData |
Logical. Whether to return similarity and aggregated
velocity data if applicable instead of generating plot. Default |
Argument inheritance - For matrix/dgCMatrix ("default" method), we first calculate the similarity matrix and obtain a "simMat" object. Then the "simMat" method is internally called. For data container objects (e.g. Seurat), we obtain the correct data matrix first and then call the "default" method. The arguments inherits as the flow described above.
The calculation of similarity matrix - The similarity is calculated either by converting a distance metric ("euclidean" or "cosine") with Gaussian kernel, or directly computed with correlation metrics ("pearson" or "spearman"). The centroid of each terminal is obtained first, and the specified metric from each cell to each terminal is calculated. The similarity matrix (n cells by v terminals) is lastly normalized to sum to 1 for each cell, so it becomes a baricentric coordinate.
By default, a "ggplot" object when byCluster
is not specified,
a list of "ggplot" object when byCluster
is specified. When
interactive = TRUE
, a "plotly" object is returned. When
returnData = TRUE
, a list of similarity matrix and aggregated velocity
matrix is returned.
Other plotTernary:
plotTernary.Seurat()
,
plotTernary.SingleCellExperiment()
gene <- selectTopFeatures(rnaRaw, rnaCluster, c("OS", "RE", "CH"))
plotTernary(rnaRaw, rnaCluster, c("OS", "RE", "CH"), gene)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.