graphViz {veloviz} | R Documentation

## Visualize as velocity informed force directed graph

### Description

Visualize as velocity informed force directed graph

### Usage

    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
    )

### Arguments

`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 `observed`
`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 `graph`, force-directed layout coordinates `fdg_coords`, and `projected_neighbors` object detailing composite distance values and components, default = FALSE
`plot` | if TRUE, plots graph and force-directed layout
`cell.colors` | cell.colors to use for plotting
`title` | title to use for plot

### Value

`graph` igraph object of VeloViz graph

`fdg_coords` cells (rows) x 2 coordinates of force-directed layout of VeloViz graph

`projectedNeighbors` output of `projectedNeighbors`

### See Also

`projectedNeighbors`

### Examples

    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)

[Package veloviz version 1.0.0 Index]