pca_information: Gather information about principle components.

View source: R/dimension_reduction.R

pca_informationR Documentation

Gather information about principle components.

Description

Calculate some information useful for generating PCA plots. pca_information seeks to gather together interesting information to make principle component analyses easier, including: the results from (fast.)svd, a table of the r^2 values, a table of the variances in the data, coordinates used to make a pca plot for an arbitrarily large set of PCs, correlations and fstats between experimental factors and the PCs, and heatmaps describing these relationships. Finally, it will provide a plot showing how much of the variance is provided by the top-n genes and (optionally) the set of all PCA plots with respect to one another. (PCx vs. PCy)

Usage

pca_information(
  expt,
  expt_design = NULL,
  expt_factors = c("condition", "batch"),
  num_components = NULL,
  plot_pcas = FALSE,
  ...
)

Arguments

expt

Data to analyze (usually exprs(somedataset)).

expt_design

Dataframe describing the experimental design, containing columns with useful information like the conditions, batches, number of cells, whatever...

expt_factors

Character list of experimental conditions to query for R^2 against the fast.svd of the data.

num_components

Number of principle components to compare the design factors against. If left null, it will query the same number of components as factors asked for.

plot_pcas

Plot the set of PCA plots for every pair of PCs queried.

...

Extra arguments for the pca plotter

Value

a list of fun pca information: svd_u/d/v: The u/d/v parameters from fast.svd rsquared_table: A table of the rsquared values between each factor and principle component pca_variance: A table of the pca variances pca_data: Coordinates for a pca plot pca_cor: A table of the correlations between the factors and principle components anova_fstats: the sum of the residuals with the factor vs without (manually calculated) anova_f: The result from performing anova(withfactor, withoutfactor), the F slot anova_p: The p-value calculated from the anova() call anova_sums: The RSS value from the above anova() call cor_heatmap: A heatmap from recordPlot() describing pca_cor.

Warning

This function has gotten too damn big and needs to be split up.

See Also

[corpcor] [plot_pca()] [plot_pcs()] [stats::lm()]

Examples

## Not run: 
 pca_info = pca_information(exprs(some_expt), some_design, "all")
 pca_info

## End(Not run)

elsayed-lab/hpgltools documentation built on May 9, 2024, 5:02 a.m.