gcplyr
is a package that implements a number of
functions to make it easier to import, manipulate, and analyze bacterial
growth from data collected in multiwell plate readers (“growth curves”).
Without gcplyr
, importing and analyzing plate reader data
can be a complicated process that has to be tailored for each
experiment, requiring many lines of code. With gcplyr
many
of those steps are now just a single line of code.
This document gives an introduction of how to use
gcplyr
’s most common functions, and points you to
additional documents for more in-depth explanations of each common steps
of a growth curve analysis with gcplyr
.
To get started, all you need is the data file with the growth curve measures saved in a tabular format (.csv, .xls, or .xlsx) to your computer.
Users often want to combine their data with some information on experimental design elements of their growth curve plate(s). For instance, this might include which strains went into which wells. You can save this information into a tabular file as well (see [Reading design elements from files]), or you can just keep it handy to enter it directly through a function later on (see [Generating designs in R]).
Let’s get started by loading gcplyr
. We’re also going to
load a couple other packages we’ll need.
library(gcplyr)
library(dplyr)
library(ggplot2)
gcplyr
Before digging into the details of the various options that
gcplyr
provides to users, here’s a simple example of what a
final gcplyr
script can look like. This script imports data
from files created by a plate reader, combines it with design files
created by the user, then calculates the maximum growth rate and
area-under-the-curve. Don’t worry about understanding all the
details of how the code works right now. Each of these steps is
explained in depth in later documents. Here, we’re just providing a
demonstration of what analyzing growth curve data with
gcplyr
can look like.
#Read in our data
# (our plate reader data is saved in "widedata.csv")
<- read_wides(files = "widedata.csv")
data_wide
#Transform our data to be tidy-shaped
<-
data_tidy trans_wide_to_tidy(wides = data_wide, id_cols = c("file", "Time"))
#Import our designs
# (saved in the files Bacteria_strain.csv and Phage.csv)
<- import_blockdesigns(files = c("Bacteria_strain.csv", "Phage.csv"))
designs
#Merge our designs and data
<- merge_dfs(data_tidy, designs)
data_merged #> Joining, by = "Well"
#Plot the data
ggplot(data = data_merged,
aes(x = as.numeric(Time), y = Measurements, color = Well)) +
geom_line(aes(lty = Phage)) +
guides(color = "none")
#Voila! 8 lines of code and all your data is imported & plotted!
#Calculate the per-capita growth rate over time in each well
<- mutate(
data_merged group_by(data_merged, Well),
percap_deriv = calc_deriv(y = Measurements, x = Time, percapita = TRUE,
blank = 0, window_width_n = 5, x_scale = 3600))
#Calculate two common metrics of bacterial growth:
# the maximum growth rate, saving it to a column named max_percap
# the area-under-the-curve, saving it to a column named 'auc'
<- summarize(
data_sum group_by(data_merged, Well, Bacteria_strain, Phage),
max_percap = max(percap_deriv, na.rm = TRUE),
auc = auc(y = Measurements, x = as.numeric(Time)))
#> `summarise()` has grouped output by 'Well', 'Bacteria_strain'. You can override
#> using the `.groups` argument.
#Print some of the max growth rates and auc's
head(data_sum)
#> # A tibble: 6 × 5
#> # Groups: Well, Bacteria_strain [6]
#> Well Bacteria_strain Phage max_percap auc
#> <chr> <chr> <chr> <dbl> <dbl>
#> 1 A1 Strain 1 No Phage 1.00 57291.
#> 2 A10 Strain 4 Phage Added 1.43 20060.
#> 3 A11 Strain 5 Phage Added 1.47 21571.
#> 4 A12 Strain 6 Phage Added 0.789 1422.
#> 5 A2 Strain 2 No Phage 1.31 69361.
#> 6 A3 Strain 3 No Phage 0.915 54460.
#Plot the results for max growth rate and area under the curve in presence vs absence of phage
ggplot(data = data_sum,
aes(x = max_percap, y = auc, color = Phage)) +
geom_point()
Now that you’ve read this brief introduction, you probably want to
get into a little more detail learning how to use gcplyr
for your own work. Generally, working with gcplyr
will
follow a number of steps, each of which is likely to be only one or a
few lines of code in your final script. We’ve explained each of these
steps in a page linked below. To start, we’ll learn how to import our
data into R
and transform it into a convenient format.
vignette("gcplyr")
vignette("import_transform")
vignette("incorporate_designs")
vignette("preprocess_plot")
vignette("process")
vignette("analyze")
vignette("noise")
vignette("conclusion")