View source: R/projectedNeighbors.R
graphViz | R Documentation |
Visualize as velocity informed force directed graph
graphViz( observed, projected, k, distance_metric = "L2", similarity_metric = "cosine", distance_weight = 1, distance_threshold = 1, similarity_threshold = -1, weighted = TRUE, remove_unconnected = TRUE, return_graph = FALSE, plot = TRUE, cell.colors = NA, title = NA )
observed |
PCs (rows) x cells (columns) matrix of observed transcriptional state projected into PC space |
projected |
PCs (rows) x cells (columns) matrix of projected transcriptional states. Cell should be in same order as in |
k |
Number of nearest neighbors to assign each cell |
distance_metric |
Method to compute distance component of composite distance. "L1" or "L2", default = "L2" |
similarity_metric |
Method to compute similarity between velocity and cell transition matrices. "cosine" or "pearson", default = "cosine" |
distance_weight |
Weight of distance component of composite distance, default = 1 |
distance_threshold |
quantile threshold for distance component above which to remove edges, default = 1 i.e. no edges removed |
similarity_threshold |
similarity threshold below which to remove edges, default = -1 i.e. no edges removed |
weighted |
if TRUE, assigns edge weights based on composite distance, if FALSE assigns equal weights to all edges, default = TRUE |
remove_unconnected |
if TRUE, does not plot cells with no edges, default = TRUE |
return_graph |
if TRUE, returns igraph object |
plot |
if TRUE, plots graph and force-directed layout |
cell.colors |
cell.colors to use for plotting |
title |
title to use for plot |
graph
igraph object of VeloViz graph
fdg_coords
cells (rows) x 2 coordinates of force-directed layout of VeloViz graph
projectedNeighbors
output of projectedNeighbors
projectedNeighbors
data(vel) curr = vel$current proj = vel$projected m <- log10(curr+1) pca <- RSpectra::svds(A = Matrix::t(m), k=3, opts = list(center = FALSE, scale = FALSE, maxitr = 2000, tol = 1e-10)) pca.curr <- Matrix::t(m) %*% pca$v[,1:3] m <- log10(proj+1) pca.proj <- Matrix::t(m) %*% pca$v[,1:3] graphViz(t(pca.curr), t(pca.proj), k=10, cell.colors=NA, similarity_threshold=-1, distance_weight = 1, distance_threshold = 1, weighted = TRUE, remove_unconnected = TRUE, plot = FALSE, return_graph = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.