#'Number of MS2 spectra aquired (read from MaxQuant summary.txt)
#'
#'@description Reads MaxQuant summary.txt output file and plots the number of
#' MS2 spectra aquired. Use the `add_groups` function first to add groups based
#' on the experiment name, and color the different raw files based on the groups.
#'
#'@param x The processed summary.txt output file
#'@param grouping Default value is FALSE. If set to true, the different experiments
#' will be colored based on the `my_groups` column. Use \code{\link{add_groups}} function
#' to define the groups based on experiment names.
#'
#'@export
MQ_summary_MS2_spectra <- function(x, grouping = FALSE){
if (grouping == TRUE) {
p <- ggplot(x, aes(Experiment, MS.MS , fill = my_groups))
} else {
p <- ggplot(x, aes(Experiment, MS.MS))
}
p <- p + geom_bar(stat = "identity", position = "dodge")
p <- p + theme_bw()
p <- p + xlab("Sample")
p <- p + ylab("Number of MS2 spectra")
p <- p + ggtitle("Number of MS2 spectra aquired per experiment.")
p <- p + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1))
p <- p + theme(legend.position = "bottom")
p <- p + theme(legend.key.size = unit(0.2, "cm"))
p <- p + theme(legend.text = element_text(size = 8))
print(p)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.