
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
Arguments
- object
A
Seurat
object created withsemla
- sampleID
An integer specifying a sample ID to export spatial network for
- outdir
Name of a directory to export JSON file to
- verbose
Print messages
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/z8/nrcst881607gn95xh3_4qvb00000gp/T//RtmpKTcTU2/network_Visium_1.json
#> ✔ Finished!