#' Plot transcript count vs. length
#'
#' Plots the number of reads vs. transcript width for capped, uncapped, and total libraries.
#'
#' @param dat a data.table containing results of a CoPRO experiment
#'
#' @return a ggplot object
#' @export
plotCountVsLength <- function(dat) {
lens <- dat[, list(sumC = sum(C), sumU = sum(U), sumR = as.numeric(sum(R))) , by = "width"]
toPlot <- melt(lens, id.vars = "width", measure.vars = c("sumC", "sumU", "sumR"), variable.name = "status", value.name = "count")
a <- ggplot(data = toPlot, mapping = aes(x = width, y = count, col = status)) + geom_line(lwd = 1.2)
return(a)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.