{ "cells": [ { "cell_type": "markdown", "id": "2d370b6f-34c7-4238-ba07-3c1e630f9735", "metadata": {}, "source": [ "# efficiency" ] }, { "cell_type": "markdown", "id": "d8f72162-6707-4d66-8d8b-0a571d5332d8", "metadata": { "tags": [] }, "source": [ "In a perfect PCR reaction, the amount of product should double with each additional reaction cycle. In reality, primers often deviate considerably from perfect doubling. This deviation causes problems for qPCR analysis, as an assumption of comparing Ct values between primer sets is that the amplification curves have approximately the same shape during their logarithmic phases. As such, verifying that primers amplify approximately exponentially is an important part of qPCR experimentation. `efficiency()` allows a user to easily convert Ct values associated with a standard curve to efficiency values for tested primers. \n", "\n", "The following section provides a detailed explanation of efficiency testing. To jump directly to the usage of `efficiency()`, jump to \"Using namer to get a dataframe for efficiency\"." ] }, { "cell_type": "markdown", "id": "c89b7cb9-9e0e-4762-b65e-8605c795c811", "metadata": {}, "source": [ "## What is efficiency?" ] }, { "cell_type": "markdown", "id": "bca247cf-3337-4faf-8114-03b2fa1bb391", "metadata": {}, "source": [ "Efficiency is the most common metric used to determine whether primers are properly amplifying exponentially. It is calculated from a standard curve. For each two-fold dilution in the standard curve, the Ct value should increase by 1. In other words, when Ct values are plotted against $log_2(dilution)$, the absolute value of the slope should be 1. Efficiency is calculated by converting the slope to the fraction or percentage of product amplified. \n", "\n", "If E > 1, the amount of PCR product is more than doubling each PCR cycle. This is often due to primer-dimers or other issues with multiple amplicons. If E < 1, the PCR product is doubling more slowly than once per PCR cycle. This could be due to primer secondary structure, non-optimal melting temperature, primer saturation, or difficult templates. In general, E-values between 0.9 and 1.1 are acceptable. \n", "\n", "To test the primers over a large enough concentration range, each dilution should be at least a factor of two, and three to five dilutions should be used. For certain targets, the reverse transcription reaction conditions and dilution factors may need to be adjusted to keep the highest Ct values under 30. Additionally, optimal primer concentrations may vary, but in general a final concentration between 0.5-1.0µM gives good results.\n", "\n", "`efficiency()` uses linear regression to determine the equation of the line of best fit, then uses the following equation to calculate efficiency:\n", "\n", "$$\n", "E = 2^{- 1/slope} - 1\n", "$$\n", "\n", "To explain this, remember that the slope represents the change in $Ct$ over the change in $log_2(dilution)$. Note that dilution in this case represents fraction of stock concentration (e.g. 1 volume of template plus 3 volumes diluent yields a dilution of $\\frac{1}{4}$). We'll label dilution as $d$:\n", "\n", "$$\n", "slope = \\frac{\\Delta Ct}{\\Delta log_2{d}}\n", "$$\n", "\n", "Note that $\\Delta Ct$ in this equation is not the same as the $\\Delta Ct$ in differential gene expression. Substituting this into the efficiency equation yields:\n", "\n", "\\begin{align}\n", "E &= 2^{\\frac{-1}{slope}} - 1 \\\\\n", "&= 2^{\\frac{-1}{\\Delta Ct / \\Delta log_2{d}}} - 1 \\\\\n", "&= 2^{\\frac{- \\Delta log_2{d}}{\\Delta Ct}} - 1 \\\\\n", "&= \\left( 2^{\\Delta log_2{d}} \\right)^{-1/\\Delta Ct} - 1\\\\\n", "&= d^{-1/ \\Delta Ct} - 1\n", "\\end{align}\n", "\n", "Let's examine what happens if we have a perfect PCR reaction:\n", "\n", "\\begin{align}\n", "E &= 0.5^{-1 / 1} - 1 \\\\\n", "&= 2 - 1 \\\\\n", "& = 1 \\\\\n", "\\end{align}\n", "\n", "As expected, this yields 100% efficiency or $E = 1$. We can back-calculate to see how an efficiency value of 1.1 would affect Ct:\n", "\n", "\\begin{align}\n", "1.1 &= 0.5^{-1 / \\Delta Ct} - 1 \\\\\n", "2.1 &= 0.5^{-1 / \\Delta Ct} \\\\\n", "log_0.5{2.1} &= \\frac{-1}{\\Delta Ct} \\\\\n", "\\Delta Ct &= \\frac{-1}{log_0.5{2.1}} \\\\\n", "\\Delta Ct &\\approx 0.93 \\\\\n", "\\end{align}\n", "\n", "We can see that although the template concentration dropped by half, the $Ct$ value only increased by 0.93. This means that the amount of PCR product is more than doubling each cycle.\n", "\n", "The mathematics underlying methods such as $\\Delta \\Delta Ct$ differential gene expression analysis assume that the efficiencies of all primers involved are approximately 1. As such, validating primer efficiency is essential for accurately interpreting qPCR results." ] }, { "cell_type": "markdown", "id": "3d4fa7e0-7af1-4099-bb4b-ac0c88dd3a68", "metadata": {}, "source": [ "## Using namer to get a dataframe for efficiency" ] }, { "cell_type": "markdown", "id": "a4d1b894-4b8c-4ba0-ad7c-2840fe969f22", "metadata": {}, "source": [ "For this example, we will just look at data from a Lightcycler 480 formatted as `namer()` anticipates. The `namer()` documentation has details on how to use the function for other instruments and dilution arrangements. " ] }, { "cell_type": "code", "execution_count": 1, "id": "88c70240-b26e-42e9-b209-56a46ea29912", "metadata": { "tags": [] }, "outputs": [], "source": [ "import equipt" ] }, { "cell_type": "code", "execution_count": 2, "id": "d9e2cdc2-b486-43be-b8c8-594ebb4453e7", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " | Pos | \n", "Cp | \n", "Primer | \n", "Name | \n", "NamePrim | \n", "
---|---|---|---|---|---|
0 | \n", "A1 | \n", "17.51 | \n", "Fus (112734868c1) | \n", "mESC total cDNA_20 | \n", "mESC total cDNA_20Fus (112734868c1) | \n", "
1 | \n", "A2 | \n", "17.54 | \n", "Fus (112734868c1) | \n", "mESC total cDNA_20 | \n", "mESC total cDNA_20Fus (112734868c1) | \n", "
2 | \n", "A3 | \n", "17.55 | \n", "Fus (112734868c1) | \n", "mESC total cDNA_20 | \n", "mESC total cDNA_20Fus (112734868c1) | \n", "
3 | \n", "A4 | \n", "18.49 | \n", "Fus (112734868c1) | \n", "mESC total cDNA_40 | \n", "mESC total cDNA_40Fus (112734868c1) | \n", "
4 | \n", "A5 | \n", "18.52 | \n", "Fus (112734868c1) | \n", "mESC total cDNA_40 | \n", "mESC total cDNA_40Fus (112734868c1) | \n", "
5 | \n", "A6 | \n", "18.54 | \n", "Fus (112734868c1) | \n", "mESC total cDNA_40 | \n", "mESC total cDNA_40Fus (112734868c1) | \n", "
\\n\"+\n", " \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n", " \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n", " \"
\\n\"+\n", " \"\\n\"+\n",
" \"from bokeh.resources import INLINE\\n\"+\n",
" \"output_notebook(resources=INLINE)\\n\"+\n",
" \"
\\n\"+\n",
" \"\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"\n", " | Name | \n", "Primer | \n", "Efficiency | \n", "Rsquared | \n", "
---|---|---|---|---|
0 | \n", "mESC total cDNA | \n", "Ewsr1 (6679715a1) | \n", "0.953 | \n", "0.934628 | \n", "
1 | \n", "mESC total cDNA | \n", "Ewsr1 (88853580c2) | \n", "0.976 | \n", "0.934442 | \n", "
2 | \n", "mESC total cDNA | \n", "Fus (112734868c1) | \n", "0.952 | \n", "0.921493 | \n", "
3 | \n", "mESC total cDNA | \n", "Fus (15029724a1) | \n", "0.997 | \n", "0.932829 | \n", "
4 | \n", "mESC total cDNA | \n", "Taf15 (141803447c1) | \n", "1.023 | \n", "0.925023 | \n", "
5 | \n", "mESC total cDNA | \n", "Taf15 (141803447c2) | \n", "1.000 | \n", "0.933382 | \n", "
6 | \n", "mESC total cDNA | \n", "Tsix exon4 | \n", "1.108 | \n", "0.929611 | \n", "
\n", " | Name | \n", "Primer | \n", "Coefficient | \n", "Intercept | \n", "
---|---|---|---|---|
0 | \n", "mESC total cDNA | \n", "Ewsr1 (6679715a1) | \n", "-1.035 | \n", "14.411 | \n", "
1 | \n", "mESC total cDNA | \n", "Ewsr1 (88853580c2) | \n", "-1.018 | \n", "13.527 | \n", "
2 | \n", "mESC total cDNA | \n", "Fus (112734868c1) | \n", "-1.036 | \n", "13.032 | \n", "
3 | \n", "mESC total cDNA | \n", "Fus (15029724a1) | \n", "-1.002 | \n", "13.355 | \n", "
4 | \n", "mESC total cDNA | \n", "Taf15 (141803447c1) | \n", "-0.984 | \n", "14.827 | \n", "
5 | \n", "mESC total cDNA | \n", "Taf15 (141803447c2) | \n", "-1.000 | \n", "14.561 | \n", "
6 | \n", "mESC total cDNA | \n", "Tsix exon4 | \n", "-0.930 | \n", "21.148 | \n", "