#' Plot TMT labeling efficiency
#'
#' \code{plot_labelingefficiency} generates a stacked barplot for peptides
#' modified by TMT at the N-termini and Lys residues.
#'
#' @param evidencedata Data.frame,
#' evidence table originating from MaxQuant.
#' @examples
#' if(interactive()){
#' data("evidence.raw")
#' evidencedata <- evidence.raw
#' plot_labelingefficiency(evidencedata)
#' }
#' @return A scatter plot (generated by \code{\link[ggplot2]{ggplot}})
#' @import dplyr
#' @import ggplot2
#' @export
plot_labelingefficiency <- function (evidencedata) {
plot<-
evidencedata %>%
count(Modifications) %>%
mutate(Modifications=case_when(
Modifications=="Unmodified"~"Unmodified",TRUE~"TMT Modified")) %>%
count(Modifications, wt=n ) %>%
mutate(freq = n / sum(n)) %>%
dplyr::mutate(g="Peptides") %>%
ggplot(aes(x = factor(g), y = freq*100, fill = factor(Modifications))) +
geom_bar(stat="identity", width = 0.7) +
labs(x = "", y = "Percentage (%)", fill = "Type") +
theme_minimal(base_size = 14)
return(plot)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.