knitr::opts_chunk$set(fig.cap = NULL, fig.path = params$output_figure) 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) num_files <- expdes[, .N] run_per_condition <- expdes[, .(countRepMax = .N), by = .(experiment)] setnames(run_per_condition, "experiment", "condition") # for fractions, create file name from mqExperiment and Fraction if (!("file_name" %in% colnames(expdes))){ expdes$file_name = paste(expdes$experiment, " - ", expdes$Replicate) } # pep/mod pep mod_pept_int_rep <- merge( run_per_condition, mod_pept_int[Imputed == 0, .(Repcount = .N), by = .(id, condition)], by = c("condition") ) mod_pept_int_rep[, repPC := Repcount/countRepMax] mod_pept_id_in_a_cond <- mod_pept_int_rep[repPC >= 0.5, unique(id)] mod_pept_int[, Valid := 0L] mod_pept_int[id %in% mod_pept_id_in_a_cond, Valid := 1L] rm(mod_pept_id_in_a_cond, mod_pept_int_rep) pept_int_rep <- merge( run_per_condition, pept_int[Imputed == 0, .(Repcount = .N), by = .(id, condition)], by = c("condition") ) pept_int_rep[, repPC := Repcount/countRepMax] pept_id_in_a_cond <- pept_int_rep[repPC >= 0.5, unique(id)] pept_int[, Valid := 0L] pept_int[id %in% pept_id_in_a_cond, Valid := 1L] rm(pept_id_in_a_cond, pept_int_rep) # proteins prot_int_rep <- merge( run_per_condition, prot_int[Imputed == 0, .(Repcount = .N), by = .(id, condition)], by = c("condition") ) prot_int_rep[, repPC := Repcount/countRepMax] prot_id_in_a_cond <- prot_int_rep[repPC >= 0.5, unique(id)] prot_int[, Valid := 0L] prot_int[id %in% prot_id_in_a_cond, Valid := 1L] rm(prot_id_in_a_cond, prot_int_rep)
cvdt <- mod_pept_int[Imputed == 0][, countRep := .N, by = .(id, condition)] cvdt[, countRepMax := max(countRep), by = .(id, condition)] cvdt[, ReplicatePC := countRep/countRepMax] cvdt[, intensity := as.double(intensity)] cvdt <- cvdt[ReplicatePC >= 0.5, .(cv = sd(intensity)/mean(intensity)), by = .(id, condition)] p <- ggplot(cvdt, aes(x=cv, fill=condition, colour=condition)) + geom_density(alpha=0.4) + theme_minimal() + scale_x_continuous("% CV", labels = scales::percent) + ggtitle("Modified Peptides - LFQ intensity CV") ggplotly(p) %>% config(displayModeBar = T, modeBarButtons = list(list('toImage')), displaylogo = F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.