calc_pca() function performs principal components analysis of the gene count
vectors across all samples.
autoplot() method then can visualize the results.
calc_pca(object, assay_name = "counts", n_top = NULL)
PCA should be performed after filtering out low quality genes and samples, as well as normalization of counts.
In addition, genes with constant counts across all samples are excluded from
the analysis internally in
calc_pca(). Centering and scaling is also applied internally.
Plots can be obtained with the
with the corresponding method from the
ggfortify package to plot the
results of a principal components analysis saved in a
ggfortify::autoplot.prcomp() for details.
A HermesDataPca object which is an extension of the stats::prcomp class.
Afterwards correlations between principal components
and sample variables can be calculated, see
object <- hermes_data %>% add_quality_flags() %>% filter() %>% normalize() result <- calc_pca(object, assay_name = "tpm") summary(result) result1 <- calc_pca(object, assay_name = "tpm", n_top = 500) summary(result1) # Plot the results. autoplot(result) autoplot(result, x = 2, y = 3) autoplot(result, variance_percentage = FALSE) autoplot(result, label = TRUE, label.repel = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.