Export a spatial graph to a JSON file
export_graph.Rd
Utility function to prepare data for CutSpatialNetwork
.
The exported JSON file should be exported to the same directory as
the H&E image tiles generated with TileImage
Examples
library(semla)
se_mbrain <- readRDS(system.file("extdata/mousebrain", "se_mbrain", package = "semla"))
# Export graph as a JSON file to a temporary directory
export_graph(se_mbrain, sampleID = 1L, outdir = tempdir())
#> ℹ Creating spatial network for sample 1
#> ℹ Creating adjacency matrix from spatial network
#> ℹ Rearranging 2559x2559 adjacency matrix
#> ℹ Removing duplicated edges
#> ℹ Creating tidy graph object
#> ℹ Adding node attributes
#> ℹ Adding edge attributes
#> ℹ Exporting spatial network to /var/folders/8r/bfm2m_q17znfk0m_8dt330tm0000gp/T//RtmpRVvGCP/network_Visium_1.json
#> ✔ Finished!