Function to set cell metadata into giotto object
Usage
setCellMetadata(
gobject,
x,
spat_unit = NULL,
feat_type = NULL,
provenance = NULL,
verbose = TRUE,
initialize = TRUE,
...
)
Arguments
- gobject
giotto object
- x
cellMetaObj or list of cellMetaObj to set. Passing NULL will reset a specified set of cell metadata in the giotto object.
- spat_unit
spatial unit (e.g. "cell")
- feat_type
feature type (e.g. "rna", "dna", "protein")
- provenance
provenance information (optional)
- verbose
be verbose
- initialize
(default = FALSE) whether to initialize the gobject before returning
- ...
additional params to pass
See also
Other functions to set data in giotto object:
setDimReduction()
,
setExpression()
,
setFeatureInfo()
,
setFeatureMetadata()
,
setGiotto()
,
setGiottoImage()
,
setMultiomics()
,
setNearestNetwork()
,
setPolygonInfo()
,
setSpatialEnrichment()
,
setSpatialGrid()
,
setSpatialLocations()
,
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"
m1 <- getCellMetadata(g, output = "data.table")
m2 <- data.frame(
cell_ID = m1$cell_ID,
new_column = sample(letters, 624, replace = TRUE)
)
setCellMetadata(gobject = g, x = createCellMetaObj(m2))
#> > Cell metadata for spat_unit " cell " and feat_type " rna " already exists and
#> will be replaced with new metadata.
#> Setting cell metadata [cell][rna]
#> 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