#' Plot the distribution of the raw signal intensity (raw counts) on each plate
#'
#' This function generates a box plot to show the raw signal distribution on each plate.
#'
#' @param screenData a data frame containing screen date generated by readScreen() function
#' @param topN an integer value or NULL, indicating how many plates should be included in the plot If NULL, all the plates are included
#' @param ifLog10 a logical value, whether to perform log10 transformation
#' @import dplyr ggplot2
#' @return a ggplot object
#' @export
#' @examples
#' # load processed data
#' data('screenData')
#'
#' # plot the raw ATP counts on all plates
#' plotRawCount(screenData)
#' # Please see the vignette for more information.
plotRawCount <- function(screenData, topN = NULL, ifLog10 = FALSE) {
# only plot top N plate or all plate?
if (!is.null(topN)) {
allNames <- unique(screenData$fileName)
plotTab <- dplyr::filter(screenData, fileName %in% allNames[seq_len(min(length(allNames),
topN))])
} else {
plotTab <- screenData
}
if (ifLog10) {
plotTab <- dplyr::mutate(plotTab, value = log10(value))
}
plotTab <- dplyr::mutate(plotTab, fileName = factor(fileName, levels = rev(unique(fileName))))
g <- ggplot(plotTab, aes(x = fileName, y = value)) +
geom_jitter(width = 0.3, alpha = 0.3,color = "grey50") +
geom_boxplot(fill = NA, color = "royalblue2", outlier.shape = NA) +
coord_flip() + theme_bw() + xlab("file names") +
ylab(ifelse(ifLog10, "log10 (raw counts)", "raw counts"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.