Create a CellGraph object
CreateCellGraphObject.Rd
Create a CellGraph object
Arguments
- cellgraph
A
tbl_graph
object representing an mpx single-cell graph- counts
A
dgCMatrix
with marker counts- layout
A
tbl_df
object with cell layout(s)- verbose
Print messages
Examples
library(pixelatorR)
library(dplyr)
library(tidygraph)
edge_list <-
ReadMPX_item(
system.file("extdata/five_cells",
"five_cells.pxl",
package = "pixelatorR"),
items = "edgelist"
)
#> ℹ Loading item(s) from: /private/var/folders/gw/bdcqhnvs0m9gs_mq8n51jtbc0000gn/T/RtmpMJapOH/temp_libpatha88241f348a/pixelatorR/extdata/five_cells/five_cells.pxl
#> → Loading edgelist data
#> ✔ Returning a 'tbl_df' object
bipart_graph <-
edge_list %>%
select(upia, upib, marker) %>%
distinct() %>%
as_tbl_graph(directed = FALSE) %>%
mutate(node_type = case_when(name %in% edge_list$upia ~ "A", TRUE ~ "B"))
attr(bipart_graph, "type") <- "bipartite"
cg <- CreateCellGraphObject(cellgraph = bipart_graph)
cg
#> A CellGraph object containing a bipartite graph with 16800 nodes and 68255 edges