diff --git a/tutorial/appendix/README.md b/tutorial/appendix/README.md index 35a90b7..493a9a3 100644 --- a/tutorial/appendix/README.md +++ b/tutorial/appendix/README.md @@ -60,6 +60,15 @@ These appendices provide background or technical details that did not fit the ma 2. [![github](../img/github.svg)](./e-offsets/2-offset-correction.ipynb) [![nbviewer](../img/nbviewer.svg)](https://nbviewer.jupyter.org/github/CardiacModelling/VoltageClampModel/tree/main/tutorial/appendix/e-offsets/2-offset-correction.ipynb) Offset correction + +## S: Bath and pipette solutions + +1. [![github](../img/github.svg)](./s-solutions/1-bath-and-pipette-solutions.ipynb) + [![nbviewer](../img/nbviewer.svg)](https://nbviewer.jupyter.org/github/CardiacModelling/VoltageClampModel/tree/main/tutorial/appendix/s-solutions/1-bath-and-pipette-solutions.ipynb) Bath & pipette solutions +2. [![github](../img/github.svg)](./s-solutions/2-example-1.ipynb) + [![nbviewer](../img/nbviewer.svg)](https://nbviewer.jupyter.org/github/CardiacModelling/VoltageClampModel/tree/main/tutorial/appendix/s-solutions/2-example-1.ipynb) Example 1 +3. [![github](../img/github.svg)](./s-solutions/3-example-2.ipynb) + [![nbviewer](../img/nbviewer.svg)](https://nbviewer.jupyter.org/github/CardiacModelling/VoltageClampModel/tree/main/tutorial/appendix/s-solutions/3-example-2.ipynb) Example 2 ## Z: Parameter values diff --git a/tutorial/appendix/s-solutions/1-bath-and-pipette-solutions.ipynb b/tutorial/appendix/s-solutions/1-bath-and-pipette-solutions.ipynb new file mode 100644 index 0000000..411505e --- /dev/null +++ b/tutorial/appendix/s-solutions/1-bath-and-pipette-solutions.ipynb @@ -0,0 +1,785 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "542259bc-8c98-4393-8bc2-b9450e3e1984", + "metadata": {}, + "source": [ + "# G1: Bath & pipette solutions\n", + "\n", + "In this appendix we look at bath and pipette solutions, and discuss\n", + "\n", + "- The general method by which solutions are prepared\n", + "- How to determine **free ion** concentrations from the listed \"target\" concentrations.\n", + "- How to estimate the **liquid junction potential (LJP)** and the **reversal (Nernst) potential** for potassium (EK).\n", + "- How to estimate **errors** in the concentrations.\n", + "- How to calculate the osmolarity of both solutions.\n", + "\n", + "We assume some mathematical knowledge, but very limited practical and theoretical knowledge of chemistry.\n", + "\n", + "This notebook introduces the concepts.\n", + "The next two notebooks provide real-world examples." + ] + }, + { + "cell_type": "markdown", + "id": "65bfc6a2-87c1-4645-ae18-c028bac92bad", + "metadata": {}, + "source": [ + "## General method of preparing solutions\n", + "\n", + "Bath and pipette solutions are prepared by mixing powders (e.g. of [KCl](https://www.sigmaaldrich.com/GB/en/product/sigma/p9541)) and stock solutions (e.g. of [$\\text{CaCl}_2$](https://www.sigmaaldrich.com/GB/en/product/sigma/21115)), adding purified water until the desired volume is reached, and adjusting the pH to e.g. 7.4 (external) or 7.2 (internal) by adding a few drops of a basic or acidic solution.\n", + "\n", + "As the pH adjustment slightly increases the total volume, the most accurate method is to\n", + "\n", + "1. Combine the ingredients.\n", + "2. Add pure water till just below the desired volume, and stir.\n", + "3. Adjust the pH.\n", + "4. Set the final volume.\n" + ] + }, + { + "cell_type": "markdown", + "id": "fbada386-bf29-4f68-9195-47c07f7077c6", + "metadata": {}, + "source": [ + "### Example target concentrations\n", + "\n", + "To guide our discussion, we use the solutions in the tables below.\n", + "Each table shows\n", + "\n", + "- The compound added.\n", + "- The \"target concentration\", $C_t$, of that compound before it dissolves or any reactions occur.\n", + "- The molecular weight, $M$, of compounds added as powder. By definition of the mole, this is the same number when expressed in $\\text{Da}$, or $\\text{g}/\\text{mol}$.\n", + "- The purity, $p$, discussed below.\n", + "- The concentration, $C_s$, of compounds added as solution.\n", + "- A link to an example product page, from which $M$ and $p$ or $C_s$ can be obtained.\n", + "\n", + "The example external solution contains:\n", + "\n", + "| Compound | $C_t$ | $M$ | $p$ | $C_s$ | Example |\n", + "|----------|----------|--------------|---------------|-------|---------|\n", + "| NaCl | 140 mM | 58.44 g/mol | $\\geq 99\\%$ | | [S9888](https://www.sigmaaldrich.com/GB/en/product/sigald/s9888) |\n", + "| KCl | 4 mM | 74.55 g/mol | $\\geq 99\\%$ | | [P5405](https://www.sigmaaldrich.com/GB/en/product/sigma/p5405) |\n", + "| CaCl2 | 1.8 mM | | | 1 M | [21115](https://www.sigmaaldrich.com/GB/en/product/sigma/21115) |\n", + "| MgCl2 | 1 mM | | | 1 M | [M8266](https://www.sigmaaldrich.com/GB/en/product/sigma/m8266) |\n", + "| HEPES | 10 mM | 238.3 g/mol | $\\geq 99.5\\%$ | | [H3375](https://www.sigmaaldrich.com/GB/en/product/sigma/h3375) |\n", + "| Glucose | 10 mM | 180.16 g/mol | $\\geq 99.5\\%$ | | [G8270](https://www.sigmaaldrich.com/GB/en/product/sigma/g8270) |\n", + "| Sucrose | 15 mM | 342.30 g/mol | $\\geq 99.5\\%$ | | [S0389](https://www.sigmaaldrich.com/GB/en/product/sigma/s0389) | \n", + "\n", + "In addition to the simple ions, this solution includes HEPES as pH buffer, glucose as an energy source, and sucrose to adjust the osmolarity.\n", + "\n", + "For the internal solution example we use\n", + "\n", + "| Compound | $C_t$ | $M$ | $p$ | $C_s$ | Example |\n", + "|----------|----------|--------------|-----------------|-------|---------|\n", + "| KCl | 130 mM | 74.55 g/mol | $\\geq 99\\%$ | | [P5405](https://www.sigmaaldrich.com/GB/en/product/sigma/p5405) |\n", + "| MgCl2 | 1 mM | 95.21 g/mol | $\\geq 98\\%$ | | [M8266](https://www.sigmaaldrich.com/GB/en/product/sigma/m8266) |\n", + "| CaCl2 | 1 mM | | | 1 M | [21115](https://www.sigmaaldrich.com/GB/en/product/sigma/21115) |\n", + "| EGTA | 10 mM | 380.35 g/mol | $\\geq 97\\%$ (1) | | [E3889](https://www.sigmaaldrich.com/GB/en/product/sigma/e3889) |\n", + "| Mg2+ ATP | 5 mM | 507.18 g/mol | $\\geq 95\\%$ (2) | | [A9187](https://www.sigmaaldrich.com/GB/en/product/sigma/a9187) |\n", + "| HEPES | 10 mM | 238.3 g/mol | $\\geq 99.5\\%$ | | [H3375](https://www.sigmaaldrich.com/GB/en/product/sigma/h3375) |\n", + "\n", + "Here, ATP is a cellular energy source and EGTA is added as a calcium buffer to bring $[\\text{Ca}^{2+}]$ down to micromolar levels and maintain it there." + ] + }, + { + "cell_type": "markdown", + "id": "94128850-d3a0-45d2-8742-e52ad9c51cd2", + "metadata": {}, + "source": [ + "### Adding by weight and by volume\n", + "\n", + "Substances added as powder will list the molecular weight $M$ on the bottle, from which we can work out how much to add.\n", + "For example, to make $100\\,\\text{mL}$ solution with target concentration $10\\,\\text{mM}$ KCl, we would look up the molecular weight of KCl to find $74.55\\,\\text{g}/\\text{mol}$, and then measure out\n", + "\\begin{align}\n", + "0.1\\,\\text{L} \\cdot 10\\,\\frac{\\text{mmol}}{\\text{L}} \\cdot 74.55\\,\\frac{\\text{g}}{\\text{mol}} = 74.55\\,\\text{mg}\n", + "\\end{align}\n", + "using very accurate scales.\n", + "\n", + "Similarly, if we want 2 mM $\\text{CaCl}_2$ in the same mix we look up the concentration, in this example $1\\,\\text{M}$, and use a pipette to add \n", + "\\begin{align}\n", + "0.1\\,\\text{L} \\cdot 2\\,\\frac{\\text{mmol}}{\\text{L}} / 1\\,\\frac{\\text{mol}}{\\text{L}} = 0.2\\,\\text{mL}\n", + "\\end{align}\n", + "of the stock solution." + ] + }, + { + "cell_type": "markdown", + "id": "8cfcdfd7-8b7d-4bce-ab5c-6df5a40e7df9", + "metadata": {}, + "source": [ + "### Purity\n", + "\n", + "For compounds added by weight, the supplier usually lists a _purity_.\n", + "This specifies how much of the powder is actually the compound of interest.\n", + "**Although given as a lower bound, it is common practice to interpret it as the true value**, and adjust the added weight accordingly:\n", + "\\begin{align}\n", + "m = \\frac{C_t M V}{p} \n", + "&\\quad&\n", + "\\frac{\\text{mmol}}{\\text{L}} \\frac{\\text{g}}{\\text{mol}} \\text{L} = \\text{mg}\n", + "\\end{align}\n", + "where $m$ is the weight required to obtain the target solution and $V$ is the volume of solution being prepared.\n", + "Common units are shown on the right.\n", + "\n", + "For compounds added by volume, purity is often not supplied, so we simply use\n", + "\\begin{align}\n", + "V_s = \\frac{C_t}{C_s} V\n", + "&\\quad&\n", + "\\text{mL} = \\frac{\\text{mmol}}{\\text{L}} \\cdot \\frac{\\text{L}}{\\text{mol}} \\cdot \\text{L}\n", + "\\end{align}\n", + "where $V_s$ is the volume to add." + ] + }, + { + "cell_type": "markdown", + "id": "e87a2f82-36d3-4b4d-af69-92c12cfd70bd", + "metadata": {}, + "source": [ + "### \"Loss on drying\"\n", + "\n", + "Another impurity to look out for is _water content_, for example in [this EGTA product](https://www.sigmaaldrich.com/GB/en/product/sigma/e3889).\n", + "This occurs when a small number of $\\text{H}_2\\text{O}$ molecules are embedded in a crystaline structure, and is measured as (but not exactly the same as) _loss on drying_, or LOD.\n", + "\n", + "LOD is specified as an upper bound, for example $\\leq 1\\%$, but as with purity, it is factored in by reinterpreting as the exact value\n", + "\\begin{align}\n", + "m = \\frac{C_t M V}{p_1 (1 - p_2)}\n", + "\\end{align}\n", + "where $p_1$ is purity (e.g. 0.97 for $\\geq 97\\%$) and $p_2$ is loss on drying (e.g. 0.01 for $\\leq 1\\%$)." + ] + }, + { + "cell_type": "markdown", + "id": "5b9857a9-e434-471d-bb23-7826beb28ac8", + "metadata": {}, + "source": [ + "### Significant water content\n", + "\n", + "When water content is significant, it may be explicitly acknowledged in the product formula.\n", + "For example, this [ATP disodium salt hydrate](https://www.sigmaaldrich.com/GB/en/product/aldrich/a26209) is listed as\n", + "\\begin{align}\n", + "\\text{C}_{10}\\text{H}_{14}\\text{N}_5\\text{Na}_2\\text{O}_{13}\\text{P}_3 \\cdot x\\text{H}_2\\text{O}\n", + "\\end{align}\n", + "where the $A \\cdot x B$ notation means \"a crystal of A with embedded B, at a ratio of $x$ B per A\", see for example the wikipedia page on [hydrates](https://en.wikipedia.org/wiki/Hydrate) and [water of crystallisation](https://en.wikipedia.org/wiki/Water_of_crystallization).\n", + "By comparision, the standard formula for ATP is\n", + "\\begin{align}\n", + "\\text{C}_{10}\\text{H}_{16}\\text{N}_5\\text{O}_{13}\\text{P}_3\n", + "\\end{align}\n", + "so in addition to the added water, we can see two Na have replaced two H.\n", + "\n", + "To find the value of $x$, we need to look at some of the \"Certificates of Analysis (COA)\" linked on the product page.\n", + "Here, we see an upper limit of 12%.\n", + "This would mean the weight to add is\n", + "\\begin{align}\n", + "m = \\frac{C_t M V}{p_1 (1 - p_2)} \\approx 1.15 C_t M V\n", + "\\end{align}\n", + "where $p_1$ is purity (0.99 for this product) and $p_2$ is water content (0.12).\n", + "To get a more accurate estimate, the COA for the specific lot should be used." + ] + }, + { + "cell_type": "markdown", + "id": "4ee4d80e-ac06-453d-abe6-02f3c1971710", + "metadata": {}, + "source": [ + "### Unspecified ratio of components\n", + "\n", + "Another unspecified ratio occurs with the \"$\\text{Mg}^{2+}\\text{ATP}$\" listed in our example above.\n", + "On [the supplier website](https://www.sigmaaldrich.com/GB/en/product/sigma/a9187) the formula is given as\n", + "\\begin{align}\n", + "\\text{C}_{10}\\text{H}_{16}\\text{N}_5\\text{O}_{13}\\text{P}_3 \\cdot x\\text{Mg}^{2+}\n", + "\\end{align}\n", + "which shows that this is an ATP crystal embedding magnesium.\n", + "Near the bottom of the page, the ratio of moles of Mg to moles of ATP is specified as approximately 1 to 1.5.\n", + "\n", + "Note that, since we are interested in both Mg _and_ ATP, we cannot correct for both simultaneously.\n", + "Instead, we will treat this as a source of _uncertainty_.\n", + "\n", + "On the product website above, the molecular weight is given as 507.18 g/mol, which is the weight of ATP.\n", + "The atomic weight of a magnesium ion is 24.304 g/mol.\n", + "In the worst case scenario, when we have 1.5 moles of Mg per ATP, this gives a molecular weight of 543.636 g/mol.\n", + "That means that, in addition to the purity error, measuring using the given weight will give an ATP content that is up to 7% lower than intended.\n", + "In this case, the Mg content will be 40% higher than intended.\n", + "\n", + "\\begin{align}\n", + "\\frac{507.18}{507.18 + 1.5 \\cdot 24.304} &\\approx 0.933 \\rightarrow 7\\% \\text{lower}\n", + "\\end{align}\n", + "\\begin{align}\n", + "0.933 \\cdot 1.5 &= 1.3995 \\rightarrow 40\\% \\text{higher}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "9368d94f-ad2b-4f3b-9838-a0aeb51ed133", + "metadata": {}, + "source": [ + "## Adjusting the pH\n", + "\n", + "Once we have worked out how much to add, we mix everything together and then measure the pH.\n", + "Solutions used in cardiac cell electrophysiology are typically acidic before adjustment.\n", + "For example, around 40% of HEPES molecules will release a proton ($H^+$) when dissolved, and become $\\text{HEPES}^-$.\n", + "The EGTA and ATP used in internal solutions can release _multiple_ protons when dissolved.\n", + "As a result, a strong base needs to be added, and common choices are NaOH for external, and KOH for internal solutions.\n", + "**This can add a substantial amount of Na or K, particularly for internal solutions, and so will affect the LJP and reversal potentials.**\n", + "\n", + "When setting up new experiments, if the exact concentrations are important it is a good idea to use a measuring pipette to add the base one drop at a time, count the drops, and calculate the added Na or K.\n", + "\n", + "When analysing existing data, this amount is almost never reported.\n", + "Instead, it may be possible to estimate the added base by working out the free ion concentrations, summing all charges, and equating the deviation from zero with the amount of added base (see the Example notebook 1)." + ] + }, + { + "cell_type": "markdown", + "id": "efae3b30-7184-45f7-abdb-657337683f3a", + "metadata": {}, + "source": [ + "### Do we need to keep track of $[\\text{H}^+]$ and $[\\text{OH}^-]$?\n", + "\n", + "Since our goal is to calculate the concentrations of free ions, do we need to account for released $\\text{H}^+$ and added $\\text{OH}^-$ when calculating the LJP?\n", + "The short answer is **no: at a physiological pH, the $\\text{H}^+$ and $\\text{OH}^-$ concentrations are negligible**.\n", + "A little more background is given below.\n", + "\n", + "In pure water, at pH=7, a tiny fraction of the $\\text{H}_2\\text{O}$ molecules ($10^{-7}\\,\\text{mol}/\\text{L}$) [self-ionise](https://en.wikipedia.org/wiki/Self-ionization_of_water) to become $\\text{H}_3\\text{O}^+$ and $\\text{OH}^-$.\n", + "When we add an acid such as HCl it increases the $\\text{H}_3\\text{O}^+$ concentration: $\\text{HCl} + \\text{H}_2\\text{O} \\rightarrow \\text{H}_3\\text{O}^+ + \\text{Cl}^-$.\n", + "A common shorthand for this reaction is _to omit the water_, and write $\\text{HCl} \\rightarrow \\text{H}^+ + \\text{Cl}^-$.\n", + "In reality a free $\\text{H}^+$ would react almost instantaneously with the nearest water molecule.\n", + "Nevertheless, we will use the \"$[\\text{H}^+]$\" notation below.\n", + "\n", + "Because in _strongly_ acidic or basic solutions, $[\\text{H}^+]$ and $[\\text{OH}^-]$ can vary by orders of magnitude, logarithmic measures are used:\n", + "\\begin{align}\n", + "\\text{pH} \\approx -\\log_{10} [\\text{H}^+] &\\quad&\n", + "\\text{pOH} \\approx -\\log_{10} [\\text{OH}^-]\n", + "\\end{align}\n", + "Like in the Nernst equation, the real definitions are in terms of [activities](https://en.wikipedia.org/wiki/Thermodynamic_activity) but these are usually approximated by the concentrations.\n", + "At room temperature the two measures are related by $\\text{pH} + \\text{pOH} \\approx 14$.\n", + "\n", + "Filling in the numbers, at a pH of 7.4 we find $[\\text{H}^+] \\approx 4 \\cdot 10^{-8}\\,\\text{M} = 4 \\cdot 10^{-5}\\,\\text{mM}$, and at a pH of 7.2 we obtain $6 \\cdot 10^{-5}$ mM.\n", + "Using $\\text{pOH} = 14 - \\text{pH}$ we can see that $[\\text{OH}^-]$ is similarly small.\n", + "**As a result, $[\\text{H}^+]$ and $[\\text{OH}^-]$ can be neglected in LJP calculations at physiological pH**.\n", + "Similarly, they can be omitted when calculating the total charge of the solution, or its \"ionic equivalence\" (see below)." + ] + }, + { + "cell_type": "markdown", + "id": "6f87f500-9ac3-446f-a2d7-b31b671f5198", + "metadata": {}, + "source": [ + "## From target concentration to free concentrations\n", + "\n", + "So far we have concentrated on the target concentrations.\n", + "The next question is what happens once all these ingredients dissolve and mix.\n", + "Salts like NaCl or KCl dissolve practically completely in water, and since there are typically no substances binding Na, K, or Cl in our solutions, we can assume that adding 10mM NaCl adds 10mM free $[\\text{Na}^+]$ and 10mM free $[\\text{Cl}^-]$.\n", + "\n", + "But other compounds are more complicated, including\n", + "\n", + "1. Buffers of the pH such as HEPES, which will exist in a protonated fraction ($[\\text{HEPES}]$) and a deprotonated fraction ($[\\text{HEPES}^-]$) which depends on the pH.\n", + "2. Other compounds with multiple protonation states, such as EGTA, which is added as uncharged $\\text{H}_4\\text{EGTA}$, but can lose up to four protons to become $\\text{EGTA}^{4-}$. At physiological pH, it exists almost exclusively as $\\text{H}_2\\text{EGTA}^{2-}$.\n", + "3. Compounds that bind to ions, for example [\"chelation\"](https://en.wikipedia.org/wiki/Chelation) of $\\text{Ca}^{2+}$ by EGTA, and of $\\text{Mg}^{2+}$ by ATP." + ] + }, + { + "cell_type": "markdown", + "id": "962f14e4-34c1-4f29-b78c-850692dc1852", + "metadata": {}, + "source": [ + "## Buffering with HEPES\n", + "\n", + "HEPES can exist as either $[\\text{HEPES}]$ or $[\\text{HEPES}^-]$, with the exact ratio between the two depending on the pH.\n", + "This is described by the [Henderson-Hasselbalch equation](https://en.wikipedia.org/wiki/Henderson%E2%80%93Hasselbalch_equation):\n", + "\\begin{align}\n", + "\\text{pH} = \\text{pK}_a + \\log_{10}\\left( \\frac{[\\text{HEPES}^-]}{[\\text{HEPES}]} \\right)\n", + "\\end{align}\n", + "Where $\\text{pK}_a = -\\log_{10} K_a$ is HEPES's [acid dissociation rate constant](https://en.wikipedia.org/wiki/Acid_dissociation_constant).\n", + "The \"a\" in \"pKa\" stands for \"acid\", which can be confusing, as the notation $K_a$ is also used to mean a general _association_ constant, equal to $1/K_a$ in the \"a for acid disassociation\" notation.\n", + "\n", + "We can combine the equation above with\n", + "\\begin{align}\n", + "[\\text{HEPES}^-] + [\\text{HEPES}] = [\\text{HEPES}]_\\text{added}\n", + "\\end{align}\n", + "to find\n", + "\\begin{align}\n", + "[\\text{HEPES}] = \\frac{[\\text{HEPES}]_\\text{added}}{1 + 10^{\\text{pH} - \\text{pK}_a}}\n", + "&&\\quad&&\n", + "[\\text{HEPES}^-] = \\frac{[\\text{HEPES}]_\\text{added}}{1 + 10^{\\text{pK}_a - \\text{pH}}}\n", + "\\end{align}\n", + "\n", + "A value for HEPES' pKA can be found e.g. [on this website](https://condor.depaul.edu/jmaresh/341/Lab1/Lab_1_Buffers4.html), which lists it as 7.55 at $20\\,^\\circ\\text{C}$, with a temperature dependent shift of -0.014 per degree celsius.\n", + "So, for example, if the pH of a solution with 10mM HEPES was set to 7.4 at $22\\,^\\circ\\text{C}$, the pKa was 7.522, yielding\n", + "\\begin{align}\n", + "[\\text{HEPES}] = 5.7\\,\\text{mM}\n", + "&&\\quad&&\n", + "[\\text{HEPES}^-] = 4.3\\,\\text{mM}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "5daa34ea-28d4-4d3c-8cf5-fda48449ac4d", + "metadata": {}, + "source": [ + "### Temperature change\n", + "\n", + "What happens if the temperature is changed _after the pH is set_?\n", + "\n", + "Here, [the same website](https://condor.depaul.edu/jmaresh/341/Lab1/Lab_1_Buffers4.html) says something confusing:\n", + "\n", + "> ... if you calculate the change in pKa with temperature, the pH of the buffer will change the same amount because changing the temperature will not change the ratio of the basic form to acid form ... raising the temperature of HEPES by 1.0 °C lowers both the pKa and pH by 0.014.\n", + "\n", + "In the light of the equation above, this sounds impossible: for the pH to change, HEPES must lose or gain protons, and so the protonation ratio _must_ change.\n", + "However, changing the pH from e.g. 7.2 to 7.1 implies a change from $6.3 \\cdot 10^{-5}\\,\\text{mM}$ free $\\text{H}^+$ to $7.9 \\cdot 10^-5\\,\\text{mM}$, so that the HEPES protonation ratio is _practically_ unchanged.\n", + "\n", + "If we set the pH at 22 degrees, but measure at $37\\,^\\circ\\text{C}$, the ratio of charged to uncharged HEPES will be roughly the same, and we can ignore the temperature change in our calculations.\n", + "The pH, however, will have changed.\n", + "**For this reason, it is always good to either set the pH at the temperature the experiments will be run**, or alternatively to calculate the expected shift and adjust for this accordingly." + ] + }, + { + "cell_type": "markdown", + "id": "6e504031-f2a7-4486-88fa-75238aef2044", + "metadata": {}, + "source": [ + "## $\\text{Ca}^{2+}$, EGTA, $\\text{Mg}^{2+}$, and ATP\n", + "\n", + "The free calcium concentration inside a cell is very low, and tightly controlled.\n", + "To recreate this situation in pipette solution, it is common to add a very strong calcium buffer, such as EGTA, and to choose the buffer-to-calcium ratio to achieve a specific micromolar free calcium concentration.\n", + "\n", + "ATP, the main source of energy inside cells, [requires magnesium to be active](https://en.wikipedia.org/wiki/Magnesium_in_biology)) and is present inside cells mostly as $\\text{MgATP}^{2-}$.\n", + "To recreate this in pipette solution, we either add both seperately (e.g. with $\\text{MgCl}_2$ and [ATP disodium salt](https://www.sigmaaldrich.com/GB/en/product/aldrich/a26209)) or already together (e.g. with [ATP magnesium salt hydrate](https://www.sigmaaldrich.com/GB/en/product/sigma/a9187)).\n", + "\n", + "In addition, EGTA can bind magnesium, and ATP can bind calcium.\n", + "And so, **if accurate estimates of free calcium are required**, all four must be considered simultaneously.\n", + "However, **approximate methods considering Ca-EGTA and Mg-ATP in isolation are sufficient to calculate the LJP**." + ] + }, + { + "cell_type": "markdown", + "id": "1041ada4-e55c-442f-86cf-c04ce6128446", + "metadata": {}, + "source": [ + "### Calcium and EGTA in isolation\n", + "\n", + "EGTA is a strong and highly specific calcium buffer.\n", + "In a solution with more EGTA than calcium, almost all calcium will be bound, and a change to the _total_ amount of calcium, $[\\text{Ca}]_\\text{total} = [\\text{Ca}^{2+}]_\\text{free} + [\\text{Ca}]_\\text{bound}$, will lead to a much smaller change in the amount of _free_ calcium.\n", + "\n", + "Besides its effect on $[\\text{Ca}^{2+}]_\\text{free}$, we need to take EGTA into account for the LJP because both free EGTA and bound CaEGTA can exist in multiple protonation states, and therefore have charges (see [Dweck, Reyes-Alfonso Jr., and Potter](https://doi.org/10.1016/j.ab.2005.09.025)).\n", + "To distinguish between the protonation states, we will refer to the [canonical molecule](https://en.wikipedia.org/wiki/EGTA) $\\text{C}_{14}\\text{H}_{24}\\text{N}_2\\text{O}_{10}$ as \"$\\text{H}_4\\text{EGTA}$\", and to the common deprotonated forms as $\\text{H}_3\\text{EGTA}^{-}$, $\\text{H}_2\\text{EGTA}^{2-}$ etc.\n", + "\n", + "To estimate the concentrations of free and bound calcium and EGTA (at physiological pH and room or body temperature), we make the following simplifying assumptions:\n", + "\n", + "1. All EGTA and $\\text{Ca}^{2+}$ that can bind, will bind.\n", + "2. All bound EGTA is present as $\\text{Ca}\\text{EGTA}^{2-}$\n", + "3. All free EGTA is present as $\\text{H}_2\\text{EGTA}^{2-}$\n", + "\n", + "Under these assumptions, the example solution with target concentrations of $1\\,\\text{mM}\\,[\\text{Ca}^{2+}]$ and $10\\,\\text{mM}\\,\\text{EGTA}$ will have $[\\text{CaEGTA}^{2-}] = 1\\,\\text{mM}$, $[\\text{H}_2\\text{EGTA}^{2-}] = 9\\,\\text{mM}$, and $[\\text{Ca}^{2+}]_\\text{free} = 0\\,\\text{mM}$.\n" + ] + }, + { + "cell_type": "markdown", + "id": "273ea330-7d38-4488-beba-147c20ddbff9", + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, + "source": [ + "### Magnesium and ATP in isolation\n", + "\n", + "Just like EGTA, ATP can lose up to four protons, and we will use \"$\\text{H}_4\\text{ATP}$\" for its [canonical form](https://en.wikipedia.org/wiki/Adenosine_triphosphate) $\\text{C}_{10}\\text{H}_{16}\\text{N}_5\\text{O}_{13}\\text{P}_3$.\n", + "Then, we make the following simplifying assumptions:\n", + "\n", + "1. All ATP and $\\text{Mg}^{2+}$ that can bind, will bind.\n", + "2. All bound ATP is present as $\\text{MgATP}^{2-}$.\n", + "3. All free ATP is present as either $\\text{ATP}^{4-}$ or $\\text{HATP}^{3-}$.\n", + "\n", + "In the example solution with target concentrations $[\\text{Mg}^{2+}]= 6\\,\\text{mM}$ and $[\\text{ATP}]= 5\\,\\text{mM}$ this gives $[\\text{MgATP}^{2-}]=5\\,\\text{mM}$, $[\\text{ATP}]_\\text{free}=0\\,\\text{mM}$, and $[\\text{Mg}^{2+}]=1\\,\\text{mM}$.\n", + "\n", + "In situations where we _do_ have free ATP, we can split $[\\text{ATP}]_\\text{free}$ into $[\\text{ATP}^{4-}]$ and $[\\text{HATP}^{3-}]$ using the same equations as for HEPES, and the $pK_a$ value of 6.5 given by [Stockbridge & Wolfenden](https://doi.org/10.1074/jbc.M109.017806)).\n", + "\\begin{align}\n", + "[\\text{ATP}^{4-}] = \\frac{[\\text{ATP}]_\\text{free}}{1 + 10^{\\text{pK}_a - \\text{pH}}}\n", + "&&\\quad&&\n", + "[\\text{HATP}^{3-}] = \\frac{[\\text{ATP}]_\\text{free}}{1 + 10^{\\text{pH} - \\text{pK}_a}}\n", + "\\end{align}\n", + "where\n", + "\\begin{align}\n", + "[\\text{ATP}]_\\text{free} = [\\text{ATP}^{4-}] + [\\text{HATP}^{3-}]\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "a81e5721-3ee6-46ea-a565-081e34d540b0", + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, + "source": [ + "### Considering all four at once\n", + "\n", + "If the free calcium concentration is critical for an experiment, interactions between $\\text{Ca}^{2+}$ and ATP and between $\\text{Mg}^{2+}$ and EGTA must be considered, and this can be done using online calculators.\n", + "Most famously, [Maxchelator](https://somapp.ucdmc.ucdavis.edu/pharmacology/bers/maxchelator/downloads.htm), described in [Bers, Patton & Nuccitelli 2010](https://doi.org/10.1016/S0091-679X(08)61108-5) is still available online (although backing up the HTML and hardcoded JS is recommended).\n", + "A more recent effort is [PyChelator](https://amrutelab.github.io/PyChelator/), which is available as a Colab notebook or in Javascript, and described in [Spahiu, Kastrati & Amrute-Nayak 2024](https://doi.org/10.1186/s12859-024-05858-8), with code on [GitHub](https://github.com/AmruteLab/PyChelator).\n", + "\n", + "Both programs require the following input:\n", + "\n", + "- The selection of a set of constants. To use, select the set that matches your experimental conditions best.\n", + "- Total (added) concentration of $\\text{Ca}^{2+}$, $\\text{Mg}^{2+}$, EGTA, and ATP\n", + "- The temperature and pH\n", + "- The \"ionic equivalence\", $I_e$, of the solution\n", + "\n", + "The last value is found as\n", + "\\begin{align}\n", + "I_e = \\frac{1}{2} \\sum{C_i |z_i|}\n", + "\\end{align}\n", + "where $C_i$ is the concentration of an ionic species, $|z_i|$ is the magnitude of its valence, and the sum is over all (charged) species in the solution.\n", + "For the choice of ionic equivalence over the more conventional ionic _strength_, $\\frac{1}{2} \\sum{C_i z_i^2}$, see [Smith & Miller, 1984](https://doi.org/10.1016/0304-4165(85)90011-X).\n", + "\n", + "The need for an ionic equivalence presents us with a slight problem, as it depends on the ionic concentrations we need to calculate.\n", + "Fortunately, the influence of $I_e$ is not particularly strong, and so we can use an estimate, for example based on the assumptions made above.\n", + "\n", + "To do the calculation, both programs\n", + "\n", + "1. Load a set of binding constants from the selected database.\n", + "2. Adjust the constants based on pH, temperature, and $I_e$, as described in the Bers et al. paper above.\n", + "3. Make an initial guess, and iteratively refine it.\n", + "\n", + "Both programs then return the free and bound fractions of Ca, Mg, EGTA, and ATP, but unfortunately not the exact concentrations of $[\\text{CaEGTA}^{2-}]$, $[\\text{MgEGTA}^{2-}]$, etc.\n", + "In Example notebook 1 we show how the simplifying assumptions above can be used to work these out." + ] + }, + { + "cell_type": "markdown", + "id": "d40904b0-1f94-4868-91a8-588a96f8bf7e", + "metadata": {}, + "source": [ + "## Calculating the LJP and reversal potentials\n", + "\n", + "Using the above, we can make a table of all free ionic species in the pipette and bath solutions.\n", + "These can then be fed into LJP calculators such as [LJPCalc](https://swharden.com/LJPcalc/).\n", + "\n", + "Reversal potentials for single-ion currents are calculated from the [Nernst equation](https://en.wikipedia.org/wiki/Nernst_equation):\n", + "\\begin{align}\n", + "E = \\frac{RT}{F} \\log \\frac{[\\text{X}]_e}{[\\text{X}]_i}\n", + "\\end{align}\n", + "where the subscripts $e$ and $i$ denote external (bath) and internal (pipette).\n", + "For multi-ion currents, the [Goldman–Hodgkin–Katz voltage equation](https://en.wikipedia.org/wiki/Goldman_equation) can be used." + ] + }, + { + "cell_type": "markdown", + "id": "59bbd0d4-6825-41b7-afc2-390e5ccd87f9", + "metadata": {}, + "source": [ + "## Estimating the uncertainty in target concentrations\n", + "\n", + "Next, we show how to estimate the uncertainty in calculated target concentrations due to uncertainty in total volume, added weight or volume, and purity of the added compounds." + ] + }, + { + "cell_type": "markdown", + "id": "42bce807-366b-473b-a319-9987279f8284", + "metadata": {}, + "source": [ + "### Propagation of uncertainty\n", + "\n", + "Given any function $f$ of a measurement $x \\pm \\Delta x$, we can estimate the error in $f(x)$ by taking a partial derivative and linearising:\n", + "\\begin{align}\n", + "\\Delta f = \\left| \\frac{\\partial f}{\\partial x} \\right| \\Delta x\n", + "\\end{align}\n", + "For multiple _independent_ measurements, we can extend this to e.g.\n", + "\\begin{align}\n", + "f(x, y, z) \\rightarrow \\Delta f = \\sqrt{\n", + " \\left( \\frac{\\partial f}{\\partial x} \\Delta x \\right)^2 +\n", + " \\left( \\frac{\\partial f}{\\partial y} \\Delta y \\right)^2 +\n", + " \\left( \\frac{\\partial f}{\\partial z} \\Delta z \\right)^2}\n", + "\\end{align}\n", + "See e.g. [wikipedia on \"propagation of uncertainty\"](https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Non-linear_combinations).\n", + "For intuition, we can use probability theory to interpret $\\Delta f$ as a variance, or think geometrically and interpret it as a distance.\n", + "\n", + "Below, we write the target concentration as a function of the added weight or volume, the final volume, and purity and then work out how their measurement accuracy affects the final concentration." + ] + }, + { + "cell_type": "markdown", + "id": "504a66ba-da97-4a20-8397-2e422250e6a7", + "metadata": {}, + "source": [ + "### Adding by weight\n", + "\n", + "To estimate the error when adding substances by weight, we start by writing the equation for the _obtained_ concentration $C$ as a function of total volume $V$, molecular weight $M$, and the added weight $m_a$:\n", + "\\begin{align}\n", + "C = \\frac{m_a}{M \\cdot V} && \\quad && \\frac{\\text{mmol}}{\\text{L}} = \\frac{\\text{mg}}{\\text{g}/\\text{mol} \\cdot \\text{L}}\n", + "\\end{align}\n", + "Note that $m_a$ is an independent variable: it represents the amount we actually added and so, unlike the variable $m$ above, it is independent of $M$, $V$ or $p$.\n", + "Similarly, we have replaced the _target_ concentration, $C_t$, which was a free variable, with the concentration $C$ which is a function of $m_a$, $M$, and $V$.\n", + "\n", + "We expect some error in our measured $m_a$ and $V$, and so we will have at least two terms in our error equation:\n", + "\\begin{align}\n", + "\\frac{\\partial C}{\\partial m_a} \\Delta m_a &= \\frac{1}{M \\cdot V} \\Delta m_a = \\frac{\\Delta m_a}{m_a}C \\\\\n", + "\\frac{\\partial C}{\\partial V} \\Delta V &= -\\frac{m_a}{M \\cdot V^2} \\Delta V = -\\frac{\\Delta V}{V}C\n", + "\\end{align}\n", + "The molecular weight $M$ will be treated as accurate, with any deviations from $M$ attributed to the purity discussed below.\n", + "Combining and dividing by the repeated $C$ term, we find\n", + "\\begin{align}\n", + "\\frac{\\Delta C}{C} &= \\sqrt{\\left(\\frac{\\Delta m_a}{m_a}\\right)^2 + \\left(\\frac{\\Delta V}{V}\\right)^2}\n", + "\\end{align}\n", + "This means that we can either use absolute errors (fill in both $x$ and $\\Delta x$) or relative errors (fill in a single value for $\\frac{\\Delta x}{x}$)." + ] + }, + { + "cell_type": "markdown", + "id": "7aa398b6-98e2-4aee-ac9a-5564c496d808", + "metadata": {}, + "source": [ + "#### Including the lower bound on purity\n", + "\n", + "To extend the analysis to purity, we need to convert the given lower bound (e.g. $\\geq 90\\%$) to a symmetrical error around a central point.\n", + "**Using only the information on the bottle**, there are multiple ways we could try to do this.\n", + "Three examples using $p=0.9$ are shown below." + ] + }, + { + "cell_type": "markdown", + "id": "20de4c7d-6d75-4e0a-a721-9d5c405f86bb", + "metadata": {}, + "source": [ + "" + ] + }, + { + "cell_type": "markdown", + "id": "efe38da2-1362-475e-9340-cf09e928543e", + "metadata": {}, + "source": [ + "In the first scenario, shown on the left, no adjustment for purity was made when weighing.\n", + "This means that the true concentration, $C$, could be up to a factor $p$ lower than the reported target concentration, $C_t$.\n", + "Taking the (optimistic) view that true purity is anywhere on the interval $[p, 1]$, we can now introduce a scaling factor, $q$, which is centered on this interval and has an error, $\\Delta q$, of half the interval width:\n", + "\\begin{align}\n", + "C = \\frac{m_a \\cdot q}{M \\cdot V}\n", + "& \\quad &\n", + "q = \\frac{1 + p}{2} \\leq 1\n", + "& \\quad &\n", + "\\Delta q = \\frac{1 - p}{2}\n", + "\\end{align}\n", + "\n", + "Note that $q$ has introduced a _bias_.\n", + "In this scenario, we no longer believe the actual concentration $C$ to be the target concentration, $C_t$, but to be a factor $q$ lower." + ] + }, + { + "cell_type": "markdown", + "id": "fb9790fa-9fb1-40c7-9f00-28ba4a9388a1", + "metadata": {}, + "source": [ + "In the second scenario, shown in the middle, we have included the purity when calculating the weight to add.\n", + "Again assuming a true purity on the interval $[p, 1]$, we would now assume the true concentration lies on $[1, 1 / p]$:\n", + "\\begin{align}\n", + "C = \\frac{m_a \\cdot q}{M \\cdot V}\n", + "& \\quad &\n", + "q = \\frac{1 + p}{2p} \\geq 1\n", + "& \\quad &\n", + "\\Delta q = \\frac{1 - p}{2 p}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "562d5ca7-d233-4bec-9577-672ed39f2cf7", + "metadata": {}, + "source": [ + "In either scenario, we end up with\n", + "\\begin{align}\n", + "\\frac{\\Delta C}{C} &= \\sqrt{\\left(\\frac{\\Delta m_a}{m_a}\\right)^2 + \\left(\\frac{\\Delta V}{V}\\right)^2 + \\left(\\frac{\\Delta q}{q}\\right)^2}\n", + "\\end{align}\n", + "where\n", + "\\begin{align}\n", + "\\frac{\\Delta q}{q} = \\frac{1 - p}{1 + p}\n", + "\\end{align}\n", + "This means the _relative error_ in both cases is the same - although the absolute error is not." + ] + }, + { + "cell_type": "markdown", + "id": "37ac8bbb-bac2-40a1-b112-98ceeeb9d5fe", + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, + "source": [ + "#### How do we report this?\n", + "\n", + "In these first two scenarios, we end up having to report a concentration $C$ other than our intended concentration $C_t$.\n", + "This can be confusing and may be hard to defend: if we do believe the best estimate of purity is $\\frac{1}{2}(1 + p)$, then why not calculate the weight to add using this factor?\n", + "Depending on the production process, we might also believe the true purity to be much closer to $p$ than to 1, so that stating $C$ to be $q \\cdot C_t$ may not reflect our belief well.\n", + "On the other hand, unless the experimenter took great care, the exact weight added, $m_a$, will almost always be slightly different from the intended weight $m$, but $C_t$ is still almost always the value reported - so this is not unheard of.\n", + "\n", + "The best solution may be to present the data as the intended $C_t$, and a (possibly assymetric) error bound." + ] + }, + { + "cell_type": "markdown", + "id": "00bcf0ac-d8cb-4ed3-bc2d-462b2964621f", + "metadata": {}, + "source": [ + "#### What if we have more data?\n", + "\n", + "If the certificate of analysis for the used product is available, it may be possible to use the measured purity value, calculate $m_a$ using this value, use $q = 1$ and set $\\Delta q$ based on the estimated accuracy of the assay or simply to $\\Delta q = 0$.\n", + "\n", + "If the product but not the lot number is known, it might be possible to scan the certificates of different lots, and build a confidence interval around purity based on typical values." + ] + }, + { + "cell_type": "markdown", + "id": "cda3d9df-c5a2-4b67-b7ae-3cf2cb03d823", + "metadata": {}, + "source": [ + "#### Unknown purity correction\n", + "\n", + "In the third scenario, on the right of the diagram, we show the situation where it is unknown whether weight was adjusted for purity.\n", + "In this case, we have an assymetrical range around the reported concentration, $C_t$, such that\n", + "\\begin{align}\n", + "C \\in [C_t \\cdot p, C_t / p]\n", + "&& \\quad \\text{or} \\quad &&\n", + "q \\in [p, 1 / p]\n", + "\\end{align}\n", + "To obtain a symmetrical error, we can choose the upper bound \n", + "\\begin{align}\n", + "q = 1 && \\quad && \\Delta q = \\frac{1 - p}{p} \n", + "\\end{align}\n", + "This works well for high purities, e.g. $p=0.9$ gives $\\frac{1 - p}{p} \\approx 0.11$, but fails for larger impurities, for example $p=0.5$ gives $\\frac{1 - 0.5}{0.5} = 1$ for $C \\in [0, 2 C_t]$.\n", + "Choosing the lower bound instead, we find\n", + "\\begin{align}\n", + "q = 1 && \\quad && \\Delta q = 1 - p \n", + "\\end{align}\n", + "This underestimates the higher bound a bit, but is possibly a more realistic option, as the range we lose is that where the true purity approaches 100%." + ] + }, + { + "cell_type": "markdown", + "id": "c0ade19f-33a3-4efa-bf11-0b0afd16ad99", + "metadata": {}, + "source": [ + "Note that in this scenario, **the added weight is also unknown**.\n", + "If it was known, we could work out whether purity was included in its calculation.\n", + "We could however, still do the analysis by using an estimated relative error $\\Delta m / m$." + ] + }, + { + "cell_type": "markdown", + "id": "7545bff0-a630-4525-9418-ac7ad8794ef7", + "metadata": {}, + "source": [ + "#### Multiple \"purities\"\n", + "\n", + "If, in addition to purity, we need to include loss on drying or other complications, we have two options.\n", + "\n", + "First, if we believe the true values to be close to the given (lower or upper) bounds, we can simply multiply both factors together.\n", + "For example, a purity of $\\geq 99\\%$ and a loss on drying of $\\leq 1\\%$ can be interpreted as a combined bound\n", + "\\begin{align}\n", + "p \\leq 0.99 (1 - 0.01) \\approx 0.98\n", + "\\end{align}\n", + "\n", + "Alternatively, if we believe the true value could be anywhere in the bound (for example with a high water content), we can treat both purities as independent variables, and add separate terms to the error equation.\n", + "\\begin{align}\n", + "C &= \\frac{m_a \\cdot q_1 (1 - q_2)}{M \\cdot V} \\\\\n", + "\\frac{\\partial C}{\\partial q_1} \\Delta q_1 &= \\frac{m_a \\cdot (1 - q_2)}{M \\cdot V} \\Delta q_1 = \\frac{\\Delta q_1}{q_1} C \\\\\n", + "\\frac{\\partial C}{\\partial q_2} \\Delta q_2 &= \\frac{m_a \\cdot q_1}{M \\cdot V} \\Delta q_2 = \\frac{\\Delta q_2}{1 - q_2} C\n", + "\\end{align}\n", + "Where the $q_i$ and $\\Delta q_i$ values are set as above." + ] + }, + { + "cell_type": "markdown", + "id": "cda49632-82f7-4faa-b727-d26e41e99254", + "metadata": {}, + "source": [ + "### Adding by volume\n", + "\n", + "The obtained concentration after adding a volume $V_a$ of stock solution with molar concentration $C_s$ is\n", + "\\begin{align}\n", + "C = \\frac{C_s \\cdot V_a}{V}\n", + "&& \\quad &&\n", + "\\frac{\\text{mmol}}{\\text{L}} = \\frac{\\text{mmol}}{\\text{L}} \\frac{\\text{mL}}{\\text{mL}}\n", + "\\end{align}\n", + "Note that, as with added weight $m_a$, the added volume $V_a$ is now a free variable.\n", + "For the error we find\n", + "\\begin{align}\n", + "\\frac{\\Delta C}{C} = \\sqrt{\n", + " \\left( \\frac{\\Delta C_s}{C_s} \\right)^2 +\n", + " \\left( \\frac{\\Delta V_a}{V_a} \\right)^2 +\n", + " \\left( \\frac{\\Delta V}{V} \\right)^2 \n", + "}\n", + "\\end{align}\n", + "where the first term can be omitted if the uncertainty in $C_s$ is suspected to be small." + ] + }, + { + "cell_type": "markdown", + "id": "c6f99138-e15e-408d-81aa-8918984ce7ba", + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, + "source": [ + "### Using the estimated uncertainties\n", + "\n", + "In the next two notebooks, we show how to use the equations above to place error bounds on the free concentrations, and we look at the effect this might have on the calculated LJP.\n", + "\n", + "Note that, **when propagating the obtained errors or boundaries, correlation must be taken into account**.\n", + "This includes\n", + "\n", + "- Correlations between free ions added as compounds. For example, a charge imbalance in the estimated concentrations can not be explained by setting Na to a lower bound and Cl to a higher bound if they were added together as NaCl.\n", + "- Correlations between errors due to total volume. If this is the main source of error within a solution, all errors in that solution will be strongly correlated.\n" + ] + }, + { + "cell_type": "markdown", + "id": "fb8ea483-27c1-46b5-bbfe-53f3a554b099", + "metadata": {}, + "source": [ + "## Osmolarity\n", + "\n", + "Finally, we very briefly discuss [osmolarity](https://en.wikipedia.org/wiki/Osmotic_concentration).\n", + "This is very important when devising a set of solutions, as a mismatch between osmolarities will cause cells to shrink or swell.\n", + "In patch clamp, it is seen as [good practice](https://www.scientifica.uk.com/neurowire/electrophysiology-what-goes-on-the-inside) to give the external solution a slightly higher osmolarity.\n", + "\n", + "Osmolarity is expressed in _Osmoles_ (Osm), with one osmole [defined as](https://en.wiktionary.org/wiki/osmole):\n", + "\n", + "> [one] mole of an osmotically active compound\n", + "\n", + "so if we decide all our compounds are \"osmotically active\", we can equate 1 mM with 1 mOsm.\n", + "\n", + "Osmolarity can be estimated directly from the target concentrations, using\n", + "\\begin{align}\n", + "\\sum \\phi_i n_i C_{t,i} \\approx \\sum n_i C_{t,i}\n", + "\\end{align}\n", + "where $C_{t, i}$ is the target concentration for compound $i$ and $n_i$ is the number of particles the compound dissociates into (see below).\n", + "The [osmotic coefficient](https://en.wikipedia.org/wiki/Osmotic_coefficient) $\\phi_i \\approx 1$ can be used to account for non-ideality of the dissociation.\n", + "\n", + "The value of $n_i$ is 1 for HEPES, glucose, and sucrose; 2 for NaCl and KCl; and 3 for CaCl2.\n", + "But for Ca, Mg, EGTA, and ATP we need to take binding after disassociation into account, which would give a fractional $n_i$.\n", + "Instead of going down this route, we can use our estimated free concentrations to calculate\n", + "\\begin{align}\n", + "\\sum C_{f,i}\n", + "\\end{align}\n", + "Examples of this are given in the next two notebooks." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tutorial/appendix/s-solutions/2-example-1.ipynb b/tutorial/appendix/s-solutions/2-example-1.ipynb new file mode 100644 index 0000000..dec73a0 --- /dev/null +++ b/tutorial/appendix/s-solutions/2-example-1.ipynb @@ -0,0 +1,797 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "58a80576-d029-4e96-851a-07c1093b7ddd", + "metadata": {}, + "source": [ + "# G2: Example 1, $\\text{I}_\\text{Kr}$ experiments\n", + "\n", + "**This example** describes a set of solutions used in $\\text{I}_\\text{Kr}$ experiments (and as the example in the previous notebook).\n", + "They were prepared and pH adjusted at a room temperature of $22\\pm1\\,^\\circ\\text{C}$, but patch clamp experiments were performed at $37^\\circ\\text{C}$.\n", + "\n", + "**Summary**: In this example, the total volume is set very carefully, and the purity of the compounds becomes the main source of error.\n", + "We show how PyChelator can be used to calculate Ca-Mg-EGTA-ATP interactions, but how this does not affect the LJP.\n", + "The pH adjustment shifts the reversal potential by several millivolts." + ] + }, + { + "cell_type": "markdown", + "id": "a1a79b85-f9b1-4d4b-950b-6d91c2990b05", + "metadata": {}, + "source": [ + "## The bath solution\n", + "\n", + "| Compound | $C_t$ | $M$ | $p$ | $C_s$ | Example product |\n", + "|----------|----------|--------------|---------------|-------|-----------------|\n", + "| NaCl | 140 mM | 58.44 g/mol | $\\geq 99\\%$ | | [S9888](https://www.sigmaaldrich.com/GB/en/product/sigald/s9888) |\n", + "| KCl | 4 mM | 74.55 g/mol | $\\geq 99\\%$ | | [P5405](https://www.sigmaaldrich.com/GB/en/product/sigma/p5405) |\n", + "| CaCl2 | 1.8 mM | | | 1 M | [21115](https://www.sigmaaldrich.com/GB/en/product/sigma/21115) |\n", + "| MgCl2 | 1 mM | | | 1 M | [M8266](https://www.sigmaaldrich.com/GB/en/product/sigma/m8266) |\n", + "| HEPES | 10 mM | 238.3 g/mol | $\\geq 99.5\\%$ | | [H3375](https://www.sigmaaldrich.com/GB/en/product/sigma/h3375) |\n", + "| Glucose | 10 mM | 180.16 g/mol | $\\geq 99.5\\%$ | | [G8270](https://www.sigmaaldrich.com/GB/en/product/sigma/g8270) |\n", + "| Sucrose | 15 mM | 342.30 g/mol | $\\geq 99.5\\%$ | | [S0389](https://www.sigmaaldrich.com/GB/en/product/sigma/s0389) | " + ] + }, + { + "cell_type": "markdown", + "id": "d4e53c73-4c0e-4e70-b819-32595a03d665", + "metadata": {}, + "source": [ + "### pH adjustment and volume change\n", + "\n", + "The solution was mixed in a 1L volume, and adjusted to pH 7.4 using NaOH:\n", + "\n", + "> I added 4.16ml of 1M NaOH (measured using a P200 pipette - I actually added 17x 200ul + 14x50ul + 3x20ul) to get it to a pH of 7.4\n", + "\n", + "The final volume was set _after_ the pH adjustment, so that the added $[\\text{Na}^+]$ is\n", + "\\begin{align}\n", + "4.16\\,\\text{mL} \\cdot 1\\,\\frac{\\text{mol}}{\\text{L}} / 1\\,\\text{L} = 4.16\\,\\text{mM}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "6660f1fa-a0f4-432f-869f-7bad7bdf7fd9", + "metadata": {}, + "source": [ + "### Simple ions\n", + "\n", + "The salts ($\\text{NaCl}$, $\\text{KCl}$, $\\text{MgCl}_2$, and $\\text{CaCl}_2$) will fully dissolve, and no substances were added that will bind the dissociated ions.\n", + "Therefore, we have a total of 144.16 mM $\\text{Na}^+$, 4 mM $\\text{K}^+$, 1.8 mM $\\text{Ca}^{2+}$, 1 mM $\\text{Mg}^{2+}$, and $140 + 4 + 2 \\cdot 1.8 + 2 \\cdot 1 = 149.6\\,\\text{mM}$ $\\text{Cl}^-$." + ] + }, + { + "cell_type": "markdown", + "id": "c26344a6-b8c6-40f2-810b-62b229868d58", + "metadata": {}, + "source": [ + "### pH buffer\n", + "\n", + "HEPES' pKa is 7.55 at $20\\,^\\circ\\text{C}$ and shifts by -0.014 per $^\\circ\\text{C}$, for a value of 7.522 at $22\\,^\\circ\\text{C}$:\n", + "\\begin{align}\n", + "[\\text{HEPES}^-] = \\frac{[\\text{HEPES}]_\\text{added}}{1 + 10^{\\text{pK}_a - \\text{pH}}} \\approx 4.3\\,\\text{mM}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "1b572b52-abf6-4aef-8581-2de2befb8fc5", + "metadata": {}, + "source": [ + "### Free ion concentrations\n", + "\n", + "| Solute | mM added | mM free | Total charge | Total solutes |\n", + "|------------------|----------|---------|--------------|---------------|\n", + "| $\\text{Na}^+$ | 144.16 | 144.16 | +144.16 | 144.16 |\n", + "| $\\text{K}^+$ | 4 | 4 | +148.16 | 148.16 |\n", + "| $\\text{Cl}^-$ | 149.6 | 149.6 | - 1.44 | 297.76 |\n", + "| $\\text{Ca}^{2+}$ | 1.8 | 1.8 | + 2.16 | 299.56 |\n", + "| $\\text{Mg}^{2+}$ | 1 | 1 | + 4.16 | 300.56 |\n", + "| $\\text{HEPES}$ | 10 | 5.7 | | 306.26 |\n", + "| $\\text{HEPES}^-$ | | 4.3 | - 0.14 | 310.56 |\n", + "| Glucose | 10 | 10 | | 320.56 |\n", + "| Sucrose | 15 | 15 | | 335.56 |\n", + "\n", + "Here the final column shows the solution's osmolarity." + ] + }, + { + "cell_type": "markdown", + "id": "d1bb9e3f-5305-4a31-9877-ce2a93ca89dc", + "metadata": {}, + "source": [ + "### Charge balance\n", + "\n", + "In the \"Total charge\" column we have summed the charges of all free ions.\n", + "This should add up to zero, and indeed the result is very close.\n", + "\n", + "To make this calculation easier, we could have focussed only on the components that interact with water: NaOH and HEPES.\n", + "\\begin{align}\n", + "4.16 - 4.3 = -0.14\n", + "\\end{align}\n", + "\n", + "This suggests that\n", + "\n", + "1. The remaining error is due to the pH adjustment and/or $[\\text{HEPES}^-]$ calculation.\n", + "2. If we had not measured the added NaOH, we could have estimated it as 4.3 mM.\n" + ] + }, + { + "cell_type": "markdown", + "id": "4432f33b-50f2-48cf-949a-625ad3e97fa9", + "metadata": {}, + "source": [ + "## Pipette solution" + ] + }, + { + "cell_type": "markdown", + "id": "a9a87f36-6456-4cb7-81c6-0eac44606d6d", + "metadata": {}, + "source": [ + "| Compound | $C_t$ | $M$ | $p$ | $C_s$ | Example |\n", + "|----------|----------|--------------|---------------|-------|---------|\n", + "| KCl | 130 mM | 74.55 g/mol | $\\geq 99\\%$ | | [P5405](https://www.sigmaaldrich.com/GB/en/product/sigma/p5405) |\n", + "| MgCl2 | 1 mM | 95.21 g/mol | $\\geq 98\\%$ | | [M8266](https://www.sigmaaldrich.com/GB/en/product/sigma/m8266) |\n", + "| CaCl2 | 1 mM | | | 1 M | [21115](https://www.sigmaaldrich.com/GB/en/product/sigma/21115) |\n", + "| EGTA | 10 mM | 380.35 g/mol | $\\geq 97\\%$ | | [E3889](https://www.sigmaaldrich.com/GB/en/product/sigma/e3889) |\n", + "| Mg2+ ATP | 5 mM | 507.18 g/mol | $\\geq 95\\%$ * | | [A9187](https://www.sigmaaldrich.com/GB/en/product/sigma/a9187) |\n", + "| HEPES | 10 mM | 238.3 g/mol | $\\geq 99.5\\%$ | | [H3375](https://www.sigmaaldrich.com/GB/en/product/sigma/h3375) |\n", + "\n", + "The $\\text{ATP}\\cdot\\text{Mg}^{2+}$ product has an unspecified ratio of Mg to ATP." + ] + }, + { + "cell_type": "markdown", + "id": "cab1fe49-0d05-4714-84aa-6ccc31c95fe5", + "metadata": {}, + "source": [ + "### pH adjustment and volume change\n", + "\n", + "The solution was mixed in a 100mL volume, and adjusted to pH 7.2 using KOH:\n", + "\n", + "> I added 3.6ml of 1M KOH (measured using a P200 pipette - I actually added 17x 200ul + 2x 100ul) to get it to a pH of 7.2\n", + "\n", + "The final volume was set _after_ the pH adjustment, so that the added $[\\text{K}^+]$ is\n", + "\\begin{align}\n", + "3.6\\,\\text{mL} \\cdot 1\\,\\frac{\\text{mol}}{\\text{L}} / 0.1\\,\\text{L} = 36\\,\\text{mM}\n", + "\\end{align}\n", + "\n", + "**Note:** Since both solutions needed about 4mM adjustment, it is tempting to blame the smaller volume of prepared solution for the much larger change in concentration. However, the amount of adjustment reflects the acidity of the components, which is far higher for this solution. If we had mixed up 1L of pipette solution, we would have needed 36 mL KOH." + ] + }, + { + "cell_type": "markdown", + "id": "262d3825-63bf-487a-9ee7-6848b71cf41d", + "metadata": {}, + "source": [ + "### Simple ions\n", + "\n", + "For potassium and chloride we can immediately write down $[\\text{K}^+] = 130 + 36 = 166\\,\\text{mM}$ and $[\\text{Cl}^-] = 130 + 2 \\cdot 1 + 2 \\cdot 1 = 134\\,\\text{mM}$." + ] + }, + { + "cell_type": "markdown", + "id": "c97d08f7-d1bc-4626-9f13-30e8c86b7ada", + "metadata": {}, + "source": [ + "### pH buffer\n", + "\n", + "For HEPES, we use pKa=7.522 and pH=7.2 for\n", + "\\begin{align}\n", + "[\\text{HEPES}^-] = \\frac{[\\text{HEPES}]_\\text{added}}{1 + 10^{\\text{pK}_a - \\text{pH}}} \\approx 3.2\\,\\text{mM}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "45787b61-b3f6-460f-a193-69719f782222", + "metadata": {}, + "source": [ + "### Ca and EGTA\n", + "\n", + "For Ca and EGTA we use the simplifying assumptions to find no free calcium; 1 mM $\\text{CaEGTA}^{2-}$; and 9 mM $\\text{H}_2\\text{EGTA}^{2-}$." + ] + }, + { + "cell_type": "markdown", + "id": "ee8b3be2-7977-44d7-a735-fe2fc3c737fa", + "metadata": {}, + "source": [ + "### Mg and ATP\n", + "\n", + "For Mg and ATP we have more Mg than ATP, so we will assume _no free ATP_ and 5 mM $\\text{MgATP}^{2-}$, while the remaining 1mM $\\text{Mg}^{2+}$ os free.\n", + "\n", + "From the previous notebook, we also suspect ATP content could be up to 7% lower, and Mg added with ATP up to 40% higher, which we will add more free Mg and will be dealt with below." + ] + }, + { + "cell_type": "markdown", + "id": "745866bc-9d0a-47cb-a567-316e4aebefb6", + "metadata": {}, + "source": [ + "### Free ion concentrations\n", + "\n", + "| Solute | mM added | mM free | Total charge | Total abs(charge)| Total solutes |\n", + "|------------------------------|----------|---------|--------------|------------------|---------------|\n", + "| $\\text{K}^+$ | 166 | 166 | +166 | 166 | 166 |\n", + "| $\\text{Cl}^-$ | 134 | 134 | + 32 | 300 | 300 |\n", + "| $\\text{Ca}^{2+}$ | 1 | | | | |\n", + "| $\\text{CaEGTA}^{2-}$ | | 1 | + 30 | 302 | 301 |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | | 9 | + 12 | 320 | 310 |\n", + "| $\\text{H}_4\\text{EGTA}$ | 10 | | | | |\n", + "| $\\text{Mg}^{2+}$ | 1 | 1 | + 14 | 322 | 311 |\n", + "| $\\text{MgATP}^{2-}$ | 5 | 5 | + 4 | 332 | 316 |\n", + "| $\\text{HATP}^{3-}$ | | | | | |\n", + "| $\\text{ATP}^{4-}$ | | | | | |\n", + "| $\\text{HEPES}$ | 10 | 6.8 | | | 322.8 |\n", + "| $\\text{HEPES}^-$ | | 3.2 | + 0.8 | 335.2 | 326 |\n", + "\n", + "The calculated charge balance is off by +0.8 mM, which is not a lot, and is perhaps explained by the unaccounted-for presence of some $\\text{HATP}^{3-}$ or $\\text{ATP}^{4-}$.\n", + "However, the extra $\\text{Mg}^{2+}$ that may have come in with the ATP is also not listed, and would be expected to add more _positive_ charge.\n", + "\n", + "In addition to total charge, the table lists the total _absolute_ charge, from which ionic equivalence can be calculated, and the osmolarity.\n", + "We will make use of these columns below" + ] + }, + { + "cell_type": "markdown", + "id": "1592bfca-13ea-401a-bc9b-859d24230663", + "metadata": {}, + "source": [ + "### Charge balance\n", + "\n", + "As before, without measuring the added KOH we could have made an estimate by looking at the interactions with water:\n", + "\n", + "- 9 mM EGTA loses 2 protons, for -18 mM charge\n", + "- 1 mM EGTA loses 4 protons, for -4 mM charge, total -22 mM\n", + "- 5 mM MgATP loses 2 protons, for -10 mM charge, total -32 mM\n", + "- 3.2 mM HEPES loses 1 proton, for -3.2 mM charge, total -35.2 mM\n", + "\n", + "In which case we would have estimated 3.52 mL was added." + ] + }, + { + "cell_type": "markdown", + "id": "c598911d-69d9-4524-a1ec-606a831925b7", + "metadata": {}, + "source": [ + "### Refining the concentrations with Pychelator\n", + "\n", + "To get a more detailed estimate of the Ca, Mg, EGTA, and ATP concentrations, we use the above table to estimate ionic equivalence as $I_e \\approx \\frac{1}{2} 335.2 = 167.6$, and fill this into PyChelator, along with 22 degrees celsius, pH 7.2, and \"EGTA-ATP (NIST)\" constants, to find\n", + "\n", + "| Solute | Total mM | Free mM |\n", + "|---------|----------|-----------|\n", + "| Ca | 1 | 0 (20 nM) |\n", + "| Mg | 6 | 1.05 |\n", + "| ATP | 5 | 0.55 |\n", + "| EGTA | 10 | 8.5 |\n", + "\n", + "(We used 100% purity, as we will deal with this separately below).\n", + "\n", + "To further subdivide this, (the software presumably knows, but does not to tell us), we again assume that all Ca is bound to EGTA (no Ca is bound to ATP).\n", + "This would mean that the EGTA that is not free or bound to Ca has bound Mg instead.\n", + "With this assumption, the full table looks like this:\n", + "\n", + "| Solute | Free mM | Ca total | Mg total | ATP total | EGTA total | Why\n", + "|------------------------------|---------|----------|----------|-----------|------------|------------------------|\n", + "| $\\text{Ca}^{2+}$ | 0 | | | | | Reported by PyChelator |\n", + "| $\\text{Mg}^{2+}$ | 1.05 | | 1.05 | | | Reported by PyChelator |\n", + "| $\\text{ATP}_\\text{free}$ | 0.55 | | | 0.55 | | Reported by PyChelator |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | 8.5 | | | | 8.5 | Reported by PyChelator |\n", + "| $\\text{CaEGTA}^{2-}$ | 1 | 1 | | | 9.5 | All Ca bound to EGTA |\n", + "| $\\text{MgEGTA}^{2-}$ | 0.5 | | 1.55 | | 10 | Remaining EGTA |\n", + "| $\\text{MgATP}^{2-}$ | 4.45 | | 6 | 5 | | Remaining ATP |\n", + "\n", + "Next, we split up $\\text{ATP}_\\text{free}$ into its different protonation states, using\n", + "\n", + "\\begin{align}\n", + "[\\text{ATP}^{4-}] = \\frac{[\\text{ATP}]_\\text{free}}{1 + 10^{\\text{pK}_a - \\text{pH}}}\n", + "&&\\quad&&\n", + "[\\text{HATP}^{3-}] = \\frac{[\\text{ATP}]_\\text{free}}{1 + 10^{\\text{pH} - \\text{pK}_a}}\n", + "\\end{align}\n", + "with $\\text{pH}=7.2$ and $\\text{pKa}=6.5$ ([Stockbridge & Wolfenden](https://doi.org/10.1074/jbc.M109.017806)) to find $[\\text{ATP}^{4-}]=0.46\\,\\text{mM}$ and $[\\text{HATP}^{3-}]=0.09\\,\\text{mM}$, for\n", + "\n", + "| Solute | mM added | mM free | Total charge | Total abs(charge)| Total solutes |\n", + "|------------------------------|----------|---------|--------------|------------------|---------------|\n", + "| $\\text{K}^+$ | 166 | 166 | +166 | 166 | 166 |\n", + "| $\\text{Cl}^-$ | 134 | 134 | + 32 | 300 | 300 |\n", + "| $\\text{Ca}^{2+}$ | 1 | | | | |\n", + "| $\\text{CaEGTA}^{2-}$ | | 1 | + 30 | 302 | 301 |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | | 8.5 | + 13 | 319 | 309.5 |\n", + "| $\\text{H}_4\\text{EGTA}$ | 10 | | | | |\n", + "| $\\text{Mg}^{2+}$ | 1 | 1.05 | + 15.1 | 321.1 | 310.55 |\n", + "| $\\text{MgATP}^{2-}$ | 5 | 4.45 | + 6.2 | 330 | 315 |\n", + "| $\\text{MgEGTA}^{2-}$ | | 0.5 | + 5.2 | 331 | 315.5 |\n", + "| $\\text{HATP}^{3-}$ | | 0.09 | + 4.93 | 331.27 | 315.59 |\n", + "| $\\text{ATP}^{4-}$ | | 0.46 | + 3.09 | 333.11 | 316.05 |\n", + "| $\\text{HEPES}$ | 10 | 6.8 | | | 322.85 |\n", + "| $\\text{HEPES}^-$ | | 3.2 | - 0.11 | 336.31 | 326.05 |\n", + "\n", + "The total charge column now shows a slight deficit, which could be explained by the unaccounted for magnesium.\n", + "The total absolute charge is very similar to before, so that our $I_e$ estimate seems allowable, and the osmolarity is virtually unchanged." + ] + }, + { + "cell_type": "markdown", + "id": "ef5febdd-58dc-4bc9-9703-b376fab27629", + "metadata": {}, + "source": [ + "## Combined table\n", + "\n", + "We can now table the free ion concentrations from both solutions:\n", + "\n", + "| Ion | mM int | mM ext | Mobility |\n", + "|------------------------------|--------|--------|------------------|\n", + "| $\\text{Na}^+$ | | 144.16 | In LJPCalc |\n", + "| $\\text{K}^+$ | 166 | 4 | In LJPCalc |\n", + "| $\\text{Cl}^-$ | 134 | 149.6 | In LJPCalc |\n", + "| $\\text{Ca}^{2+}$ | | 1.8 | In LJPCalc |\n", + "| $\\text{CaEGTA}^{2-}$ | 1 | | Approx EGTA(2-) |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | 8.5 | | In LJPCalc |\n", + "| $\\text{Mg}^{2+}$ | 1.05 | 1 | In LJPCalc |\n", + "| $\\text{MgATP}^{2-}$ | 4.45 | | Approx ATP(2-) |\n", + "| $\\text{MgEGTA}^{2-}$ | 0.5 | | Approx EGTA(2-) |\n", + "| $\\text{HATP}^{3-}$ | 0.09 | | In LJPCalc |\n", + "| $\\text{ATP}^{4-}$ | 0.46 | | In LJPCalc |\n", + "| $\\text{HEPES}^-$ | 3.2 | 4.3 | In LJPCalc |\n", + "\n", + "The last column shows the source of our measurement or estimate of \"mobility\", which will be important for the LJP calculation." + ] + }, + { + "cell_type": "markdown", + "id": "8f89a6ed-3a31-4441-9800-a03a2dbe727e", + "metadata": {}, + "source": [ + "## Liquid junction potential\n", + "\n", + "To calculate the LJP, we can use [LJPCalc](https://swharden.com/LJPcalc/).\n", + "\n", + "Three mobilities of ions included in our table are not included in LJPCalc: $\\text{CaEGTA}^{2-}$, $\\text{MgATP}^{2-}$, $\\text{MgEGTA}^{2-}$.\n", + "Following \"JPCalcWin; A Program for Calculating Liquid Junction Potentials; Version 1.01; Demonstration Version Manual; Peter H Barry 2013-2014\" we approximate these by $\\text{H}_2\\text{EGTA}^{2-}$ and $\\text{H}_2\\text{ATP}^{2-}$, leading to the following LJPCalc input:\n", + "\n", + "```\n", + "ion: Na, +1, 50.11, 0, 144.16\n", + "ion: K, +1, 73.5, 166, 4\n", + "ion: Cl, -1, 76.31, 134, 149.6\n", + "ion: Ca, +2, 59.5, 0, 1.8\n", + "ion: EGTA(2-), -2, 35.28, 10, 0\n", + "ion: Mg, +2, 53.06, 1.05, 1\n", + "ion: ATP (Adenosine 5'-Triphosphate), -2, 22.05, 4.45, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -3, 33.075, 0.09, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -4, 44.1, 0.46, 0\n", + "ion: HEPES, -1, 22.05, 3.2, 4.3\n", + "temperatureC: 37\n", + "```\n", + "\n", + "This yields an LJP of 6.66 mV." + ] + }, + { + "cell_type": "markdown", + "id": "eb875f8d-2e99-415b-a48a-419828395483", + "metadata": {}, + "source": [ + "### The intricacies of chelation can be ignored\n", + "\n", + "Going by the original table, before we used PyChelator, we find\n", + "\n", + "```\n", + "ion: Na, +1, 50.11, 0, 144.16\n", + "ion: K, +1, 73.5, 166, 4\n", + "ion: Cl, -1, 76.31, 134, 149.6\n", + "ion: Ca, +2, 59.5, 0, 1.8\n", + "ion: EGTA(2-), -2, 35.28, 10, 0\n", + "ion: Mg, +2, 53.06, 1, 1\n", + "ion: ATP (Adenosine 5'-Triphosphate), -2, 22.05, 5, 0\n", + "ion: HEPES, -1, 22.05, 3.2, 4.3\n", + "temperatureC: 37\n", + "```\n", + "\n", + "which yields an LJP of 6.59 mV, showing that **LJP in this case was not strongly affected by the intricacies of EGTA and ATP chelation**." + ] + }, + { + "cell_type": "markdown", + "id": "2082bbaf-3bd1-4de3-a92b-ce864dc89e3b", + "metadata": {}, + "source": [ + "### The pH adjustment should be included\n", + "\n", + "Leaving out the extra Na and K added in titration, we find\n", + "\n", + "```\n", + "ion: Na, +1, 50.11, 0, 140\n", + "ion: K, +1, 73.5, 130, 4\n", + "ion: Cl, -1, 76.31, 134, 149.6\n", + "ion: Ca, +2, 59.5, 0, 1.8\n", + "ion: EGTA(2-), -2, 35.28, 10, 0\n", + "ion: Mg, +2, 53.06, 1.05, 1\n", + "ion: ATP (Adenosine 5'-Triphosphate), -2, 22.05, 4.45, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -3, 33.075, 0.09, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -4, 44.1, 0.46, 0\n", + "ion: HEPES, -1, 22.05, 3.2, 4.3\n", + "temperatureC: 37\n", + "```\n", + "\n", + "which yields and LJP of 7.7 mV, showing that **the pH adjustment must be included**." + ] + }, + { + "cell_type": "markdown", + "id": "86b5041e-efc8-4f4f-b3f8-690080545fa9", + "metadata": {}, + "source": [ + "Going back to the original result of 6.7mV, we can repeat the calculation at room temperature to find 6.3mV, showing a **0.4mV influence of the temperature change on the LJP**." + ] + }, + { + "cell_type": "markdown", + "id": "9bc28cd6-afb1-4ca6-929e-d23bf5ed2dae", + "metadata": {}, + "source": [ + "## Reversal potential\n", + "\n", + "Accepting these results, we can calculate the reversal potential for potassium from\n", + "\\begin{align}\n", + "E &= \\frac{RT}{F} \\log \\frac{[\\text{K}^+]_e}{[\\text{K}^+]_i}\n", + "\\end{align}\n", + "\n", + "Using $37^\\circ\\text{C}$ and the values from the table, we find $E_K = -99.6\\,\\text{mV}$.\n", + "\n", + "Neglecting the pH adjustment, we would get $E_K(130\\,\\text{mM}) = -93.0\\,\\text{mV}$." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "cf3b0168-4f9d-463f-9550-1644dce6d95f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-99.57014054026241" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import math\n", + "\n", + "T = 273.15 + 37\n", + "R = 8314 # J/kmol/K\n", + "F = 96485 # C/mol\n", + "R * T / F * math.log(4 / 166)" + ] + }, + { + "cell_type": "markdown", + "id": "fb8ea483-27c1-46b5-bbfe-53f3a554b099", + "metadata": {}, + "source": [ + "## Osmolarity\n", + "\n", + "Using the tables, we can easily check the osmolarity (number of osmotically active solutes) in both solutions.\n", + "We find 336 externally and 326 internally.\n", + "**This slightly higher external solution osmolarity is seen as [good practice](https://www.scientifica.uk.com/neurowire/electrophysiology-what-goes-on-the-inside).**" + ] + }, + { + "cell_type": "markdown", + "id": "6e8ba970-0533-4ac1-a5eb-951253000077", + "metadata": {}, + "source": [ + "## Uncertainty in the target concentrations\n", + "\n", + "Finally, we look at uncertainty in the target concentrations that can arise when measuring out ingredients." + ] + }, + { + "cell_type": "markdown", + "id": "a5ddbdf1-4c6f-429c-b2f9-99fc2f4b0345", + "metadata": {}, + "source": [ + "### Adding by weight\n", + "\n", + "To estimate the uncertainty in concentration for substances added by weight, we need to assign values to the terms in\n", + "\\begin{align}\n", + "\\frac{\\Delta C}{C} &= \\sqrt{\\left(\\frac{\\Delta m_a}{m_a}\\right)^2 + \\left(\\frac{\\Delta V}{V}\\right)^2 + \\left(\\frac{\\Delta q}{q}\\right)^2}\n", + "\\end{align}\n", + "where $m_a$ is the added weight, $q$ is a scaling factor for purity (see the previous notebook), and $C$ is the obtained concentration\n", + "\\begin{align}\n", + "C = \\frac{m_a \\cdot q}{M \\cdot V}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "e4ecc041-84ca-4cbe-b5d7-db40f8b078c7", + "metadata": {}, + "source": [ + "#### $\\Delta V / V$\n", + "\n", + "In this experiment, the external volume was set using a [highly accurate](https://medilabexports.com/class-a-vs-class-b-laboratory-glassware/) 1 litre _volumetric flask_.\n", + "These have a tolerance of either $\\pm 0.3\\,\\text{mL}$ or $\\pm 0.6\\,\\text{mL}$ so we can set an upper bound for $\\frac{\\Delta V}{V}$ of at $6\\cdot10^{-4}$." + ] + }, + { + "cell_type": "markdown", + "id": "879fa6d5-9dcd-4587-b009-fd16c2f529c8", + "metadata": {}, + "source": [ + "#### $\\Delta m_a / m_a$\n", + "\n", + "Next, we need to calculate the relative errors $\\frac{\\Delta m_a}{m_a}$.\n", + "**In this example, we shall assume that the measured out weights $m_a$ are not known**.\n", + "Instead, we use the table above to calculate the smallest weight added as $298.2\\,\\text{mg}\\,\\text{KCl}$, or $301.2\\,\\text{mg}$ if adjusted for purity.\n", + "We combine this with an estimate of $\\Delta m_a = 1\\,\\text{mg}$ (from the next notebook!) for an an upper limit $\\frac{\\Delta m_a}{m_a} \\leq 3 \\cdot 10^{-3}$." + ] + }, + { + "cell_type": "markdown", + "id": "caa4097a-fb76-433a-a5d0-2369bc3939eb", + "metadata": {}, + "source": [ + "#### Purity\n", + "\n", + "Since the method to calculate $m_a$ is unknown, an we use $q = 1$ and $\\Delta q = 1 - p$." + ] + }, + { + "cell_type": "markdown", + "id": "e3213557-62b4-40a7-9cfe-d3286f4122b3", + "metadata": {}, + "source": [ + "#### External solution\n", + "\n", + "Filling in for NaCl, KCl and HEPES, we find:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "d8b8f1b4-0ee0-4e7d-af46-e524d6ed2639", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NaCl (Ct=140 mM)\n", + " |dV/V|: 0.0006\n", + " |dm/m|: 0.003\n", + " |dp/p|: 0.010101\n", + " dCt/Ct: 0.010554\n", + " dCt: 1.477583 mM\n", + "KCl (Ct=4 mM)\n", + " |dV/V|: 0.0006\n", + " |dm/m|: 0.003\n", + " |dp/p|: 0.010101\n", + " dCt/Ct: 0.010554\n", + " dCt: 0.042217 mM\n", + "HEPES (Ct=10 mM)\n", + " |dV/V|: 0.0006\n", + " |dm/m|: 0.003\n", + " |dp/p|: 0.00502513\n", + " dCt/Ct: 0.005883\n", + " dCt: 0.058832 mM\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "# Ct, Purity\n", + "ions = {\n", + " 'NaCl': (140, 99),\n", + " 'KCl': (4, 99),\n", + " 'HEPES': (10, 99.5),\n", + "}\n", + "\n", + "# Relative error in final volume\n", + "dVV = 6e-4\n", + "\n", + "# Relative error in added weight\n", + "dmm = 3e-3\n", + "\n", + "for k, (Ct, p) in ions.items():\n", + " p = p * 0.01\n", + " dp = 1 - p\n", + " print(f'{k} (Ct={Ct} mM)')\n", + " dcc = math.sqrt(dVV**2 + dmm**2 + (dp / p)**2)\n", + " print(f' |dV/V|: {abs(dVV):1.6g}')\n", + " print(f' |dm/m|: {abs(dmm):1.6g}')\n", + " print(f' |dp/p|: {abs(dp / p):1.6g}')\n", + " print(f' dCt/Ct: {dcc:1.6f}')\n", + " print(f' dCt: {dcc * Ct:1.6f} mM')\n" + ] + }, + { + "cell_type": "markdown", + "id": "d01acae5-029c-464f-8f07-6a56d1ea0f2c", + "metadata": {}, + "source": [ + "So in this experiment, the relative error in sodium, concentration, and HEPES concentration is\n", + "\n", + "1. Small, being at most 1.1%\n", + "2. Dominated by $\\Delta q$\n", + "\n", + "For the absolute error, we see that the compound with the highest concentration has the largest error." + ] + }, + { + "cell_type": "markdown", + "id": "41269adf-8a29-4fd2-86b0-21c63ff1e73b", + "metadata": {}, + "source": [ + "### Adding by volume\n", + "\n", + "For $\\text{CaCl}_2$, which was added by volume, we need to assign values to\n", + "\\begin{align}\n", + "\\frac{\\Delta C}{C} = \\sqrt{\n", + " \\left( \\frac{\\Delta V_a}{V_a} \\right)^2 +\n", + " \\left( \\frac{\\Delta V}{V} \\right)^2\n", + "}\n", + "\\end{align}\n", + "\n", + "For $\\frac{\\Delta V_a}{V_a}$ we assume a pipette volume accuracy of 1%, to find:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "bc1bdf01-9704-4060-b1d5-2c3f52de2941", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dCt/Ct: 0.01\n", + " dCt: 0.018 mM\n" + ] + } + ], + "source": [ + "Ct = 1.8\n", + "dvava = 0.01\n", + "dcc = math.sqrt(0.01**2 + (dVV)**2)\n", + "print(f'dCt/Ct: {dcc:.3}')\n", + "print(f' dCt: {dcc * Ct:.3} mM')" + ] + }, + { + "cell_type": "markdown", + "id": "23c74a6e-a7ef-4a02-b771-a90b529a51e2", + "metadata": {}, + "source": [ + "### EGTA and Mg-ATP\n", + "\n", + "In the interal solution, we expect the above pattern to be repeated, with weight and volume contributing no signifcant error.\n", + "\n", + "For EGTA, we then have a relative error due to purity (97%) and loss on drying (1%).\n", + "Instead of treating these as separate values, we will multiply them together into a single factor\n", + "\\begin{align}\n", + "p = 0.97 (1 - 0.01) \\approx 0.96\n", + "\\end{align}\n", + "We assume no knowledge of whether purity was included in the added weight calculation, and so use $1 - p$ as the releative error in both:\n", + "\n", + "For Mg-ATP, we estimated in the previous notebook that there may be up to 7% less ATP, and up to 40% more Mg.\n", + "Because adjusting for both is impossible, here we could use the \"purity not included\" method from the previous notebook.\n", + "However, to keep things simpler, we will simply write out the ranges:\n", + "\n", + "| Ion | mM | Range | Range $\\pm 5\\%$ |\n", + "|----------------------|------|--------------|-----------------|\n", + "| $\\text{Mg}^{2+}$ | 1 | [1, 1.4] | [1, 1.5] |\n", + "| $\\text{MgATP}^{2-}$ | 4.5 | [4.2, 4.5] | [4, 4.7] |\n", + "| $\\text{MgEGTA}^{2-}$ | 0.5 | [0.5, 0.7] | [0.5, 0.7] |\n", + "| $\\text{HATP}^{3-}$ | 0.09 | [0.08, 0.09] | [0.08, 0.09] |\n", + "| $\\text{ATP}^{4-}$ | 0.46 | [0.43, 0.46] | [0.41, 0.48] |\n", + "\n", + "To add the final complication, we have extended the ranges with the 5% purity error incurred in addition to the unknown ratio error.\n", + "We have not, however, recalculated the expected ATP protonation ratios, EGTA-Mg interaction, etc.\n", + "But, **looking at the previous results showing the limited effect of including chelation intricacies, we can safely assume the Mg to ATP ratio does not affect the LJP in this experiment**." + ] + }, + { + "cell_type": "markdown", + "id": "50876756-0bed-4d3e-a467-917b44657afe", + "metadata": {}, + "source": [ + "### Uncertainties: Conclusion\n", + "\n", + "If weight and total volume are measured carefully, purity of the compound is the dominant factor in the target concentration uncertainty, and we can equate a purity of 99% with a 1% error.\n", + "The exception is Mg-ATP, which has a high relative error but is present in low concentrations." + ] + }, + { + "cell_type": "markdown", + "id": "424a55d1-882f-4d09-8484-0b747f3918c4", + "metadata": {}, + "source": [ + "## Effect of uncertainties\n", + "\n", + "The table below summarises free ion concentrations, with ranges included included when wider than 0.2 mM.\n", + "\n", + "| Ion | Rel. err. | mM int | Range | mM ext | Range |\n", + "|------------------------------|-----------|--------|------------|--------|------------|\n", + "| $\\text{Na}^+$ | 1% | | | 144 | [142, 146] |\n", + "| $\\text{K}^+$ | 1% | 166 | [164, 168] | 4 | |\n", + "| $\\text{Cl}^-$ | 1% | 134 | [132, 136] | 150 | [148, 152] |\n", + "| $\\text{Ca}^{2+}$ | 1% | | | 1.8 | |\n", + "| $\\text{CaEGTA}^{2-}$ | 4% (EGTA) | 1 | | | |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | 4% (EGTA) | 8.5 | [8.2, 8.8] | | |\n", + "| $\\text{Mg}^{2+}$ | - (MgATP) | 1 | [1, 1.5] | 1 | |\n", + "| $\\text{MgATP}^{2-}$ | - (MgATP) | 4.5 | [4, 4.7] | | |\n", + "| $\\text{MgEGTA}^{2-}$ | - (MgATP) | 0.5 | [0.5, 0.7] | | |\n", + "| $\\text{HATP}^{3-}$ | - (MgATP) | 0.09 | | | |\n", + "| $\\text{ATP}^{4-}$ | - (MgATP) | 0.46 | | | |\n", + "| $\\text{HEPES}^-$ | 0.5% | 3.2 | | 4.3 | |\n" + ] + }, + { + "cell_type": "markdown", + "id": "8ceb5529-e623-4017-bc74-b20a481ff1ab", + "metadata": {}, + "source": [ + "### Reversal potential\n", + "\n", + "The $\\pm2\\,\\text{mV}$ bracket gives $E_K = -99.6\\pm0.3\\,\\text{mV}$." + ] + }, + { + "cell_type": "markdown", + "id": "ae524b44-38e5-4d9d-99d6-4ce62a3f38bf", + "metadata": {}, + "source": [ + "### Liquid junction potential\n", + "\n", + "For the LJP calculation, changes to ions with low mobility have the greatest effect.\n", + "This makes it relatively robust, as the ions with the highest concentrations, and therefore the largest absolute uncertainty, all have high mobility.\n", + "\n", + "Changing Na, K, EGTA(2-) and ATP(2-) we can obtain an LJP of 6.86 mV, giving us a bracket of $6.7\\pm0.2\\,\\text{mV}$.\n", + "\n", + "```\n", + "ion: Na, +1, 50.11, 0, 146\n", + "ion: K, +1, 73.5, 164, 4\n", + "ion: Cl, -1, 76.31, 134, 150\n", + "ion: Ca, +2, 59.5, 0, 1.8\n", + "ion: EGTA(2-), -2, 35.28, 10.4, 0\n", + "ion: Mg, +2, 53.06, 1.05, 1\n", + "ion: ATP (Adenosine 5'-Triphosphate), -2, 22.05, 4.7, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -3, 33.075, 0.09, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -4, 44.1, 0.46, 0\n", + "ion: HEPES, -1, 22.05, 3.2, 4.3\n", + "temperatureC: 37\n", + "```\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tutorial/appendix/s-solutions/3-example-2.ipynb b/tutorial/appendix/s-solutions/3-example-2.ipynb new file mode 100644 index 0000000..7b88f8a --- /dev/null +++ b/tutorial/appendix/s-solutions/3-example-2.ipynb @@ -0,0 +1,828 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "58a80576-d029-4e96-851a-07c1093b7ddd", + "metadata": {}, + "source": [ + "# G2: Example 2, multi-channel experiments\n", + "\n", + "**This example** describes a set of solutions used in experiments on multiple ion channels.\n", + "They were prepared and pH adjusted at a room temperature of $20.5,^\\circ\\text{C}$, and patch clamp experiments were performed at the same temperature.\n", + "\n", + "**Summary**: In this example, the compounds are mostly very pure but total volume is set with a 2% precision, which becomes the main source of error.\n", + "We briefly discuss the accuracy of scales and the people using them (in this case the author)." + ] + }, + { + "cell_type": "markdown", + "id": "a1a79b85-f9b1-4d4b-950b-6d91c2990b05", + "metadata": {}, + "source": [ + "## The bath solution\n", + "\n", + "| Compound | $C_t$ | $M$ | $p$ | $C_s$ | Product |\n", + "|----------|----------|--------------|---------------|-------|---------|\n", + "| NaCl | 140 mM | 58.44 g/mol | $\\geq 99.5\\%$ | | [S7653](https://www.sigmaaldrich.com/GB/en/product/sial/s7653) |\n", + "| KCl | 5.4 mM | 74.55 g/mol | $\\geq 99\\%$ | | [P9333](https://www.sigmaaldrich.com/GB/en/product/sial/p9333) |\n", + "| MgCl2 | 1 mM | | $\\geq 99\\%$ | 1 M * | [105832](https://www.sigmaaldrich.com/GB/en/product/mm/105832) |\n", + "| CaCl2 | 1 mM | | $\\geq 99\\%$ | 1 M * | [102382](https://www.sigmaaldrich.com/GB/en/product/mm/102382) |\n", + "| HEPES | 15 mM | 238.3 g/mol | $\\geq 99.5\\%$ | | [H3375](https://www.sigmaaldrich.com/GB/en/product/sigma/h3375) |\n", + "| Glucose | 6 mM | 180.16 g/mol | $\\geq 99.5\\%$ | | [G8270](https://www.sigmaaldrich.com/GB/en/product/sigma/g8270) |\n", + "\n", + "To add $\\text{MgCl}_2$ and $\\text{CaCl}_2$ a 1M solution was prepared from powder, and then added by volume." + ] + }, + { + "cell_type": "markdown", + "id": "d4e53c73-4c0e-4e70-b819-32595a03d665", + "metadata": {}, + "source": [ + "### pH adjustment and volume change\n", + "\n", + "The solution was mixed in a 1L volume, and adjusted to pH 7.4 using 7.7 mM NaOH.\n", + "\n", + "Specifically, 0.6 mL 10 M NaOH, and 1.7 mL 1 M NaOH.\n", + "\\begin{align}\n", + " 0.6\\,\\text{mL} \\cdot 10\\,\\frac{\\text{mol}}{\\text{L}} \n", + "+ 1.7\\,\\text{mL} \\cdot 1\\,\\frac{\\text{mol}}{\\text{L}}\n", + "= 7.7\\,\\text{mmol} \\\\\n", + "\\end{align}\n", + "\n", + "This happened **after** setting the final volume, which therefore increased by 2.3 mL." + ] + }, + { + "cell_type": "markdown", + "id": "37de7f7f-2e24-4f10-b58f-f28513bd5b6e", + "metadata": {}, + "source": [ + "### Simple ions\n", + "\n", + "The salts ($\\text{NaCl}$, $\\text{KCl}$, $\\text{MgCl}_2$, and $\\text{CaCl}_2$) will fully dissolve, and no substances were added that will bind the dissociated ions.\n", + "Therefore, we have a total of 147.7 mM $\\text{Na}^+$, 5.4 mM $\\text{K}^+$, 1 mM $\\text{Ca}^{2+}$, 1 mM $\\text{Mg}^{2+}$, and $140 + 5.4 + 2 \\cdot 2 = 149.4\\,\\text{mM}$ $\\text{Cl}^-$." + ] + }, + { + "cell_type": "markdown", + "id": "c26344a6-b8c6-40f2-810b-62b229868d58", + "metadata": {}, + "source": [ + "### pH buffer\n", + "\n", + "HEPES' pKa is 7.55 at $20\\,^\\circ\\text{C}$ and shifts by -0.014 per $^\\circ\\text{C}$, for a value of 7.543 at $20.5\\,^\\circ\\text{C}$:\n", + "\\begin{align}\n", + "[\\text{HEPES}^-] = \\frac{[\\text{HEPES}]_\\text{added}}{1 + 10^{\\text{pK}_a - \\text{pH}}} \\approx 6.28\\,\\text{mM} (41.8\\%)\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "1b572b52-abf6-4aef-8581-2de2befb8fc5", + "metadata": {}, + "source": [ + "### Free ion concentrations\n", + "\n", + "| Solute | mM added | mM free | Total charge | Total solutes |\n", + "|------------------|----------|---------|--------------|---------------|\n", + "| $\\text{Na}^+$ | 147.7 | 147.7 | +147.7 | 147.7 |\n", + "| $\\text{K}^+$ | 5.4 | 5.4 | +153.1 | 153.1 |\n", + "| $\\text{Cl}^-$ | 149.4 | 149.4 | + 3.7 | 302.5 |\n", + "| $\\text{Ca}^{2+}$ | 1 | 1 | + 5.7 | 303.5 |\n", + "| $\\text{Mg}^{2+}$ | 1 | 1 | + 7.7 | 304.5 |\n", + "| $\\text{HEPES}$ | 15 | 8.7 | | 313.2 |\n", + "| $\\text{HEPES}^-$ | | 6.3 | + 1.4 | 319.5 |\n", + "| Glucose | 6 | 6 | | 325.5 |\n", + "\n", + "Here the final column shows the solution's osmolarity." + ] + }, + { + "cell_type": "markdown", + "id": "d1bb9e3f-5305-4a31-9877-ce2a93ca89dc", + "metadata": {}, + "source": [ + "### Charge balance\n", + "\n", + "The final charge balance is off by 1.4 mM.\n", + "\n", + "Since NaCl, KCl, MgCl2 and CaCl2 are all electrically neutral and do not react with water, they cannot contribute to this error, which instead must be due to:\n", + "\n", + "- the NaOH measurement or stock concentrations (mL added, concentration of added solution, total volume)\n", + "- the HEPES concentration (weight, pH, total volume)\n" + ] + }, + { + "cell_type": "markdown", + "id": "4432f33b-50f2-48cf-949a-625ad3e97fa9", + "metadata": {}, + "source": [ + "## Pipette solution" + ] + }, + { + "cell_type": "markdown", + "id": "a9a87f36-6456-4cb7-81c6-0eac44606d6d", + "metadata": {}, + "source": [ + "| Compound | $C_t$ | $M$ | $p$ | $C_s$ | $m_a$ | Product |\n", + "|-------------|----------|--------------|---------------|-------|---------|---------|\n", + "| KCl | 10 mM | 74.55 g/mol | $\\geq 99\\%$ | | 74 mg | [P9333](https://www.sigmaaldrich.com/GB/en/product/sial/p9333) |\n", + "| K-Gluconate | 125 mM | 234.25 g/mol | $\\geq 99\\%$ | | 2929 mg | [860379](https://www.sigmaaldrich.com/GB/en/product/aldrich/860379) |\n", + "| MgCl2 | 2 mM | | $\\geq 99\\%$ | 1 M | | [105832](https://www.sigmaaldrich.com/GB/en/product/mm/105832) |\n", + "| CaCl2 | 0.6 mM | | $\\geq 99\\%$ | 1 M | | [102382](https://www.sigmaaldrich.com/GB/en/product/mm/102382) |\n", + "| EGTA | 5 mM | 380.35 g/mol | $\\geq 97\\%$ | | 119 mg | [E4378](https://www.sigmaaldrich.com/GB/en/product/sial/e4378) |\n", + "| Na2ATP | 4 mM | 551.1 g/mol | $\\geq 99\\%$ * | | 1027 mg | [A26209](https://www.sigmaaldrich.com/GB/en/product/aldrich/a26209) |\n", + "| HEPES | 5 mM | 238.3 g/mol | $\\geq 99.5\\%$ | | 220 mg | [H3375](https://www.sigmaaldrich.com/GB/en/product/sigma/h3375) |\n", + "| Sucrose | 30 mM | 342.30 g/mol | $\\geq 99.5\\%$ | | 191 mg | [S9378](https://www.sigmaaldrich.com/GB/en/product/sigma/s9378) | \n", + "\n", + "Although $\\text{Na}_2\\text{ATP}$ has a high purity, it also has significant water content, indicated by an asterisk in the table.\n", + "Like the other compounds, we will initially treat it as pure, and deal with the water content when delving into uncertainties." + ] + }, + { + "cell_type": "markdown", + "id": "cab1fe49-0d05-4714-84aa-6ccc31c95fe5", + "metadata": {}, + "source": [ + "### pH adjustment and volume change\n", + "\n", + "The solution was mixed in a 100mL volume, and adjusted to pH 7.2 using 19.2 mM KOH.\n", + "Specifically, 0.18 mL 10 M KOH, and 0.12 mL 1 M KOH.\n", + "\n", + "This happened **after** setting the final volume, which therefore increased by 0.3 mL." + ] + }, + { + "cell_type": "markdown", + "id": "d8b8a287-51c8-4d92-bae6-78413e4a9369", + "metadata": {}, + "source": [ + "### Simple ions\n", + "\n", + "For potassium and chloride we can immediately write down $[\\text{K}^+] = 10 + 125 + 19.2 = 154.2\\,\\text{mM}$ and $[\\text{Cl}^-] = 10 + 2 \\cdot 2 + 2 \\cdot 0.6 = 15.2\\,\\text{mM}$.\n", + "For sodium, we use $[\\text{Na}^+]=8\\,\\text{mM}$" + ] + }, + { + "cell_type": "markdown", + "id": "c97d08f7-d1bc-4626-9f13-30e8c86b7ada", + "metadata": {}, + "source": [ + "### pH buffer\n", + "\n", + "For HEPES, we use pKa=7.543 and pH=7.2 for\n", + "\\begin{align}\n", + "[\\text{HEPES}^-] = \\frac{[\\text{HEPES}]_\\text{added}}{1 + 10^{\\text{pK}_a - \\text{pH}}} \\approx 1.56\\,\\text{mM} (31.2\\%)\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "4331b07e-5409-4f95-86e0-f03fc1aaa358", + "metadata": {}, + "source": [ + "### Gluconate\n", + "\n", + "For Gluconate, we use [pKa=3.86](https://en.wikipedia.org/wiki/Gluconic_acid) and pH=7.2 for\n", + "\\begin{align}\n", + "[\\text{Gluconate}^-] = \\frac{[\\text{Gluconate}]_\\text{added}}{1 + 10^{\\text{pK}_a - \\text{pH}}} \\approx 124.94 \\approx 125\\text{mM}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "45787b61-b3f6-460f-a193-69719f782222", + "metadata": {}, + "source": [ + "### Ca and EGTA\n", + "\n", + "For Ca and EGTA we use the simplifying assumptions to find 0 mM $\\text{Ca}^{2+}$, 0.6 mM $\\text{CaEGTA}^{2-}$, and 4.4 mM $\\text{H}_2\\text{EGTA}^{2-}$." + ] + }, + { + "cell_type": "markdown", + "id": "fe226528-8bad-4d20-9f2a-fc3cff510a51", + "metadata": {}, + "source": [ + "### Mg and ATP\n", + "\n", + "For Mg and ATP we first look up whether $\\text{Na}_2\\text{ATP}$ dissolves (it does).\n", + "Here we have more ATP than $\\text{Mg}^{2+}$, so will assume 2 mM $\\text{MgATP}^{2-}$, 2 mM free ATP, and no free $\\text{Mg}^{2+}$.\n", + "\n", + "Using\n", + "\\begin{align}\n", + "[\\text{ATP}^{4-}] = \\frac{[\\text{ATP}]_\\text{free}}{1 + 10^{\\text{pK}_a - \\text{pH}}}\n", + "&&\\quad&&\n", + "[\\text{HATP}^{3-}] = \\frac{[\\text{ATP}]_\\text{free}}{1 + 10^{\\text{pH} - \\text{pK}_a}}\n", + "\\end{align}\n", + "with $\\text{pH}=7.2$ and $\\text{pKa}=6.5$ ([Stockbridge & Wolfenden](https://doi.org/10.1074/jbc.M109.017806)) we find $[\\text{ATP}^{4-}]=1.67\\,\\text{mM}$ (83.5%) and $[\\text{HATP}^{3-}]=0.33\\,\\text{mM}$ (16.5%)." + ] + }, + { + "cell_type": "markdown", + "id": "745866bc-9d0a-47cb-a567-316e4aebefb6", + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, + "source": [ + "### Free ion concentrations\n", + "\n", + "| Solute | mM added | mM free | Total charge | Total abs(charge)| Total solutes |\n", + "|------------------------------|----------|---------|--------------|------------------|---------------|\n", + "| $\\text{Na}^+$ | 8 | 8 | + 8 | 8 | 8 |\n", + "| $\\text{K}^+$ | 154.2 | 154.2 | + 162.2 | 162.2 | 162.2 |\n", + "| $\\text{Cl}^-$ | 15.2 | 15.2 | + 147 | 177.4 | 177.4 |\n", + "| $\\text{Ca}^{2+}$ | 0.6 | | | | |\n", + "| $\\text{CaEGTA}^{2-}$ | | 0.6 | + 145.8 | 178.6 | 178 |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | | 4.4 | + 137 | 187.4 | 182.4 |\n", + "| $\\text{H}_4\\text{EGTA}$ | 5 | | | | |\n", + "| $\\text{Mg}^{2+}$ | 2 | | | | |\n", + "| $\\text{MgATP}^{2-}$ | | 2 | + 133 | 191.4 | 184.4 |\n", + "| $\\text{HATP}^{3-}$ | | 0.33 | + 132.01 | 192.39 | 184.73 |\n", + "| $\\text{ATP}^{4-}$ | | 1.67 | + 125.33 | 199.07 | 186.4 |\n", + "| $\\text{HEPES}$ | 5 | 3.4 | + | | 189.8 |\n", + "| $\\text{HEPES}^-$ | | 1.6 | + 123.73 | 200.67 | 191.4 |\n", + "| $\\text{Gluconate}$ | 125 | | | | |\n", + "| $\\text{Gluconate}^-$ | | 125 | - 1.27 | 325.67 | 316.4 |\n" + ] + }, + { + "cell_type": "markdown", + "id": "ef5febdd-58dc-4bc9-9703-b376fab27629", + "metadata": {}, + "source": [ + "## Combined table\n", + "\n", + "We can now table the free ion concentrations from both solutions:\n", + "\n", + "| Ion | mM int | mM ext | Mobility |\n", + "|------------------------------|--------|--------|------------------|\n", + "| $\\text{Na}^+$ | 8 | 147.7 | In LJPCalc |\n", + "| $\\text{K}^+$ | 154.2 | 5.4 | In LJPCalc |\n", + "| $\\text{Cl}^-$ | 15.2 | 149.4 | In LJPCalc |\n", + "| $\\text{Ca}^{2+}$ | | 1 | In LJPCalc |\n", + "| $\\text{CaEGTA}^{2-}$ | 0.6 | | Approx EGTA(2-) |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | 4.4 | | In LJPCalc |\n", + "| $\\text{Mg}^{2+}$ | | 1 | In LJPCalc |\n", + "| $\\text{MgATP}^{2-}$ | 2 | | Approx ATP(2-) |\n", + "| $\\text{HATP}^{3-}$ | 0.33 | | In LJPCalc |\n", + "| $\\text{ATP}^{4-}$ | 1.67 | | In LJPCalc |\n", + "| $\\text{HEPES}^-$ | 1.6 | 6.3 | In LJPCalc |\n", + "| $\\text{Gluconate}^-$ | 125 | | In LJPCalc |\n" + ] + }, + { + "cell_type": "markdown", + "id": "8f89a6ed-3a31-4441-9800-a03a2dbe727e", + "metadata": {}, + "source": [ + "## Liquid junction potential\n", + "\n", + "To calculate the LJP, we use [LJPCalc](https://swharden.com/LJPcalc/) with the following input\n", + "\n", + "```\n", + "ion: Na, +1, 50.11, 8, 147.7\n", + "ion: K, +1, 73.5, 154.2, 5.4\n", + "ion: Cl, -1, 76.31, 15.2, 149.4\n", + "ion: Ca, +2, 59.5, 0, 1\n", + "ion: EGTA(2-), -2, 35.28, 5, 0\n", + "ion: Mg, +2, 53.06, 0, 1\n", + "ion: ATP (Adenosine 5'-Triphosphate), -2, 22.05, 2, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -3, 33.075, 0.33, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -4, 44.1, 1.67, 0\n", + "ion: HEPES, -1, 22.05, 1.6, 6.3\n", + "ion: Gluconate, -1, 24.255, 125, 0\n", + "temperatureC: 20.5\n", + "```\n", + "\n", + "This yields an LJP of +15.8 mV." + ] + }, + { + "cell_type": "markdown", + "id": "62d25155-5c50-4b50-9b89-267a78a38c0c", + "metadata": {}, + "source": [ + "## Reversal potentials\n", + "\n", + "The reversal potentials for sodium and potassium are" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "a9056c83-8b6e-4172-bce4-bc4b71bf5e4b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ENa 73.8\n", + "EK -84.8\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "T = 273.15 + 20.5\n", + "R = 8314 # J/kmol/K\n", + "F = 96485 # C/mol\n", + "print(f'ENa {R * T / F * math.log(147.7 / 8): 5.1f}')\n", + "print(f'EK {R * T / F * math.log(5.4 / 154.2): 5.1f}')" + ] + }, + { + "cell_type": "markdown", + "id": "fb8ea483-27c1-46b5-bbfe-53f3a554b099", + "metadata": {}, + "source": [ + "## Osmolarity\n", + "\n", + "The osmolarity in the external solution is 325.5, compared to 316.4 internally." + ] + }, + { + "cell_type": "markdown", + "id": "048dd95e-cc0a-4650-a8af-60f2e24ac661", + "metadata": {}, + "source": [ + "## Uncertainty in the target concentrations\n", + "\n", + "Finally, we look at uncertainty in the target concentrations that arise when measuring out ingredients." + ] + }, + { + "cell_type": "markdown", + "id": "60bfca35-9061-4e4c-aeb8-b08ace590c09", + "metadata": {}, + "source": [ + "### Adding by weight\n", + "\n", + "To estimate the uncertainty in concentration for substances added by weight, we need to assign values to the terms in\n", + "\\begin{align}\n", + "\\frac{\\Delta}{C} &= \\sqrt{\\left(\\frac{\\Delta m_a}{m_a}\\right)^2 + \\left(\\frac{\\Delta V}{V}\\right)^2 + \\left(\\frac{\\Delta q}{q}\\right)^2}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "454d9f58-aafb-4011-8efd-e8bc41238b31", + "metadata": {}, + "source": [ + "#### $m_a$ and $\\Delta m_a$\n", + "\n", + "In this experiment, the added weights $m_a$ were recorded.\n", + "The table below lists the intended weights, $m$, in addition to actually added weight (read directly from the scales), for the external solution:\n", + "\n", + "| Compound | $C_t$ | $M$ | $p$ | $m$ | $m_a$ |\n", + "|----------|----------|--------------|---------------|-----------|---------|\n", + "| NaCl | 140 mM | 58.44 g/mol | $\\geq 99.5\\%$ | 8181.6 mg | 8178 mg |\n", + "| KCl | 5.4 mM | 74.55 g/mol | $\\geq 99\\%$ | 402.6 mg | 402 mg |\n", + "| HEPES | 15 mM | 238.3 g/mol | $\\geq 99.5\\%$ | 3574.5 mg | 3570 mg |\n", + "\n", + "The internal solution was made more carefully:\n", + "\n", + "| Compound | $C_t$ | $M$ | $p$ | $m$ | $m_a$ |\n", + "|-------------|----------|--------------|---------------|-----------|-----------|\n", + "| KCl | 10 mM | 74.55 g/mol | $\\geq 99\\%$ | 74.6 mg | 74.4 mg |\n", + "| K-Gluconate | 125 mM | 234.25 g/mol | $\\geq 99\\%$ | 2928.1 mg | 2929.0 mg |\n", + "| EGTA | 5 mM | 380.35 g/mol | $\\geq 97\\%$ | 190.2 mg | 190.7 mg |\n", + "| Na2ATP | 4 mM | 551.1 g/mol | $\\geq 99\\%$ * | 220.4 mg | 220.6 mg |\n", + "| HEPES | 5 mM | 238.3 g/mol | $\\geq 99.5\\%$ | 119.2 mg | 119.5 mg |\n", + "\n", + "For $\\Delta m_a$ we can look at specifications of \"analytical balances\", for example [this one](https://www.mt.com/us/en/home/phased_out_products/Laboratory_Weighing_Solutions/Analytical/Excellence/XS_Analytical_Balance/XS64.html) used in Example 2.\n", + "It shows several measures, including readability (how many digits are on the display, regardless of accuracy), repeatability (the standard deviation obtained if you keep measuring the same thing), and linearity (if you measure objects over the full allowable range, what is the maximum deviation from the true weight).\n", + "To find an upper bound, we could use the largest listed number of $\\pm0.2\\,\\text{mg}$.\n", + "However, this precision is only achieved if the scales are used with extreme care, so that something larger, for example $\\pm1\\,\\text{mg}$ may be more realistic.\n", + "\n", + "In addition to precision of the _scales_, we can factor precision of the experimenter into $\\Delta m_a$.\n", + "Above, the experimenter accepted errors of 4, 0.6, and 4.5 mg in the external solution, and, on a different day, errors of 0.2, 0.9, 0.5, 0.2, and 0.3 mg.\n", + "We can use these numbers to set an approximate $\\Delta m_a$ in cases where $m_a$ is unknown, using $\\Delta m_a = 1\\,\\text{mg}$ for a precisely made solution (so that the error of the scales dominates), and $\\Delta m_a = 5\\,\\text{mg}$ in a less precisely made solution." + ] + }, + { + "cell_type": "markdown", + "id": "a5ddbdf1-4c6f-429c-b2f9-99fc2f4b0345", + "metadata": {}, + "source": [ + "#### $\\Delta V / V$\n", + "\n", + "In this experiment, the external volume was set using a 1L chemical beaker, with an accuracy of 20mL, giving\n", + "\\begin{align}\n", + "\\frac{\\Delta V}{V} = \\frac{20}{1000} = 0.02\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "711a17a4-6d57-4484-ab7d-a9165feb0b28", + "metadata": {}, + "source": [ + "#### Purity\n", + "\n", + "Because purity was not taken into account, we will incur both a bias and a relative error due to $p$.\n", + "\n", + "We will factor in purity using \n", + "\\begin{align}\n", + "C = \\frac{m_a \\cdot q}{M \\cdot V}\n", + "& \\quad &\n", + "q = \\frac{1 + p}{2}\n", + "& \\quad &\n", + "\\Delta q = \\frac{1 - p}{2}\n", + "& \\quad &\n", + "\\frac{\\Delta q}{q} = \\frac{1 - p}{1 + p}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "id": "1c82762c-e662-4a6d-a645-bc0e46fde7a8", + "metadata": {}, + "source": [ + "### External solution\n", + "\n", + "Filling in for NaCl, KCl and HEPES, we find:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "8d16d0a3-e9f1-4c32-8866-59ecd17c8c25", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "NaCl (Ct=140 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.000122279\n", + " |dq/q|: 0.00250627\n", + " dC/C : 0.020157\n", + " dC : 2.813658 mM\n", + " C : 139.59 [136.77, 142.4]\n", + "KCl (Ct=5.4 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.00248756\n", + " |dq/q|: 0.00502513\n", + " dC/C : 0.020771\n", + " dC : 0.111445 mM\n", + " C : 5.37 [ 5.25, 5.5]\n", + "HEPES (Ct=15 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.000280112\n", + " |dq/q|: 0.00250627\n", + " dC/C : 0.020158\n", + " dC : 0.301240 mM\n", + " C : 14.94 [ 14.64, 15.2]\n" + ] + } + ], + "source": [ + "# Ct, M, purity, ma\n", + "ions = {\n", + " 'NaCl': (140, 58.44, 99.5, 8178),\n", + " 'KCl': (5.4, 74.55, 99, 402),\n", + " 'HEPES': (15, 238.3, 99.5, 3570),\n", + "}\n", + "\n", + "# Volume and relative error in final volume\n", + "V = 1\n", + "dVV = 0.02\n", + "\n", + "# Absolute error in weight\n", + "dm = 1\n", + "\n", + "for k, (Ct, M, p, ma) in ions.items():\n", + " p = p / 100\n", + " q = (1 + p) / 2\n", + " dq = (1 - p) / 2\n", + " C = ma * q / (M * V)\n", + " print(f'{k} (Ct={Ct} mM)')\n", + " dcc = math.sqrt(dVV**2 + (dm / ma)**2 + (dq / q)**2)\n", + " dc = dcc * C\n", + " print(f' |dV/V|: {abs(dVV):1.6g}')\n", + " print(f' |dm/m|: {abs(dm / ma):1.6g}')\n", + " print(f' |dq/q|: {abs(dq / q):1.6g}')\n", + " print(f' dC/C : {dcc:1.6f}')\n", + " print(f' dC : {dc:1.6f} mM')\n", + " print(f' C : {C:6.2f} [{C - dc:6.2f}, {C + dc:5.1f}]')\n" + ] + }, + { + "cell_type": "markdown", + "id": "316b6351-67c5-4b49-bcdd-db0fd6555976", + "metadata": {}, + "source": [ + "This shows that, in this example:\n", + "\n", + "1. The uncertainty in total volume dominates, and the relative errors in NaCl, KCl, and HEPES concentration are all 2 to 2.1%.\n", + "2. Because of the high purities used, the bias due to not correcting for purity is low.\n", + "3. The uncertainty in added weight is is negligible, even for KCl which had the smallest added weight\n", + "\n", + "The volume increase from pH adjustment was 1.15 mL, and not included in the analysis above.\n", + "But as this was a 0.1% increase, it will be dwarfed by the 2% error and so is safely ignored." + ] + }, + { + "cell_type": "markdown", + "id": "776b1cca-f6b3-469a-bcad-02e0a751bab8", + "metadata": {}, + "source": [ + "### Adding by volume\n", + "\n", + "The substances added by volume were added with a precision pipette, and so here as well the 2% volume error will dominate." + ] + }, + { + "cell_type": "markdown", + "id": "b4c9ca13-7d43-4ccb-bbbe-181c5d6d85dd", + "metadata": {}, + "source": [ + "### Internal solution\n", + "\n", + "To repeat this for the internal solution, we need to deal with the unspecified water content in $\\text{Na}_2\\text{ATP}$.\n", + "Although we do not have the lot number for this data, we can look at the 5 last published certificates of analysis (using the product link above).\n", + "Here, we see that\n", + "\n", + "1. The upper limit is 12% water\n", + "2. The last five water lots have water content 7.1%, 6.4%, 6.4%, 9.0%, 4.7%.\n", + "\n", + "So it looks like values are spread out over the interval, not clustered near the upper limit.\n", + "An easy way to incorporate the water content then, is to ignore the higher purity (99%), and fill in $q=0.88$ instead.\n", + "\n", + "We then find:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "ee7112c8-3171-44ba-9f60-4e65c025cb0b", + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "KCl (Ct=10 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.0134409\n", + " |dq/q|: 0.00502513\n", + " dC/C : 0.024615\n", + " dC : 0.244429 mM\n", + " C : 9.93 [ 9.69, 10.2]\n", + "K-Gluconate (Ct=125 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.000341413\n", + " |dq/q|: 0.00502513\n", + " dC/C : 0.020624\n", + " dC : 2.565934 mM\n", + " C : 124.41 [121.85, 127.0]\n", + "EGTA (Ct=5 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.00524384\n", + " |dq/q|: 0.0204082\n", + " dC/C : 0.029052\n", + " dC : 0.142745 mM\n", + " C : 4.91 [ 4.77, 5.1]\n", + "Na2ATP (Ct=4 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.00453309\n", + " |dq/q|: 0.0638298\n", + " dC/C : 0.067043\n", + " dC : 0.252265 mM\n", + " C : 3.76 [ 3.51, 4.0]\n", + "HEPES (Ct=5 mM)\n", + " |dV/V|: 0.02\n", + " |dm/m|: 0.0083682\n", + " |dq/q|: 0.00250627\n", + " dC/C : 0.021824\n", + " dC : 0.109169 mM\n", + " C : 5.00 [ 4.89, 5.1]\n" + ] + } + ], + "source": [ + "# Ct, M, purity, ma\n", + "ions = {\n", + " 'KCl': (10, 74.55, 99, 74.4),\n", + " 'K-Gluconate': (125, 234.25, 99, 2929),\n", + " 'EGTA': (5, 380.35, 96, 190.7), # Combined purity and lod\n", + " 'Na2ATP': (4, 551.1, 88, 220.6),\n", + " 'HEPES': (5, 238.3, 99.5, 119.5),\n", + "}\n", + "\n", + "# Volume and relative error in final volume\n", + "V = 1\n", + "dVV = 0.02\n", + "\n", + "# Absolute error in weight\n", + "dm = 1\n", + "\n", + "for k, (Ct, M, p, ma) in ions.items():\n", + " p = p / 100\n", + " q = (1 + p) / 2\n", + " dq = (1 - p) / 2\n", + " C = ma * q / (M * V) / 0.1\n", + " print(f'{k} (Ct={Ct} mM)')\n", + " dcc = math.sqrt(dVV**2 + (dm / ma)**2 + (dq / q)**2)\n", + " dc = dcc * C\n", + " print(f' |dV/V|: {abs(dVV):1.6g}')\n", + " print(f' |dm/m|: {abs(dm / ma):1.6g}')\n", + " print(f' |dq/q|: {abs(dq / q):1.6g}')\n", + " print(f' dC/C : {dcc:1.6f}')\n", + " print(f' dC : {dc:1.6f} mM')\n", + " print(f' C : {C:6.2f} [{C - dc:6.2f}, {C + dc:5.1f}]')\n" + ] + }, + { + "cell_type": "markdown", + "id": "424a55d1-882f-4d09-8484-0b747f3918c4", + "metadata": {}, + "source": [ + "## Effect of uncertainties\n", + "\n", + "A combined table of ranges for each free ion is given below.\n", + "\n", + "**Because most of the errors are due to the total volume adjustment, they are strongly correlated: if one of the internal free ions is at the low side of the bracket, then all internal ions must be.**\n", + "And the same holds for the external ions, although there is no (or very little) correlation between internal and external.\n", + "The main exceptions are internal sodium and ATP, which have a strong independent variation.\n", + "\n", + "| Ion | mM int | mM ext |\n", + "|------------------------------|----------------|----------------|\n", + "| $\\text{Na}^+$ | [7.0, 8.0] | [144.5, 150.1] |\n", + "| $\\text{K}^+$ | [150.7, 156.4] | [5.25, 5.5] |\n", + "| $\\text{Cl}^-$ | [14.8, 15.5] | [145.9, 152.0] |\n", + "| $\\text{Ca}^{2+}$ | | [0.98, 1.02] |\n", + "| $\\text{CaEGTA}^{2-}$ | [0.59, 0.61] | |\n", + "| $\\text{H}_2\\text{EGTA}^{2-}$ | [4.16, 4.51] | |\n", + "| $\\text{Mg}^{2+}$ | | [0.98, 1.02] |\n", + "| $\\text{MgATP}^{2-}$ | [1.96, 2.04] | |\n", + "| $\\text{HATP}^{3-}$ | [0.24, 0.34] | |\n", + "| $\\text{ATP}^{4-}$ | [1.23, 1.70] | |\n", + "| $\\text{HEPES}^-$ | [1.53, 1.59] | [6.13, 6.36] |\n", + "| $\\text{Gluconate}^-$ | [121.9, 127.0] | |\n", + "\n", + "Details:\n", + "\n", + "- The sodium and potassium brackets include the amount added by titration (with no extra error)\n", + "- The $\\text{CaCl}_2$ and $\\text{MgCl}_2$ brackets are based on a 2% error\n", + "- The free chloride concentration was summed from the various brackets containing it\n", + "- The deprotonated HEPES was recalculated\n", + "- The CaEGTA bracket was set to the Ca bracket\n", + "- The EGTA bracket was based on the Ca and EGTA brackets\n", + "- The MgATP bracket was set to the Mg bracket\n", + "- A free ATP bracket was calculated from the ATP and Mg brackets, and split into 16.5% and 83.5%\n" + ] + }, + { + "cell_type": "markdown", + "id": "8ceb5529-e623-4017-bc74-b20a481ff1ab", + "metadata": {}, + "source": [ + "### Reversal potentials\n", + "\n", + "Using the error bounds on concentrations, we can explore the reversal potentials:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "1d3e3da9-5ebf-4a80-a7cd-5c3bdc7f2681", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ENa: 73.83 [73.22, 77.57]\n", + " dE: 3.7\n" + ] + } + ], + "source": [ + "ENa = R * T / F * math.log(148 / 8)\n", + "Elo = R * T / F * math.log(144.5 / 8)\n", + "Ehi = R * T / F * math.log(150.1 / 7)\n", + "\n", + "print(f'ENa: {ENa:.4} [{Elo:.4}, {Ehi:.4}]')\n", + "print(f' dE: {max(Ehi - ENa, ENa - Elo):.2}')" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "8702bc8f-6fce-4aea-8eec-00e6eb1e75b1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "EK: -84.81 [-85.88, -83.77]\n", + "dE: 1.1\n" + ] + } + ], + "source": [ + "EK = R * T / F * math.log(5.4 / 154.2)\n", + "Elo = R * T / F * math.log(5.25 / 156.4)\n", + "Ehi = R * T / F * math.log(5.5 / 150.7)\n", + "\n", + "print(f'EK: {EK:.4} [{Elo:.4}, {Ehi:.4}]')\n", + "print(f'dE: {max(Ehi - EK, EK - Elo):.2}')" + ] + }, + { + "cell_type": "markdown", + "id": "e7b94a3c-0ac2-4ea9-914f-180fc8f716c4", + "metadata": {}, + "source": [ + "Or alternatively a $\\pm3.7\\,\\text{mV}$ error in $\\text{E}_\\text{Na}$, and a $\\pm1.1\\,\\text{mV}$ error in $\\text{E}_\\text{K}$." + ] + }, + { + "cell_type": "markdown", + "id": "ae524b44-38e5-4d9d-99d6-4ce62a3f38bf", + "metadata": {}, + "source": [ + "### Liquid junction potential\n", + "\n", + "Assuming only correlated errors, we can explore both edges of the brackets with the following LJP input:\n", + "\n", + "```\n", + "ion: Na, +1, 50.11, 8, 144.5\n", + "ion: K, +1, 73.5, 156.4, 5.25\n", + "ion: Cl, -1, 76.31, 15.5, 152\n", + "ion: Ca, +2, 59.5, 0, 0.98\n", + "ion: EGTA(2-), -2, 35.28, 5.12, 0\n", + "ion: Mg, +2, 53.06, 0, 0.98\n", + "ion: ATP (Adenosine 5'-Triphosphate), -2, 22.05, 2.04, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -3, 33.075, 0.34, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -4, 44.1, 1.70, 0\n", + "ion: HEPES, -1, 22.05, 1.59, 6.13\n", + "ion: Gluconate, -1, 24.255, 127, 0\n", + "temperatureC: 20.5\n", + "```\n", + "Which yields +15.9mV" + ] + }, + { + "cell_type": "markdown", + "id": "6e8ba970-0533-4ac1-a5eb-951253000077", + "metadata": {}, + "source": [ + "and\n", + "```\n", + "ion: Na, +1, 50.11, 7, 150.1\n", + "ion: K, +1, 73.5, 150.7, 5.5\n", + "ion: Cl, -1, 76.31, 14.8, 153\n", + "ion: Ca, +2, 59.5, 0, 1.02\n", + "ion: EGTA(2-), -2, 35.28, 4.75, 0\n", + "ion: Mg, +2, 53.06, 0, 1.02\n", + "ion: ATP (Adenosine 5'-Triphosphate), -2, 22.05, 1.96, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -3, 33.075, 0.24, 0\n", + "ion: ATP (Adenosine 5'-Triphosphate), -4, 44.1, 1.23, 0\n", + "ion: HEPES, -1, 22.05, 1.53, 6.36\n", + "ion: Gluconate, -1, 24.255, 121.9, 0\n", + "temperatureC: 20.5\n", + "```\n", + "Which yields +15.5mV" + ] + }, + { + "cell_type": "markdown", + "id": "1e047d25-4efc-4662-99f9-101bf8f4a01b", + "metadata": {}, + "source": [ + "For a combined LJP estimate of +15.8 mV [15.5, 15.9]." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/tutorial/appendix/s-solutions/img/sol-purity-error.png b/tutorial/appendix/s-solutions/img/sol-purity-error.png new file mode 100644 index 0000000..0789e2f Binary files /dev/null and b/tutorial/appendix/s-solutions/img/sol-purity-error.png differ diff --git a/tutorial/references.ipynb b/tutorial/references.ipynb index a0088d5..926b489 100644 --- a/tutorial/references.ipynb +++ b/tutorial/references.ipynb @@ -42,18 +42,38 @@ "- HEKA manuals and tutorials are available from [heka.com](https://www.heka.com)" ] }, + { + "cell_type": "markdown", + "id": "3cfcf376-8edd-4ba1-8a1d-6a6f4fa48780", + "metadata": {}, + "source": [ + "## Electrophysiology solutions\n", + "\n", + "- [Bers, Patton, Nuccitelli (2010) A Practical Guide to the Preparation of Ca Buffers](https://doi.org/10.1016/S0091-679X(08)61108-5)\n", + "- [Dweck, Reyes-Alfonso Jr, Potter (2005) Expanding the range of free calcium regulation in biological solutions](https://doi.org/10.1016/j.ab.2005.09.025)\n", + "- [Keramidas, Kuhlmann, Moorhouse, Barry (1999) Measurement of the limiting equivalent conductivities and mobilities of the most prevalent ionic species of EGTA for use in electrophysiological experiments](https://doi.org/10.1016/S0165-0270(99)00036-9)\n", + "- [McGuigan, Kay, Elder (2016) Ionised concentrations in calcium and magnesium buffers; Standards and precise measurement are mandatory](https://doi.org/10.1016/j.pbiomolbio.2016.03.002)\n", + "- [Miller, Smith (1984) EGTA purity and the buffering of calcium ions in physiological solutions](https://doi.org/10.1152/ajpcell.1984.246.1.C160)\n", + "- [Smith, Miller (1984) Potentiometric measurements of stoichiometric and apparent affinity constants of EGTA for protons and divalent ions including calcium](https://doi.org/10.1016/0304-4165(85)90011-X)\n", + "- [Spahiu, Kastrati, Amrute-Nayak (2024) PyChelator; a Python-based Colab and web application for metal chelator calculations](https://doi.org/10.1186/s12859-024-05858-8)\n", + "- [Stockbridge, Wolfenden (2009) The Intrinsic Reactivity of ATP and the Catalytic Proficiencies of Kinases Acting on Glucose, N-Acetylgalactosamine, and Homoserine](https://doi.org/10.1074/jbc.M109.017806)\n" + ] + }, { "cell_type": "markdown", "id": "84a95a78", "metadata": {}, "source": [ - "## Leak and access resistance\n", + "## Leak, access resistance, and seal formation\n", "\n", "- [Fenwick, Marty, Neher (1982) A patch-clamp study of bovine chromaffin cells and of their sensitivity to acetylcholine](https://doi.org/10.1113/jphysiol.1982.sp014393)\n", "- [Fischmeister, Ayer, DeHaan (1986) Some limitations of patch clamp techniques](https://doi.org/10.1007/BF00582957)\n", "- [Lei, Fabbri et al. De Boer (2021) A nonlinear and time-dependent leak current in the presence of calcium fluoride patch-clamp seal enhancer](https://doi.org/10.12688/wellcomeopenres.15968.2)\n", - "- [Majid Malboubi (2011) Study of gigaseal formation in patch clamping using nanotechnology](https://etheses.bham.ac.uk/id/eprint/3137/1/Malboubi11PhD.pdf)\n", - "- [Milton, Caldwell (1990) How do patch clamp seals form? A lipid bleb model](https://doi.org/10.1007/BF00370626)\n" + "- [Li, Chen et al., Zhao (2026) A robotic patch-clamp system with real-time localization and phase-synchronized capture of dynamic in vivo cells using micropipette resistance modelling](https://doi.org/10.1038/s41378-026-01325-x)\n", + "- [Majid Malboubi (2011) Study of gigaseal formation in patch clamping using nanotechnology](https://etheses.bham.ac.uk//id/eprint/3137/)\n", + "- [Milton, Caldwell (1990) How do patch clamp seals form? A lipid bleb model](https://doi.org/10.1007/BF00370626)\n", + "- [Suchyna, Markin, Sachs (2009) Biophysics and Structure of the Patch and the Gigaseal](https://doi.org/10.1016/j.bpj.2009.05.018)\n", + "- [Yang, Lai (2023) A predictive model for seal condition in an automated patch clamp system](https://doi.org/10.1007/s12213-023-00160-x)\n" ] }, {