Plot Seurat embedding with cluster confusion links
Source:R/seurat_integration.R
PlotConfusionLinks.RdVisualize clustering confusion on Seurat UMAP/t-SNE embedding
Usage
PlotConfusionLinks(
object,
result,
reduction = "umap",
cluster_col = NULL,
matrix_type = "R1",
threshold = 0.1,
line_color = "#ffa500",
line_scale = 10,
point_size = 0.5,
title = NULL,
show_legend = TRUE
)Arguments
- object
Seurat object
- result
scClustEval assessment result
- reduction
Name of reduction to plot (default: "umap")
- cluster_col
Cluster column to use (default: uses result info or Idents)
- matrix_type
Which confusion matrix to use: "R1" or "R2"
- threshold
Threshold for drawing lines (default: 0.1)
- line_color
Color for connection lines
- line_scale
Scale factor for line widths
- point_size
Size of cell points
- title
Plot title
- show_legend
Show cluster legend
Details
This function creates a UMAP/t-SNE plot showing cells colored by cluster, with lines connecting cluster centroids based on confusion matrix values. This helps identify which clusters are transcriptionally similar.
Examples
if (FALSE) { # \dontrun{
# Run assessment
result <- RunAssessment(seurat_obj)
# Plot UMAP with confusion links
PlotConfusionLinks(seurat_obj, result, threshold = 0.1)
# Use t-SNE instead
PlotConfusionLinks(seurat_obj, result, reduction = "tsne")
} # }