Skip to contents

Set polygon information into Giotto object

Usage

setPolygonInfo(
  gobject,
  x,
  name = "cell",
  centroids_to_spatlocs = FALSE,
  verbose = TRUE,
  initialize = TRUE,
  ...
)

Arguments

gobject

giotto object

x

single object or named list of objects to set as polygon information (see details)

name

(optional, character) name to assign to polygon and spatial unit that polygon might define. Only used for single giottoPolygon objects. Names are taken from a named list for multiple polygons.

centroids_to_spatlocs

if centroid information is discovered, whether to additionally set them as a set of spatial locations (default = FALSE)

verbose

be verbose

initialize

(default = FALSE) whether to initialize the gobject before returning

...

additional params to pass

Value

giotto object

Details

Inputs can be provided as either single objects or named lists of objects. If the list is not named, then a generic name of the template 'cell_i' will be applied.
If an input is a character string, then it is assumed that it is a filepath.
For required formatting when reading tabular data or objects, see createGiottoPolygonsFromDfr details.

See also

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"
polyinfo <- getPolygonInfo(g, return_giottoPolygon = TRUE)

setPolygonInfo(gobject = g, x = polyinfo)
#> > " z0 " already exists and will be replaced
#>  with new giotto polygon
#> Setting polygon info [z0]
#> An object of class giotto 
#> >Active spat_unit:  z0 
#> >Active feat_type:  rna 
#> dimensions    : 337, 498 (features, cells)
#> [SUBCELLULAR INFO]
#> polygons      : z0 z1 aggregate 
#> features      : rna 
#> [AGGREGATE INFO]
#> expression -----------------------
#>   [z0][rna] raw
#>   [z1][rna] raw
#>   [aggregate][rna] raw normalized scaled pearson
#> spatial locations ----------------
#>   [z0] raw
#>   [z1] raw
#>   [aggregate] raw
#> spatial networks -----------------
#>   [aggregate] Delaunay_network kNN_network
#> spatial enrichments --------------
#>   [aggregate][rna] cluster_metagene
#> dim reduction --------------------
#>   [aggregate][rna] pca umap tsne
#> nearest neighbor networks --------
#>   [aggregate][rna] sNN.pca
#> attached images ------------------
#> images      : 4 items...
#> 
#> 
#> Use objHistory() to see steps and params used