runPCA: runPCA

Description Usage Arguments Details Value Examples

View source: R/dimension_reduction.R

Description

runs a Principal Component Analysis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
runPCA(
  gobject,
  expression_values = c("normalized", "scaled", "custom"),
  reduction = c("cells", "genes"),
  name = "pca",
  genes_to_use = "hvg",
  return_gobject = TRUE,
  center = F,
  scale_unit = F,
  ncp = 100,
  method = c("irlba", "factominer"),
  rev = FALSE,
  verbose = TRUE,
  ...
)

Arguments

gobject

giotto object

expression_values

expression values to use

reduction

cells or genes

name

arbitrary name for PCA run

genes_to_use

subset of genes to use for PCA

return_gobject

boolean: return giotto object (default = TRUE)

center

center data first (default = FALSE)

scale_unit

scale features before PCA (default = FALSE)

ncp

number of principal components to calculate

method

which implementation to use

rev

do a reverse PCA

verbose

verbosity of the function

...

additional parameters for PCA (see details)

Details

See prcomp_irlba and PCA for more information about other parameters.

Value

giotto object with updated PCA dimension recuction

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 1. create giotto object
expr_path = system.file("extdata", "seqfish_field_expr.txt", package = 'Giotto')
loc_path = system.file("extdata", "seqfish_field_locs.txt", package = 'Giotto')
VC_small <- createGiottoObject(raw_exprs = expr_path, spatial_locs = loc_path)

# 2. normalize giotto
VC_small <- normalizeGiotto(gobject = VC_small, scalefactor = 6000)
VC_small <- addStatistics(gobject = VC_small)

# 3. dimension reduction
VC_small <- calculateHVG(gobject = VC_small)
VC_small <- runPCA(gobject = VC_small)
plotPCA(VC_small)

bernard2012/Giotto documentation built on Sept. 22, 2020, 10:29 a.m.