Skip to contents

Plot a 3D component graph layout computed with ComputeLayout and color nodes by a marker.

Usage

Plot3DGraph(
  object,
  cell_id,
  marker = NULL,
  assay = NULL,
  layout_method = c("wpmds_3d", "pmds_3d"),
  project = FALSE,
  aspectmode = c("data", "cube"),
  colors = c("lightgrey", "mistyrose", "red", "darkred"),
  showgrid = TRUE,
  log_scale = TRUE,
  node_size = 2,
  show_Bnodes = FALSE,
  ...
)

Arguments

object

A Seurat object

cell_id

ID of component to visualize

marker

Name of marker to color the nodes by

assay

Name of assay to pull data from

layout_method

Select appropriate layout previously computed with ComputeLayout

project

Project the nodes onto a sphere. Default FALSE

aspectmode

Set aspect ratio to one of "data" or "cube". If "cube", this scene's axes are drawn as a cube, regardless of the axes' ranges. If "data", this scene's axes are drawn in proportion with the axes' ranges.

Default "data"

colors

Color the nodes expressing a marker. Must be a character vector with at least two color names.

showgrid

Show the grid lines. Default TRUE

log_scale

Convert node counts to log-scale with logp

node_size

Size of nodes

show_Bnodes

Should B nodes be included in the visualization? This option is only applicable to bipartite graphs.

...

Additional parameters passed to plot_ly

Value

A interactive 3D plot of a component graph layout as a plotly object

Examples

library(pixelatorR)

# MPX
pxl_file <- minimal_mpx_pxl_file()
seur <- ReadMPX_Seurat(pxl_file)
#>  Created a 'Seurat' object with 5 cells and 80 targeted surface proteins
seur <- LoadCellGraphs(seur, cells = colnames(seur)[5])
#> →    Loading CellGraphs for 1 cells from sample 1
#>  Successfully loaded 1 CellGraph object(s).
seur <- ComputeLayout(seur, layout_method = "wpmds", dim = 3, pivots = 50)
#>  Computing layouts for 1 graphs
Plot3DGraph(seur, cell_id = colnames(seur)[5], marker = "CD50", layout_method = "wpmds_3d")
# PNA pxl_file <- minimal_pna_pxl_file() seur <- ReadPNA_Seurat(pxl_file) #> Created a <Seurat> object with 5 cells and 158 targeted surface proteins seur <- LoadCellGraphs(seur, cells = colnames(seur)[1], add_layouts = TRUE) #> Fetching edgelists for 1 cells #> → Creating <CellGraph> objects #> → Fetching marker counts #> → Adding marker counts to <CellGraph> object(s) #> → Fetching layouts #> → Adding layouts to <CellGraph> object(s) #> Successfully loaded 1 <CellGraph> object(s). Plot3DGraph(seur, cell_id = colnames(seur)[1], marker = "CD16", layout_method = "wpmds_3d")