plot_reduction.Rd
Dimensionality reduction using PCA.
plot_reduction( experiment, samples = "all", data_type = c("tss", "tsr", "tss_features", "tsr_features"), use_normalized = TRUE, remove_var = NULL, center = TRUE, scale = TRUE, ... )
experiment | TSRexploreR object. |
---|---|
samples | A vector of sample names to analyze. |
data_type | Whether to analyze TSSs ('tss') or TSRs ('tsr'). |
use_normalized | Whether to use the normalized (TRUE) or raw (FALSE) counts. |
remove_var | Remove features in this bottom fraction. |
center | Center the data (TRUE). |
scale | Scale the data (TRUE). |
... | Additional arguments passed to PCAtools::biplot. |
ggplot2 object of PCA plot.
This function will generatete a PCA plot of the first two PCs. This helps to visualize the relative similarity of samples based on the most variable features.
'remove_var' removes features in the bottom fraction of variance. 'center' and 'scale' will center and scale the data, respectively.
data(TSSs) samples <- data.frame( sample_name=sprintf("S288C_D_%s", seq_len(2)), file_1=NA, file_2=NA, condition="Diamide" ) exp <- TSSs[seq_len(2)] %>% tsr_explorer(sample_sheet=samples) %>% format_counts(data_type="tss") %>% normalize_counts(method="CPM") p <- plot_reduction(exp, data_type="tss")