# Evaluate optical density to get concentrations of your ELISA

Today I was doing a quick ELISA and realized that the reader was old and produced the results in PDF only. This poses multiple problems as they need to be manually rewritten to a file and post-processed later. Additionally the optical density measurments in my software are automatically calculated into concentration based on some shady functions which I never understood.

I decided to change this and learn this and that about analysing ELISA results.

So the first thing that got me - OPTICAL DENSITY measurments were unaffected by the analysis type. So I had to use these raw values as my starting point. Extracting these was a matter of using Rpoppler package to extract pdf into txt and than using som gsub commands to get the exact values that I needed.

Secondly, the manual of my elisa recommended using the 4 parameter models and I had to look for a function which could facilitate this. `drc` package has this covered.

I quickly wrote a function based on a post on research gate, and was able to get my results.

``````#' Calculate the concentration of a substrate from a known OPTICAL DENSITY
#'
#' This function will give a calculated concentration of a subsance in 96 well
#' plate given the optical density from a plate reader.
#'
#' @param OD Optical density of the STANDARD DILUTION [numeric vector]
#' @param conc KNOWN concentrations of the standard dilution [numeric vector]
#' @param OD_sample Optical densities of samples [named vector]
#' @return A data frame with OD, log fitted values and calculated concentrations
#'  of the samples and a plot with a standard curve standard and blue samples
#' @author Wojciech Francuzik
#' @details This function is useful when working with old plate readers. It uses
#' the FOUR PARAMETER CURVE to fit the model to your standards.
#' @export elisa4ll

elisa4ll <- function(OD,conc,OD_sample){
require(drc)
logconc <-log10(conc)# log10 from conc
stdcrvdata <- data.frame(OD,conc,logconc)
fit<-drm(formula = OD ~ conc , data = stdcrvdata, fct = LL.4())
samples <- data.frame(OD=OD_sample)# data from mesurments
(((-1* fit\$coefficients[3]+samples\$OD)/
(fit\$coefficients[2]-samples\$OD))^(1/ fit\$coefficients[1]))