Skip to contents

Get a NN-network from a Giotto object

Usage

getNearestNetwork(
  gobject,
  spat_unit = NULL,
  feat_type = NULL,
  nn_type = NULL,
  name = NULL,
  output = c("nnNetObj", "igraph", "data.table"),
  set_defaults = TRUE
)

Arguments

gobject

giotto object

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

output

return a giotto nnNetObj, igraph, data.table object. Default 'nnNetObj'

set_defaults

set default spat_unit and feat_type. Change to FALSE only when expression and spat_info are not expected to exist.

Value

Giotto nnNetObj, igraph or data.table object

See also

Other expression space nearest network accessor functions: setNearestNetwork()

Other functions to get data from giotto object: getCellMetadata(), getDimReduction(), getExpression(), getFeatureInfo(), getFeatureMetadata(), getGiottoImage(), getMultiomics(), getPolygonInfo(), getSpatialEnrichment(), getSpatialGrid(), getSpatialLocations(), getSpatialNetwork(), get_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"

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"
#> An object of class nnNetObj : "sNN.pca"
#> --| Contains nearest neighbor network generated with: sNN 
#> ----| for feat_type: rna 
#> ----|     spat_unit: cell 
#> ----|     provenance: cell 
#> 
#> IGRAPH 999a381 DNW- 624 3748 -- 
#> + attr: name (v/c), weight (e/n), distance (e/n), shared (e/n), rank
#> | (e/n)
#> + edges from 999a381 (vertex names):
#>  [1] AAAGGGATGTAGCAAG-1->CAGTGTCCGCAGAATG-1
#>  [2] AAAGGGATGTAGCAAG-1->ACGTAGATTGCTGATG-1
#>  [3] AAAGGGATGTAGCAAG-1->CGTACCTGATAGGCCT-1
#>  [4] AAAGGGATGTAGCAAG-1->GATAAATCGGTGGATG-1
#>  [5] AAAGGGATGTAGCAAG-1->AACCCAGAGACGGAGA-1
#>  [6] AAAGGGATGTAGCAAG-1->GCCTTCAGCCCTACCG-1
#>  [7] AAATGGCATGTCTTGT-1->ACCCTTCATCTGCGAA-1
#> + ... omitted several edges
#> 
#>