Function to set a spatial location slot
Usage
setSpatialLocations(
gobject,
x,
spat_unit = NULL,
name = "raw",
provenance = NULL,
verbose = TRUE,
initialize = TRUE,
...
)
Arguments
- gobject
giotto object
- x
spatLocsObj or list of spatLocsObj. Passing NULL will remove a specified set of spatial locations data.
- spat_unit
spatial unit (e.g. "cell")
- name
name of spatial locations, default "raw"
- provenance
provenance information (optional)
- verbose
be verbose
- initialize
(default = FALSE) whether to initialize the gobject before returning
- ...
additional params to pass
Details
Spatial information will be set to the nested location described by their tagged spat_unit and name information. An alternative location can also be specified through the respective params in this function.
See also
Other spatial location data accessor functions:
getSpatialLocations()
Other functions to set data in giotto object:
setCellMetadata()
,
setDimReduction()
,
setExpression()
,
setFeatureInfo()
,
setFeatureMetadata()
,
setGiotto()
,
setGiottoImage()
,
setMultiomics()
,
setNearestNetwork()
,
setPolygonInfo()
,
setSpatialEnrichment()
,
setSpatialGrid()
,
setSpatialNetwork()
,
set_multiomics()
Examples
g <- GiottoData::loadGiottoMini("visium")
#> 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"
x <- getSpatialLocations(g, output = "data.table")
sl <- data.frame(cell_ID = x$cell_ID, sdimx = rnorm(624), sdimy = rnorm(624))
setSpatialLocations(gobject = g, x = createSpatLocsObj(sl, name = "raw"))
#> There are non numeric or integer columns for the spatial location
#> input at column position(s): 1
#> The first non-numeric column will be considered as a cell ID
#> to test for consistency with the expression matrix
#> Other non numeric columns will be removed
#> > raw already exists and will be replaced with new spatial
#> locations
#> Setting spatial locations [cell] raw
#> An object of class giotto
#> >Active spat_unit: cell
#> >Active feat_type: rna
#> dimensions : 634, 624 (features, cells)
#> [SUBCELLULAR INFO]
#> polygons : cell
#> [AGGREGATE INFO]
#> expression -----------------------
#> [cell][rna] raw normalized scaled
#> spatial locations ----------------
#> [cell] raw
#> spatial networks -----------------
#> [cell] Delaunay_network spatial_network
#> spatial enrichments --------------
#> [cell][rna] cluster_metagene DWLS
#> dim reduction --------------------
#> [cell][rna] pca custom_pca umap custom_umap tsne
#> nearest neighbor networks --------
#> [cell][rna] sNN.pca custom_NN
#> attached images ------------------
#> images : alignment image
#>
#>
#> Use objHistory() to see steps and params used