Nothing
library(dplyr) library(ggplot2) knitr::opts_chunk$set(collapse = TRUE, comment = "#>", width = 68)
knitr::opts_chunk$set(echo = FALSE) rslts = nrow(params$kinetics) > 0 params$prev_plot
str = params$method_params %>% strsplit("\n") %>% unlist for (i in 1:length(str)){ if(length(grep("^Fitting", str[i])) ==1) { break }else{cat(str[i])} cat("\n") }
df = params$kinetics ids = params$ids if(!is.null(ids)){ for(i in ids){ df <- rbind(df, NA) df$ID[nrow(df)] = i df$FittingQ[nrow(df)] = "Failed" } }
par(mar = c(4, 4, .2, .1)) df <- df %>% mutate( Samples = case_when( FittingQ == "Failed" ~ "Unsuccessful fitting", FittingQ == "Warning" ~ "Successful fitting with warnings", TRUE ~ "Successful fitting" ) ) Type <- df %>% group_by(Samples) %>% summarize(Counts = n()) df = merge(df, Type, by ="Samples", all.x = TRUE) Type = c("Successful fitting", "Successful fitting with warnings", "Unsuccessful fitting") if(any(!Type %in% unique(df$Samples))){ Type = Type[!Type %in% unique(df$Samples)] df = bind_rows(df, data.frame(Samples = Type, Counts = 0)) } ggplot(data = df, aes(Samples, fill = Samples)) + geom_bar(col = "#64686A") + theme_minimal() + scale_fill_manual(values = c("Successful fitting" = "#D1E288", "Successful fitting with warnings" = "#E8A5A3", "Unsuccessful fitting" = "#F0F0F0")) + geom_text(data = df, aes(Samples, Counts, label = Counts), nudge_y = 31) + theme(legend.position = "none") + ggtitle("Fitting quality") df = df[!is.na(df$ID),] df = df %>% mutate( binder = case_when( log10(KD) <= -15 ~ "below fM", log10(KD) <= -12 ~ "fM", log10(KD) <= -9 ~ "pM", log10(KD) <= -6 ~ "nM", log10(KD) <= -3 ~ "uM", is.na(KD) | KD <= 0 ~ "no KD", TRUE ~ "other") ) Counts_df <- df %>% group_by(binder) %>% count() %>% mutate(ypos = cumsum(n)- 0.5*n ) df = merge(df, Counts_df, by = "binder", all.x = TRUE) df$label <- paste0(df$binder, ": ", df$n) ggplot(df, aes(binder,fill=label)) + ggtitle("Value of binding affinity") + geom_bar(width=1, col = "white") + theme_void() + theme(legend.title = element_blank()) + labs(x = NULL, y = NULL) + coord_polar("y", start=0) + scale_fill_manual(values = c("#A2C510", "#C61E19", "#99CFE9", "#FBB800", "#958BB2","#F08000", "#6696B9"))
params$fit_data %>% ggplot(aes(x = Time)) + geom_point(aes(y = Response, col = Name)) + geom_path(aes(y = fit)) + theme_light() + facet_wrap(~Name, ncol = length(unique(params$fit_data$Name))) + scale_color_manual(values = c( "#A2C510", "#C61E19", "#99CFE9", "#FBB800", "#958BB2", "#F08000", "#6696B9", "#B2B4B5", "#6B7B88", "#5C9B5B" ))
Check the pdf file for more compehensive output
print("!!! Sample(s) could not be fitted !!!")
df = openxlsx::read.xlsx("./tbls/glossary_sca.xlsx") df
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.