Creates a Sankey diagram to visualize the correspondence between original and projected cell type labels, typically used to show scRNA-seq cell type annotation results.
Value
The augmented prediction data frame including all reference cell types. If plot=TRUE, also displays the Sankey diagram.
Details
This function:
Processes prediction results to include all reference cell types
Generates a Sankey diagram showing label transitions
Handles cases where some reference cell types are not predicted
The visualization helps evaluate how cell types are mapped between reference and query datasets.
Examples
if (FALSE) { # \dontrun{
# Mock prediction results
predict_df <- data.frame(
orign_label = c("Tcell", "Bcell", "Tcell", "Macrophage"),
projection_label = c("CD4+", "CD19+", "CD8+", "Mono"),
sample_name = rep("sample1", 4)
)
# Reference cell types
ref_labels <- c("Tcell", "Bcell", "Macrophage", "Neutrophil")
# Generate plot
sankey_plot(
predict_result = predict_df,
sample_information_reference = ref_labels,
plot = TRUE
)
# Get augmented results without plotting
augmented_results <- sankey_plot(
predict_result = predict_df,
sample_information_reference = ref_labels
)
} # }