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/91/twz8ld_x3f98sr9yc2hq9xpn47blx2/T//Rtmp4vm41m/network_Visium_1.json
#> ✔ Finished!