plot_reduction: Dimensionality Reduction.

View source: R/dim_reduction.R

plot_reductionR Documentation

Dimensionality Reduction.

Description

Dimensionality reduction using PCA.

Usage

plot_reduction(
  experiment,
  samples = "all",
  data_type = c("tss", "tsr", "tss_features", "tsr_features"),
  use_normalized = TRUE,
  remove_var = NULL,
  center = TRUE,
  scale = TRUE,
  ...
)

Arguments

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.

Details

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.

Value

ggplot2 object of PCA plot.

Examples

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")


zentnerlab/TSRexploreR documentation built on Dec. 30, 2022, 10:27 p.m.