Skip to contents

Function to dimension reduction information into the Giotto object.

Usage

setDimReduction(
  gobject,
  x,
  spat_unit = NULL,
  feat_type = NULL,
  name = "pca",
  reduction = c("cells", "feats"),
  reduction_method = c("pca", "umap", "tsne"),
  provenance = NULL,
  verbose = TRUE,
  initialize = TRUE,
  ...
)

Arguments

gobject

giotto object

x

dimObj or list of dimObj to set. Passing NULL will remove a specified set of dimension reduction information from the gobject

spat_unit

spatial unit (e.g. "cell")

feat_type

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

name

name of reduction results

reduction

reduction on cells or features

reduction_method

reduction method (e.g. "pca")

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 dimensional reduction data accessor functions: getDimReduction()

Other functions to set data in giotto object: setCellMetadata(), 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"
dimred <- getDimReduction(g)

setDimReduction(gobject = g, x = dimred)
#> > pca already exists and will be replaced with
#>  new dimension reduction object
#> Setting dimension reduction [cell][rna] 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