Skip to content

Instantly share code, notes, and snippets.

@padpadpadpad
Created December 5, 2024 10:53
Show Gist options
  • Save padpadpadpad/a41ce6226e4c7e2f6be31485af987f63 to your computer and use it in GitHub Desktop.
Save padpadpadpad/a41ce6226e4c7e2f6be31485af987f63 to your computer and use it in GitHub Desktop.
# ---------------------------
# Purpose of script: To calculate volumes of media and inoculum to pipette into wells for an inoculum plate.
#
# What this script does:
# 1. Takes in readings of OD.
# 2. Calculates volume of media and inoculum needed for each well
# 3. Saves this out as a csv
#
# Author: Dr. Daniel Padfield
#
# Date Created: 2024-12-05
#
# Copyright (c) Daniel Padfield, 2024
# This code is licensed under a modified MIT non-AI license. The code and any modifications made to it may not be used for the purpose of training or improving machine learning algorithms, including but not limited to artificial intelligence, natural language processing, or data mining. This condition applies to any derivatives, modifications, or updates based on the Software code. Any usage of the Software in an AI-training dataset is considered a breach of this License.
# The full license can be found here: https://github.com/padpadpadpad/non-ai-licenses/blob/main/NON-AI-MIT
#
# ---------------------------
#
# Notes:
#
# ---------------------------
# if librarian is not installed, install it
if (!requireNamespace("librarian", quietly = TRUE)){
install.packages("librarian")
}
# if BiocManager is not installed, install it
if (!requireNamespace("BiocManager", quietly = TRUE)){
install.packages("BiocManager")
}
# if Biobase is not installed, install it from Bioconductor
if (!requireNamespace("Biobase", quietly = TRUE)){
BiocManager::install("Biobase")
}
# load packages
librarian::shelf(tidyverse)
## ---------------------------
# 1. Input your readings of OD ####
d_OD <- c(0.25,
0.56,
0.9,
0.7,
0.3,
0.5,
0.9)
# 2. give clones a name, probably what they are on your freezer stock, or the label for the plate
d_clone <- c('label_1',
'label_2',
'label_3',
'label_4',
'label_5',
'label_6',
'label_7')
# 3. combine these into a dataframe
d <- data.frame(clone = d_clone,
od = d_OD)
d
# 4. calculate concentrations ####
# set target OD
target_od <- 0.25
# set amount of culture to transfer
culture_volume <- 50
# use the following equation for calculating stock solution volumes:
# original OD volume = (target OD x total volume of target OD) / original OD concentration
# rearrange this as we will always put in 100µl of the original OD volume
# total volume of target OD = (original OD concentration x original OD volume) / target OD
# you can read more about the equation here: https://www.thoughtco.com/dilutions-from-stock-solutions-606085
d <- dplyr::mutate(d,
target_od = target_od,
# calculate total volume of target OD
total_volume = round((od * culture_volume)/target_od, 0),
# can calculate amount of media needed
culture_volume = culture_volume,
media_volume = total_volume - culture_volume)
d
# save this out as a csv somewhere
folder <- 'FOLDER PATH HERE'
write.csv(d, file.path(folder, 'inoculum_plate.csv', row.names = FALSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment