Create an interactive PCA scatter plot using Plotly from log-expression data.
pcaPlottly(logcounts, Sample, Group, title, palette, center, scale)
A Plotly object ( "plotly::ggplotly ") representing the interactive PCA scatterplot.
Numeric matrix of log-CPM values (genes × samples), e.g., from edgeR::cpm.
Character vector of sample names corresponding to the columns of "logcounts ".
Factor or character vector denoting group/condition for each sample.
Character. Title for the PCA plot.
Character. Name of a discrete color palette from the "paletteer" package.
Logical. If TRUE, center variables (genes) before PCA.
Logical. If TRUE, scale variables to unit variance before PCA.
This function performs Principal Component Analysis (PCA) on a log-count matrix and generates an interactive plot of the first two principal components via "plotly::ggplotly()".
Transposes the "logcounts " matrix so samples are rows.
Runs PCA with "stats::prcomp() ", using centering and scaling as specified.
Computes percent variance explained by PC1 and PC2.
Builds a ggplot2 scatterplot and converts it to an interactive Plotly graph.