Title: | Automate PCR Tasks Reproducibly |
---|---|
Description: | PCR tasks - like plate layout planning, dilution calculations, visualization, and analysis - are often repetitive, tedious, prone to error, and poorly documented. amplify seeks to automate these tasks, as well as documenting them (through both code and generated reports) as a bonus. |
Authors: | Kai Aragaki [aut, cre] |
Maintainer: | Kai Aragaki <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-02-03 06:26:56 UTC |
Source: | https://github.com/KaiAragaki/amplify |
A dataset containing fabricated sample names and RNA concentrations
dummy_rna_conc
dummy_rna_conc
A data frame with 8 rows and 2 columns
name of sample
concentration of RNA, in ng/uL
Recalcuate standard slope of quantity vs Ct
pcr_calc_slope(tidy_pcr)
pcr_calc_slope(tidy_pcr)
tidy_pcr |
a object that has been tidied by |
a tibble with an updated slope
column
Calculate Delta Ct mean based on given control probe
pcr_control(x, control_probe) ## S3 method for class 'pcr' pcr_control(x, control_probe, ...) ## S3 method for class 'data.frame' pcr_control(x, control_probe, ...)
pcr_control(x, control_probe) ## S3 method for class 'pcr' pcr_control(x, control_probe, ...) ## S3 method for class 'data.frame' pcr_control(x, control_probe, ...)
x |
A |
control_probe |
A probe to be used as an endogenous control (eg GAPDH) |
An object with class the same as input
system.file("extdata", "untidy-pcr-example.xls", package = "amplify") |> read_pcr() |> pcr_control("GAPDH")
system.file("extdata", "untidy-pcr-example.xls", package = "amplify") |> read_pcr() |> pcr_control("GAPDH")
Calculate library PCR concentrations
pcr_lib_calc(pcr, dil_factor = 1000)
pcr_lib_calc(pcr, dil_factor = 1000)
pcr |
a |
dil_factor |
integer. The factor that the libraries were diluted for pcr |
a pcr
object, containing the input columns as well as:
standard_diff The differences between the ct_mean
of a standard
and one step up in the dilution (ie more concentrated, lower Ct). The most
concentrated dilution has a value of 0
dil 2^(standard_diff). The accuracy of this metric assumes that
the efficiency of the PCR is 100%, which is likely good but not perfect! In
the case of the first standard, dil
= 0
quant_actual For standards, the presumed quantity of standard,
calculated from dil
. For samples, quantity
concentrationThe concentration of library, before dilution
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> read_pcr() |> pcr_lib_calc()
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> read_pcr() |> pcr_lib_calc()
Create library prep quality control data
pcr_lib_qc(lib_calc_pcr)
pcr_lib_qc(lib_calc_pcr)
lib_calc_pcr |
A |
While the output of this function on its own is can theoretically be
used to gauge library quality, it is best used in conjunction with a
function like pcr_lib_calc_report
a pcr
object with list with:
standards Data for individual standards, including calculated dilutions, given and calculated quantities, raw Ct, etc.
samples Data for individual samples, including calculated concentrations, raw Ct, etc.
sample_summary Summary statistics for samples grouped by replicates
standard_summary Summary statistics for standards groupd by replicates
outliers Data for individual samples and standards with and without
their putative outliers (po
) per replicate group
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc()
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc()
Plot concentration of libraries across samples
pcr_lib_qc_plot_conc(lib_qc)
pcr_lib_qc_plot_conc(lib_qc)
lib_qc |
Output of |
a ggplot
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_conc()
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_conc()
Plot standard dilutions compared to a perfect dilution
pcr_lib_qc_plot_dil(lib_qc)
pcr_lib_qc_plot_dil(lib_qc)
lib_qc |
Output of |
An optimal dilution will show blue and grey dots perfectly aligned. A plot with blue dots consistently lagging more behind the gray dots implies the dilutions are consistent, but less dilute than a 1:10 dilution. Likewise, a plot with blue dots that consistently outpace the gray dots more with each passing dot signifies consistently over-diluting the standards.
Samples are shown as red dots.
a ggplot
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy() |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_dil()
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy() |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_dil()
Plot mean centered samples without putative outliers
pcr_lib_qc_plot_outliers(lib_qc)
pcr_lib_qc_plot_outliers(lib_qc)
lib_qc |
Output of |
A sample is deemed an outlier if, upon its removal, it is more that 3Z from the mean of the remaining. This boundary of +/-3Z is demarcated by the shaded area. Gray samples are outliers. Samples |Z| > 10 away are denoted by arrows (<<<) pointing in their direction as well as with their Z
a ggplot
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_outliers()
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_outliers()
Plot the log of library quantities vs Ct
pcr_lib_qc_plot_slope(lib_qc)
pcr_lib_qc_plot_slope(lib_qc)
lib_qc |
Output of |
An optimal plot will have a slope of -3.32. This is because we expect that a sample 10x more concentrated than another will reach the same abundance in 3.32 doublings FASTER (that is, 3.32 fewer doubles, or Cts). Therefore, for each 10x increase in concentration (one point left to right on the plot) we expect a decrease in CT of 3.32. A steeper slope (more negative) implies a poorer efficiency (more cycles are required to reach 10x than perfect doubling would imply)
a ggplot
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_slope()
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy(pad_zero = TRUE) |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_plot_slope()
Generate visual library prep pcr quality control report
pcr_lib_qc_report(pcr_lib_qc, report_path = NULL)
pcr_lib_qc_report(pcr_lib_qc, report_path = NULL)
pcr_lib_qc |
output from |
report_path |
the name of the report as well as where it should be output. If NULL, it will export to a temp directory |
The path to the report
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy() |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_report()
system.file("extdata", "untidy-standard-curve.xlsx", package = "amplify") |> pcr_tidy() |> pcr_lib_calc() |> pcr_lib_qc() |> pcr_lib_qc_report()
Plan PCR experiment
pcr_plan( data, n_primers, format = 384, exclude_border = TRUE, primer_names = NULL, headless = TRUE, has_names = TRUE )
pcr_plan( data, n_primers, format = 384, exclude_border = TRUE, primer_names = NULL, headless = TRUE, has_names = TRUE )
data |
a data.frame, with samples as the first column (if |
n_primers |
integer. Number of primers to be used in the experiment. |
format |
integer. 96 or 384 - the number of wells of the plate planned to be used |
exclude_border |
logical. Should the border be excluded to avoid edge effects? Default is TRUE. |
primer_names |
character vector. Names of primers. |
headless |
logical. If FALSE, return invisible and redirect to shiny application. |
has_names |
logical. Is the first column the names of the samples? |
a named list
dummy_rna_conc |> pcr_plan(n_primers = 3)
dummy_rna_conc |> pcr_plan(n_primers = 3)
Create a report from a PCR plan
pcr_plan_report(pcr_plan, file_path = NULL)
pcr_plan_report(pcr_plan, file_path = NULL)
pcr_plan |
output from |
file_path |
Where the report should be written, as well as the file name. Defaults to temp file. |
a named list, like the output of pcr_plan
, but with the output file path appended.
dummy_rna_conc |> pcr_plan(n_primers = 3) |> pcr_plan_report()
dummy_rna_conc |> pcr_plan(n_primers = 3) |> pcr_plan_report()
View sample plating layout
pcr_plate_view(pcr, fill = target_name)
pcr_plate_view(pcr, fill = target_name)
fill |
character. A column in |
tidy_pcr |
an output from the |
a ggplot
system.file("extdata", "untidy-pcr-example.xls", package = "amplify") |> read_pcr() |> pcr_plate_view()
system.file("extdata", "untidy-pcr-example.xls", package = "amplify") |> read_pcr() |> pcr_plate_view()
Plot qPCR results
pcr_plot(x, ...) ## S3 method for class 'pcr' pcr_plot(x, ...) ## S3 method for class 'data.frame' pcr_plot(x, ...)
pcr_plot(x, ...) ## S3 method for class 'pcr' pcr_plot(x, ...) ## S3 method for class 'data.frame' pcr_plot(x, ...)
x |
a |
a ggplot
system.file("extdata", "untidy-pcr-example.xls", package = "amplify") |> pcr_tidy() |> pcr_rq("RD1") |> pcr_plot()
system.file("extdata", "untidy-pcr-example.xls", package = "amplify") |> pcr_tidy() |> pcr_rq("RD1") |> pcr_plot()
Recalculate relative quantities for a given experiment
pcr_rq(x, relative_sample, control_probe = NULL, ...) ## S3 method for class 'pcr' pcr_rq(x, relative_sample, control_probe = NULL, ...) ## S3 method for class 'data.frame' pcr_rq(x, relative_sample, control_probe = NULL, ...)
pcr_rq(x, relative_sample, control_probe = NULL, ...) ## S3 method for class 'pcr' pcr_rq(x, relative_sample, control_probe = NULL, ...) ## S3 method for class 'data.frame' pcr_rq(x, relative_sample, control_probe = NULL, ...)
x |
A |
relative_sample |
A sample to set others relative to (eg |
control_probe |
Character. |
... |
Arguments passed to respective method |
An object of same class as x
dat_path <- system.file("extdata", "untidy-pcr-example.xls", package = "amplify") read_pcr(dat_path) |> pcr_rq("U6D1") # Can also be run after using pcr_control: read_pcr(dat_path) |> pcr_control("GAPDH") |> pcr_rq("U6D1")
dat_path <- system.file("extdata", "untidy-pcr-example.xls", package = "amplify") read_pcr(dat_path) |> pcr_rq("U6D1") # Can also be run after using pcr_control: read_pcr(dat_path) |> pcr_control("GAPDH") |> pcr_rq("U6D1")