{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import sys\n", "import os\n", "import math\n", "import importlib\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.5" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# from Unckless et al, \"Modeling the Manipulation of Natural Populations by the Mutagenic Chain Reaction\"\n", "# doi: 10.1534/genetics.115.177592\n", "conversion_rate = 1 # 100% converted per generation\n", "# s = fitness = 0 (neutral), so Se simplifies to just\n", "Se = conversion_rate\n", "Ne = 2726151 # number of people alive in the Familinx dataset in 1809. It's our population size.\n", "q_critical = 1/(2*Ne*Se)\n", "# how many people for gene drive to not die out?\n", "q_critical * Ne" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "def calc(q0):\n", " generations_to_half = (1/(2*Se))*math.log(Ne/q0)\n", " # how many years is that\n", " # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2602656/\n", " # https://en.wikipedia.org/w/index.php?title=Generation_time&oldid=859057208\n", " generation_time = 26\n", " generation_years = generations_to_half*generation_time\n", " print(\"q0=\"+str(int(q0*100)) + \"%\", \"generations to half:\", generations_to_half, \"or\", generation_years, \"years\") " ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "q0=1% generations to half: 9.711785734104552 or 252.50642908671836 years\n", "q0=5% generations to half: 8.907066777887502 or 231.58373622507506 years\n", "q0=10% generations to half: 8.56049318760753 or 222.5728228777958 years\n", "q0=15% generations to half: 8.357760633553447 or 217.30177647238963 years\n", "q0=20% generations to half: 8.213919597327557 or 213.5619095305165 years\n" ] } ], "source": [ "for ratio in [0.01, 0.05, 0.10, 0.15, 0.20]:\n", " calc(ratio)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }