knitr::opts_chunk$set(fig.cap = NULL, fig.path = params$output_figure)

library(knitr)
library(data.table)
library(ggplot2)
library(ggrepel)
library(GGally)
library(umap)
library(FactoMineR)
library(factoextra)
library(corrplot)
library(viridis)
library(ggpubr)
library(Hmisc)
library(plotly)
library(stringr)
library(bit64)
#assert that all the stuff we need is there. 
stopifnot(exists("expdes"))
stopifnot(exists("prot"))
stopifnot(exists("prot_int"))
expdes <- expdes[,c("condition", "experiment", "reporter_channel", "replicate")]
# ignore fractions for now.

dt <- copy(prot_int[Imputed == 0])

dt[is.na(condition), condition := "Library"]

#if (dt[, any(fraction > 0)]) {
#dt <- dt[, .N, by = .(condition, Replicate, fraction)]
#dt[, Run := str_c(condition, Replicate, fraction, sep = " - ")]
#
#} else {
dt <- dt[, .N, by = .(condition, replicate)]
dt[, Run := str_c(condition, replicate, sep = " - ")]
#}

p <- ggplot(dt, aes(x = as.factor(Run), y = N, color = condition, label=replicate)) +
  geom_segment( aes(x=as.factor(Run), xend=as.factor(Run), y=0, yend=N), color="skyblue") +
  geom_point(size=2, alpha=0.9) +
  coord_flip() +
  theme_minimal() +
  scale_x_discrete("Condtion + Replicate") +
  scale_y_continuous("# Protein Measurements") +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.2),
        panel.grid.major.y = element_blank(),
        panel.border = element_blank(),
        axis.ticks.y = element_blank()
  ) +
    ggtitle("Proteins - Number of identifications from proteinGroups.txt")

ggplotly(p, tooltip = c("label", "y")) %>% config(displayModeBar = T, 
                                                  modeBarButtons = list(list('toImage')),
                                                  displaylogo = F)


MassDynamics/lfq_processing documentation built on May 4, 2023, 11:20 p.m.