pcaExperiment {ORFik} | R Documentation |
Detect outlier libraries with PCA analysis. Will output PCA plot of PCA component 1 (x-axis) vs PCA component 2 (y-axis) for each library (colored by library), shape by replicate. Will be extended to allow batch correction in the future.
pcaExperiment( df, output.dir = NULL, table = countTable(df, "cds", type = "fpkm"), title = "PCA analysis by CDS fpkm", subtitle = paste("Numer of genes/regions:", nrow(table)), plot.ext = ".pdf", return.data = FALSE, color.by.group = TRUE )
df |
an ORFik |
output.dir |
default NULL, else character path to directory. File saved as "PCAplot_(experiment name)(plot.ext)" |
table |
data.table, default countTable(df, "cds", type = "fpkm"), a data.table of counts per column (default normalized fpkm values). |
title |
character, default "CDS fpkm". |
subtitle |
character, default: |
plot.ext |
character, default: ".pdf". Alternatives: ".png" or ".jpg". Note that in pdf format the complex correlation plots become very slow to load! |
return.data |
logical, default FALSE. Return data instead of plot |
color.by.group |
logical, default TRUE. Colors in PCA plot represent unique library groups, if FALSE. Color each sample in seperate color (harder to distinguish for > 10 samples) |
ggplot or invisible(NULL) if output.dir is defined or < 3 samples. Returns data.table with PCA analysis if return.data is TRUE.
df <- ORFik.template.experiment() # Select only Ribo-seq and RNA-seq pcaExperiment(df[df$libtype %in% c("RNA", "RFP"),])