Description Usage Arguments Details Examples
vic3_plotPCA
returns PCA plot for normalized counts output by DESeq2.
1 | vic3_plotPCA(counts, group_vector, ntop = 500, returnData = FALSE)
|
counts |
Counts table output |
group_vector |
Column name in DESeq2 |
ntop |
Numeric. Number of top genes with most variance. |
returnData |
Logical (default FALSE). Return PC1 and PC2 data.frame. |
The function works similarly to DESeq2 plotPCA
. It accepts count tables which could be accessed with assay
function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Load SE dataset
se <- readRDS(system.file("extdata", "se_vic3_2020.RData", package = "vic3PCD"))
## DESeq dataset
dds <- DESeqDataSet(se, design = ~ condition)
## DESeq analysis
dds <- DESeq(dds)
## Filter genes with more than 10 aligned reads
keep <- rowSums(counts(dds)) >= 10
dds <- dds[keep,]
## Normised counts
rld <- rlog(dds, blind = F)
## Manual color
clr = c("dodgerblue3", "coral3")
names(clr) <- unique(colData(rld)[,"condition"])
vic3_plotPCA(counts = assay(rld), group_vector = colData(rld)[,"condition"]) +
scale_colour_manual(values=clr, name = "Condition:") +
geom_text(label = colData(rld)[,"exset"], size = 3, colour = "black", fontface = "italic", hjust = 0, nudge_x = 3) +
xlim(-20,60) +
ylim(-25,25)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.