Skip to contents

Function to get a dimension reduction object

Usage

getDimReduction(
  gobject,
  spat_unit = NULL,
  feat_type = NULL,
  reduction = c("cells", "feats"),
  reduction_method = c("pca", "umap", "tsne"),
  name = "pca",
  output = c("dimObj", "matrix"),
  set_defaults = TRUE
)

Arguments

gobject

giotto object

spat_unit

spatial unit (e.g. "cell")

feat_type

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

reduction

reduction on cells or features (e.g. "cells", "feats")

reduction_method

reduction method (e.g. "pca", "umap", "tsne")

name

name of reduction results

output

object type to return as. Either 'dimObj' (default) or 'matrix' of the embedding coordinates.

set_defaults

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

Value

dim reduction object (default) or dim reduction coordinates

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"

getDimReduction(g)
#> An object of class dimObj : "pca"
#> --| Contains dimension reduction generated with: pca 
#> ----| for feat_type: rna 
#> ----|     spat_unit: cell 
#> 
#>    100 dimensions for 624 data points
#> 
#> Additional included info:
#> [1] "eigenvalues" "loadings"   
#>