pca_plot: Quickly plot a PCA plot

Description Usage Arguments Details Value Examples

View source: R/quick_plots.R

Description

'pca_plot()' plots the first two PC in a scatterplot.

Usage

1
pca_plot(voom_data, metadata, ...)

Arguments

voom_data,

voom object

metadata

cleaned metadata for RNAseq data

...

arguments to aes

Details

Like any other ggplot object, you can customize the theme of the plot. Note that this function generates a fairly generic PCA plot, and thus is intended for quick exploratory purposes (much like the intention behind 'qplot()').

Value

a scatterplot of the first two PC (ggplot object)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# As an EDA step within a pipeline of functions

counts <- readr::read_delim("data/GSE60450_Lactation-GenewiseCounts.txt", delim = "\t")
meta <- readr::read_delim("data/SampleInfo_Corrected.txt", delim = "\t") %>%
  mutate(FileName = stringr::str_replace(FileName, "\\.", "-"))

id <- as.character(counts$EntrezGeneID)
my_design <- check_sample_names(counts, c(1,2), meta, FileName) %>%
  purrr::pluck("meta") %>%
  make_design_matrix(., c("Status"))

check_sample_names(counts, c(1,2), meta, FileName) %>%
  purrr::pluck("mod_count") %>%
  filter_genes(., id, "edgeR") %>%
  make_voom(., my_design) %T>%
  {print(pca_plot(., check_sample_names(counts, c(1,2), meta, FileName) %>%
    purrr::pluck("meta")))} %>%
  model_limma() %>%
  make_contrasts(design_matrix = my_design, Statuspregnant, Statusvirgin) %>%
  model_bayes()
prcomp_obj, result from prcomp()
index, which PCA you want

latlio/tidyde documentation built on Dec. 21, 2021, 9:40 a.m.