Adjust expression values to account for known batch effects or technological covariates.

adjustGiottoMatrix(
  gobject,
  spat_unit = NULL,
  feat_type = NULL,
  expression_values = c("normalized", "scaled", "custom"),
  batch_columns = NULL,
  covariate_columns = NULL,
  return_gobject = TRUE,
  update_slot = c("custom")
)

Arguments

gobject

giotto object

spat_unit

spatial unit (e.g. "cell")

feat_type

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

expression_values

expression values to use

batch_columns

metadata columns that represent different batch (max = 2)

covariate_columns

metadata columns that represent covariates to regress out

return_gobject

boolean: return giotto object (default = TRUE)

update_slot

expression slot that will be updated (default = custom)

Value

giotto object or exprObj

Details

This function implements the removeBatchEffect function to remove known batch effects and to adjust expression values according to provided covariates.

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
#> cell_spatInfo_spatVector.shp
#> cell
#> 
#> 3.2 read Giotto spatial centroid information
#> cell
#> 
#> 3.3 read Giotto spatial overlap information
#> No overlaps were found, overlap loading will be
#>  skipped
#> 
#> 4. read Giotto image information
#> a giotto python environment was found
#> Using python path:
#>  "/Users/yuanlab/Library/r-miniconda/envs/giotto_env/bin/pythonw"

adjustGiottoMatrix(g, covariate_columns = "leiden_clus")
#> An object of class giotto 
#> >Active spat_unit:  cell 
#> >Active feat_type:  rna 
#> [SUBCELLULAR INFO]
#> polygons      : cell 
#> [AGGREGATE INFO]
#> expression -----------------------
#>   [cell][rna] raw normalized scaled custom
#> 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