identify significant principal components (PCs) using an screeplot (a.k.a. elbowplot)

screePlot(
  gobject,
  spat_unit = NULL,
  feat_type = NULL,
  name = NULL,
  expression_values = c("normalized", "scaled", "custom"),
  reduction = c("cells", "feats"),
  method = c("irlba", "exact", "random", "factominer"),
  rev = FALSE,
  feats_to_use = NULL,
  center = FALSE,
  scale_unit = FALSE,
  ncp = 100,
  ylim = c(0, 20),
  verbose = TRUE,
  show_plot = NULL,
  return_plot = NULL,
  save_plot = NULL,
  save_param = list(),
  default_save_name = "screePlot",
  ...
)

Arguments

gobject

giotto object

spat_unit

spatial unit (e.g. "cell")

feat_type

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

name

name of PCA object if available

expression_values

expression values to use

reduction

cells or features

method

which implementation to use

rev

do a reverse PCA

feats_to_use

subset of features to use for PCA

center

center data before PCA

scale_unit

scale features before PCA

ncp

numeric. max number of principal components to plot

ylim

numeric. y-axis limits on scree plot

verbose

be verbose

show_plot

logical. show plot

return_plot

logical. return ggplot object

save_plot

logical. save the plot

save_param

list of saving parameters, see showSaveParameters

default_save_name

default save name for saving, don't change, change save_name in save_param

...

additional arguments to pca function, see runPCA

Value

ggplot object for scree method

Details

Screeplot works by plotting the explained variance of each individual PC in a barplot allowing you to identify which PC provides a significant contribution (a.k.a 'elbow method').
Screeplot will use an available pca object, based on the parameter 'name', or it will create it if it's not available (see runPCA)

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"

screePlot(g)
#> PCA with name: pca already exists and will be used for the screeplot