R/plotLadderDensity.R

Defines functions .plotLadderDensity plotLadderDensity

.plotLadderDensity <- function(count, copy, xl, yl, title)
{
    data <- data.frame(Count=count, Copy=copy)
    p <- ggplot(data[data$Count>5,], aes(Count,color=as.factor(Copy), fill=as.factor(Copy))) +
             scale_color_manual(values=c("1"="#DF3416","2"="#FFCF22","4"="#009239","8"="#6F9CD0")) +
             scale_fill_manual(values=c("1"="#D8574A","2"="#FCDA4F","4"="#36AB52","8"="#A5C1DF")) +
             geom_density(alpha=0.5) + labs(x=xl, y=yl) + ggtitle(title) +
             theme_bw() + theme(legend.position="none")
    print(p <- .transformPlot(p))
    p
}

plotLadderDensity <- function(count, copy, xl="K-mer Count", yl="Density", title="Ladder Density")
{
    tryCatch({ .plotLadderDensity(count, copy, xl, yl, title) }, error=function(x) { print(x); emptyPlot(xl, yl, title) })
}
sequinstandards/RAnaquin documentation built on Aug. 9, 2019, 2:46 p.m.