knitr::opts_chunk$set(error = TRUE)
# install.packages("devtools") # devtools::install_github("PhilPalmer/AutoPlate", dependencies = TRUE) library(autoplate)
platelist_file <- "pmn_platelist.csv" assay_df <- utils::read.csv(platelist_file, header = TRUE, stringsAsFactors = FALSE, check.names = FALSE) # Fix column types assay_df <- update_col_types(assay_df, example_data_column_descriptions) init_title(assay_df, full_title = TRUE)
knitr::kable(head(assay_df, 3))
paste0("Rows: ", dim(assay_df)[1], ", Columns: ", dim(assay_df)[2])
data <- dplyr::filter(assay_df, exclude == FALSE) paste0("Rows: ", dim(data)[1], ", Columns: ", dim(data)[2])
dim(assay_df)[1] - dim(data)[1]
av_lum_df <- init_av_lum_df(assay_df) knitr::kable(av_lum_df)
features <- c("Types", "Sample ID", "Dilution", "Virus", "RLU", "Neutralisation", "Treatment", "Experiment ID", "Bleed", "Exclude") plates <- sort(unique(assay_df$plate_number)) for (feature in features) { for (plate in plates) { plot_heatmap(plate, assay_df, gsub(" ", "_", tolower(feature), fixed = TRUE), feature) } }
# Preprocessing boxplot_data <- data %>% dplyr::mutate(types = ifelse((types == "c"), "cell", types)) %>% dplyr::mutate(types = ifelse((types == "m"), "monoclonal antibody", types)) %>% dplyr::mutate(types = ifelse((types == "v"), "virus", types)) %>% dplyr::mutate(types = ifelse((types == "x"), "serum sample", types)) boxplot_data$plate_number <- as.factor(boxplot_data$plate_number) # Generate plot types_boxplot <- init_types_boxplot(boxplot_data) plotly::ggplotly(types_boxplot) %>% plotly::layout(boxmode = "group")
# Preprocessing data <- dplyr::filter(data, types %in% c("x", "m")) # Generate plot data_exploration_plot <- plot_data_exploration(data) suppressWarnings(plotly::ggplotly(data_exploration_plot))
drm_model <- params$drm_model drm_model
# Produce a seperate plot for each virus htmltools::tagList(lapply(unique(data$virus), function(virus_to_plot) { # Preprocessing data <- dplyr::filter(assay_df, types %in% c("x", "m"), exclude == FALSE, virus == virus_to_plot) model <- eval(parse(text = paste("drc::drm(", drm_model, ")"))) # Generate plot drc_plot <- plot_drc(data, model) suppressWarnings(plotly::ggplotly(drc_plot)) }))
# Generate ied tables and ic50 boxplots ic50_boxplots <- htmltools::tagList() for (virus_to_plot in unique(data$virus)) { # Preprocessing data <- dplyr::filter(assay_df, types %in% c("x", "m"), exclude == FALSE, virus == virus_to_plot) model <- eval(parse(text = paste("drc::drm(", drm_model, ")"))) # Generate plot suppressWarnings(ic50 <- plot_ic50_boxplot(data, model)) ic50_boxplots[[virus_to_plot]] <- plotly::ggplotly(ic50$ic50_boxplot) print(knitr::kable(ic50$ied)) }
ic50_boxplots
# Preprocessing boxplot_data <- dplyr::filter(boxplot_data, types %in% c("cell", "virus")) # Generate plot cv_boxplot <- plot_cv_boxplot(boxplot_data) suppressWarnings(plotly::ggplotly(cv_boxplot) %>% plotly::layout(boxmode = "group"))
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.