Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bradyajohnston/standard
Simplified Fitting and Use of Standard Curves
https://github.com/bradyajohnston/standard
Last synced: 12 days ago
JSON representation
Simplified Fitting and Use of Standard Curves
- Host: GitHub
- URL: https://github.com/bradyajohnston/standard
- Owner: BradyAJohnston
- License: other
- Created: 2022-03-23T09:41:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-24T01:25:25.000Z (about 1 year ago)
- Last Synced: 2024-10-08T09:22:48.528Z (about 1 month ago)
- Language: R
- Homepage: https://bradyajohnston.github.io/standard
- Size: 849 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)ragg_png = function(..., res = 300) {
ragg::agg_png(..., res = res, units = "in")
}
knitr::opts_chunk$set(
comment = " ",
echo = TRUE,
message = FALSE,
warning = FALSE,
dev = "ragg_png",
R.options = list(width = 80)
)
```# standard
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/standard)](https://CRAN.R-project.org/package=standard)
[![Codecov test coverage](https://codecov.io/gh/rforbiochemists/standard/branch/master/graph/badge.svg)](https://app.codecov.io/gh/rforbiochemists/standard?branch=master)
[![R-CMD-check](https://github.com/BradyAJohnston/standard/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/BradyAJohnston/standard/actions/workflows/R-CMD-check.yaml)`{standard}` provides a simplified interface for fitting and using standard curves in R for work in biochemistry and molecular biology. Many assays conducted in laboratory environments require the creation of standard curves from known samples to then calculate the concentrations of unkown samples.
The workflow usually includes the fitting of a model (usually linear) to a set of readings (in the example below, absorbance @ 660 nm) from samples of known concentrations, extracting an equation from the model in the format `y = mx + c` and using this formula to calculate the unkown values.
This task can be conducted in Microsoft Excel, other spreadsheet programs, and various software packages that come with some plate readers and other pieces of laboratory equipment.
These approaches however don't allow for automation of processing, or reproducibility and transparency of experiments.
Many wet-lab scientists would like to use the R programming language more in their work, including for the task of fitting and using standard curves. The model-fitting cababiliies and interface in R is enourmous however, and can often be overwhelming and not straight forward, when all a user needs to do is fit one model, and do some calculations with the fitted model. This is where `{standard}` comes in.
In `{standard}` we have reduced the process down to two main functions.
1. `std_curve_fit()` which takes the data from the known samples and fits a standard curve.
2. `std_curve_calc()` which takes a standard curve a values from unkown samples, and calculates the concentrations of the unkowns based on the standard curve.
With these functions, the use of standard curves for molecular biology work in R can be streamlined, and importantly can remain repropducible and transparent.## Installation
Currently no published on CRAN, but install from GitHub with the following:
``` r
install.packages("standard", repo = "https://bradyajohnston.r-universe.dev")
```## Example
In the example below, we have the results of a Bradford assay, with known protein concentrations of our standards, and their corresponding `A660 nm` readings. See XXthis vignette on how to read these values in from an excel file or a `.csv` file. In this example we are just going to manually write in the values in the code.
Below we are doing the following:
1. Creating vectors of the `prot` concentrations & `abs` concentrations.
1. Combining them both into a `data.frame` called `assay_data`
1. Fitting a standard curve with `std_curve_fit()`
1. Using the standard curve to calculate the unknowns with `std_curve_calc()`
1. Plotting the final results with `plot()`.```{r fitting-std-curve1}
library(standard)# Protein concentrations of the standards used in the assay
prot <- c(0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000,
0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000)# absorbance readins from the standards used in the assay
abs <- c(0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956,
0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905)assay_data <- data.frame(
Protein = prot,
Absorbance = abs
)
head(assay_data)
``````{r fitting-std-curve2}
our_std_curve <- std_curve_fit(
data = assay_data,
conc = Protein,
resp = Absorbance
)
summary(our_std_curve)
```We can see that internally, R has fitted a linear model to the data, and has printed a range of summary statistics. While these are useful for more complex modelling, we are mostly concerned with the R2 value, to tell how linear our standards are, and what the final equation is for calculating protein concentrations from the absorbance readings of unknown samples.
We can use the base `plot()` function to plot the standard curve with relevant information included on the plot.
```{r plotting-std-curve}
plot(our_std_curve)
```With the formula now known, you can either use this formula to manually calculate your protein concentrations from their absorbance values, or use the `std_curve_calc()` function which will take a `standard curve` from `std_curve_fit()` and a numeric vector of observtations (in this case the absorbance readings), and return a data frame of the calculated values for you.
```{r calc-unk}
unk <- c(0.554, 0.568, 0.705)calc_unk <- std_curve_calc(
std_curve = our_std_curve,
unknowns = unk
)calc_unk
```You can even just use the `plot()` function on the output from `std_curve_calc()` to plot the calculted values onto your standard curve.
```{r plot-unk}
plot(calc_unk)```