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) }
dt <- copy(evidence) setnames(dt, "experiment", "condition") dt[is.na(condition), condition := "Library"] dt[condition == "Library" & is.na(Replicate), Replicate := .GRP, by = .(`raw file`)] if (!("fraction" %in% colnames(expdes))) { dt <- dt[, .(percent = .N), by = .(`missed cleavages`, condition, Replicate, fraction, `raw file`)] dt[, Run := str_c(condition, Replicate, fraction, sep = " - ")] xlabel = "Condition - Replicate - Fraction" } else { dt <- dt[, .(percent = .N), by = .(`missed cleavages`, condition, Replicate, `raw file`)] dt[, Run := str_c(condition, Replicate, sep = " - ")] xlabel = "Condition - Replicate" } dt[, `missed cleavages` := as.factor(`missed cleavages`)] p <- ggplot(dt, aes(x = Run, y = percent, fill=`missed cleavages`, label=Run)) + geom_bar(stat="identity", position=position_fill(reverse = TRUE)) + theme_minimal() + scale_y_continuous("% missed cleavages", labels = scales::percent) + 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() ) + scale_x_discrete(xlabel) + ggtitle("Digestion efficiency") if (all(is.na(dt$`missed cleavages`))) { cat("'missed cleavage' column is empty. Can't estimate digestion efficiency.") } else{ ggplotly(p, tooltip = c("x","y")) %>% 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.