Include design_draw_libsize_qq()
to Hermes
by updating and replacing the draw_qq()
function from rnaseqTools
to use ggplot2
, use an HermesData
object as input.
In order to plot the sample against theoretical queantiles of library size in a QQ plot, we need to access the counts data in the HermesData
object.
#Creating the HermesData object from the example SummarizedExperiment object. result <- hermes_data #Accessing the counts data. counts(result) #Calculating the library depth per sample. colSums(counts(result)) # Check the class is_class(result, 'AnyHermesData') #Coercing the library depth into a data frame because ggplot requires a data frame object. df <- data.frame(libsize = colSums(counts(result))) #QQ Plot ggplot(df, aes(sample=libsize)) + stat_qq() + stat_qq_line() + theme_classic() + ggtitle("QQ plot of Library Sizes") + xlab("Theoretical Quantiles") + ylab("Sample Quantiles") + theme(plot.title = element_text(hjust = 0.5, face = "bold")) # design_draw_libsize_qq Function design_draw_libsize_qq <- function(object, ...) { assert_that( is_class(object, "AnyHermesData") ) df <- data.frame(libsize = colSums(counts(result))) ggplot(df, aes(sample=libsize)) + stat_qq() + stat_qq_line() + theme_classic() + ggtitle("QQ plot of Library Sizes") + xlab("Theoretical Quantiles") + ylab("Sample Quantiles") + theme(plot.title = element_text(hjust = 0.5, face = "bold")) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.