Function to get a spatial location data.table
Usage
getSpatialLocations(
gobject,
spat_unit = NULL,
name = NULL,
output = c("spatLocsObj", "data.table"),
copy_obj = TRUE,
verbose = TRUE,
set_defaults = TRUE,
simplify = TRUE
)
Arguments
- gobject
giotto object
- spat_unit
spatial unit (e.g. "cell")
- name
name of spatial locations (defaults to first name in spatial_locs slot, e.g. "raw")
- output
what object type to get the spatial locations as. Default is as a 'spatLocsObj'. Returning as 'data.table' is also possible.
- copy_obj
whether to copy/duplicate when getting the object (default = TRUE)
- verbose
be verbose
- set_defaults
set default spat_unit and feat_type. Change to FALSE only when expression and spat_info are not expected to exist.
- simplify
logical. Whether or not to take object out of a list when there is a length of 1.
See also
Other spatial location data accessor functions:
setSpatialLocations()
Other functions to get data from giotto object:
getCellMetadata()
,
getDimReduction()
,
getExpression()
,
getFeatureInfo()
,
getFeatureMetadata()
,
getGiottoImage()
,
getMultiomics()
,
getNearestNetwork()
,
getPolygonInfo()
,
getSpatialEnrichment()
,
getSpatialGrid()
,
getSpatialNetwork()
,
get_multiomics()
Examples
g <- GiottoData::loadGiottoMini("vizgen")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> python already initialized in this session
#> active environment : 'giotto_env'
#> python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/share/miniconda/envs/giotto_env/bin/python"
getSpatialLocations(g)
#> An object of class spatLocsObj : "raw"
#> spat_unit : "z0"
#> provenance: z0
#> dimensions: 498 3
#> preview :
#> sdimx sdimy cell_ID
#> <num> <num> <char>
#> 1: 6405.067 -4780.499 40951783403982682273285375368232495429
#> 2: 6426.020 -4972.519 240649020551054330404932383065726870513
#> 3: 6428.456 -4799.158 274176126496863898679934791272921588227
#>
#> ranges:
#> sdimx sdimy
#> [1,] 6402.438 -5146.726
#> [2,] 6899.203 -4700.157
#>