Skip to contents

Set a NN-network for a Giotto object

Usage

setNearestNetwork(
  gobject,
  x,
  spat_unit = NULL,
  feat_type = NULL,
  nn_type = "sNN",
  name = "sNN.pca",
  provenance = NULL,
  verbose = TRUE,
  initialize = TRUE,
  ...
)

Arguments

gobject

giotto object

x

nnNetObj or list of nnNetObj. Passing NULL will remove a specified set of nearest neighbor network information from the gobject

spat_unit

spatial unit (e.g. "cell")

feat_type

feature type (e.g. "rna", "dna", "protein")

nn_type

"kNN" or "sNN"

name

name of NN network to be used yet supported.

provenance

provenance information (optional)

verbose

be verbose

initialize

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

...

additional params to pass

Value

giotto object

See also

Other expression space nearest network accessor functions: getNearestNetwork()

Other functions to set data in giotto object: setCellMetadata(), setDimReduction(), setExpression(), setFeatureInfo(), setFeatureMetadata(), setGiotto(), setGiottoImage(), setMultiomics(), 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"
dimred <- getNearestNetwork(gobject = g)
#> The NN network type was not specified, default to the
#>  first: "sNN"
#> The NN network name was not specified, default to the
#>  first: "sNN.pca"

setNearestNetwork(gobject = g, x = dimred)
#> > 'sNN.pca' already exists and will be replaced with
#>  new nearest neighbor network
#> Setting nearest neighbor network [cell][rna] sNN.pca
#> 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