pcaPlot | 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.
pcaPlot(
table,
path = NULL,
group = sub("_r[0-9]+$", "", colnames(table)),
replicate = sub(".*_r([0-9]+)$", "\\1", colnames(table)),
PCA_X = "PC1",
PCA_Y = "PC2",
title = "PCA analysis by CDS fpkm",
subtitle = paste("Numer of genes/regions:", nrow(table)),
plot.ext = ".pdf",
return.data = FALSE
)
table |
data.table, e.g. countTable(df, "cds", type = "fpkm"), a data.table of counts per column (default normalized fpkm values). |
path |
default NULL, else character path to file to save. File saved as "PCAplot_(experiment name)(plot.ext)" |
group |
character vector of equal size to nrow of dt,
|
replicate |
haracter vector of equal size to nrow of dt,
|
PCA_X |
name of priniciple component to use for x axis: valid options: PC1-PC6 |
PCA_Y |
name of priniciple component to use for y axis: valid options: PC1-PC6 |
title |
character, default "CDS fpkm". |
subtitle |
character, default: |
plot.ext |
character, default: ".pdf". Alternatives: ".png" or ".jpg". |
return.data |
logical, default FALSE. Return data instead of plot |
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
df <- df[df$libtype %in% c("RNA", "RFP"),]
table <- countTable(df, "cds", type = "fpkm")
pcaPlot(table)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.