{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Editing models with pygor3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A default model can be edited with IGoR from an already defined model. If you want to do it from scratch you need to IGoR C++ source code"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading default IGoR model from path :  /home/alfaceor/.local/share/igor/models/human/tcr_beta/\n",
      "Parms filename:  /home/alfaceor/.local/share/igor/models/human/tcr_beta/models/model_parms.txt\n",
      "Margs filename:  /home/alfaceor/.local/share/igor/models/human/tcr_beta/models/model_marginals.txt\n",
      "--------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "import pygor3 as p3\n",
    "species=\"human\"\n",
    "chain=\"tcr_beta\"\n",
    "mdl = p3.IgorModel.load_default(species, chain)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Changing Edges"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exporting model parms in file  mdl_parms0.txt\n",
      "Exporting model marginals in file  mdl_marginals0.txt\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 16636 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "mdl.parms.write_model_parms(\"mdl_parms0.txt\")\n",
    "mdl.marginals.write_model_marginals(\"mdl_marginals0.txt\", model_parms=mdl.parms)\n",
    "mdl.parms.plot_Graph()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       "html[theme=dark],\n",
       "body.vscode-dark {\n",
       "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
       "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
       "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
       "  --xr-border-color: #1F1F1F;\n",
       "  --xr-disabled-color: #515151;\n",
       "  --xr-background-color: #111111;\n",
       "  --xr-background-color-row-even: #111111;\n",
       "  --xr-background-color-row-odd: #313131;\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  display: block;\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-text-repr-fallback {\n",
       "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray (vd_ins: 31)&gt;\n",
       "array([4.35094e-02, 4.52818e-02, 1.03509e-01, 1.20815e-01, 1.57023e-01,\n",
       "       1.05497e-01, 8.40290e-02, 7.83653e-02, 5.68835e-02, 5.48993e-02,\n",
       "       3.86246e-02, 3.54925e-02, 2.02105e-02, 1.92853e-02, 1.03827e-02,\n",
       "       6.84924e-03, 4.88492e-03, 4.36633e-03, 2.46267e-03, 2.73884e-03,\n",
       "       5.42621e-04, 1.46427e-03, 9.83047e-04, 9.36636e-04, 1.31972e-04,\n",
       "       3.10250e-04, 2.60741e-04, 1.25265e-04, 1.92298e-09, 0.00000e+00,\n",
       "       1.35988e-04])\n",
       "Coordinates:\n",
       "  * vd_ins       (vd_ins) int64 0 1 2 3 4 5 6 7 8 ... 22 23 24 25 26 27 28 29 30\n",
       "    lbl__vd_ins  (vd_ins) int64 0 1 2 3 4 5 6 7 8 ... 22 23 24 25 26 27 28 29 30\n",
       "Attributes:\n",
       "    nickname:    vd_ins\n",
       "    event_type:  Insertion\n",
       "    seq_type:    VD_genes\n",
       "    seq_side:    Undefined_side\n",
       "    priority:    4\n",
       "    parents:     []\n",
       "    childs:      []</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'></div><ul class='xr-dim-list'><li><span class='xr-has-index'>vd_ins</span>: 31</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-d0b7e752-8f21-4096-93c8-1968acbab569' class='xr-array-in' type='checkbox' checked><label for='section-d0b7e752-8f21-4096-93c8-1968acbab569' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>0.04351 0.04528 0.1035 0.1208 ... 0.0001253 1.923e-09 0.0 0.000136</span></div><div class='xr-array-data'><pre>array([4.35094e-02, 4.52818e-02, 1.03509e-01, 1.20815e-01, 1.57023e-01,\n",
       "       1.05497e-01, 8.40290e-02, 7.83653e-02, 5.68835e-02, 5.48993e-02,\n",
       "       3.86246e-02, 3.54925e-02, 2.02105e-02, 1.92853e-02, 1.03827e-02,\n",
       "       6.84924e-03, 4.88492e-03, 4.36633e-03, 2.46267e-03, 2.73884e-03,\n",
       "       5.42621e-04, 1.46427e-03, 9.83047e-04, 9.36636e-04, 1.31972e-04,\n",
       "       3.10250e-04, 2.60741e-04, 1.25265e-04, 1.92298e-09, 0.00000e+00,\n",
       "       1.35988e-04])</pre></div></div></li><li class='xr-section-item'><input id='section-c99e2ad7-8fba-473c-abc6-ab5b6c129489' class='xr-section-summary-in' type='checkbox'  checked><label for='section-c99e2ad7-8fba-473c-abc6-ab5b6c129489' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>vd_ins</span></div><div class='xr-var-dims'>(vd_ins)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 6 ... 25 26 27 28 29 30</div><input id='attrs-3fede84b-88c9-4f05-ad9a-907428ad05b7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3fede84b-88c9-4f05-ad9a-907428ad05b7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5ac2dacd-4ce2-402c-8d6d-3e3079a0ebed' class='xr-var-data-in' type='checkbox'><label for='data-5ac2dacd-4ce2-402c-8d6d-3e3079a0ebed' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,\n",
       "       18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lbl__vd_ins</span></div><div class='xr-var-dims'>(vd_ins)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 6 ... 25 26 27 28 29 30</div><input id='attrs-6235d619-ccf0-49a5-beef-9cd763f4c7e2' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6235d619-ccf0-49a5-beef-9cd763f4c7e2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ac153cad-1b7a-4274-99dd-00fc0e10c0e1' class='xr-var-data-in' type='checkbox'><label for='data-ac153cad-1b7a-4274-99dd-00fc0e10c0e1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,\n",
       "       17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-2fe01ce7-da1e-4be1-94c2-da986b10f11d' class='xr-section-summary-in' type='checkbox'  checked><label for='section-2fe01ce7-da1e-4be1-94c2-da986b10f11d' class='xr-section-summary' >Attributes: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>nickname :</span></dt><dd>vd_ins</dd><dt><span>event_type :</span></dt><dd>Insertion</dd><dt><span>seq_type :</span></dt><dd>VD_genes</dd><dt><span>seq_side :</span></dt><dd>Undefined_side</dd><dt><span>priority :</span></dt><dd>4</dd><dt><span>parents :</span></dt><dd>[]</dd><dt><span>childs :</span></dt><dd>[]</dd></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.DataArray (vd_ins: 31)>\n",
       "array([4.35094e-02, 4.52818e-02, 1.03509e-01, 1.20815e-01, 1.57023e-01,\n",
       "       1.05497e-01, 8.40290e-02, 7.83653e-02, 5.68835e-02, 5.48993e-02,\n",
       "       3.86246e-02, 3.54925e-02, 2.02105e-02, 1.92853e-02, 1.03827e-02,\n",
       "       6.84924e-03, 4.88492e-03, 4.36633e-03, 2.46267e-03, 2.73884e-03,\n",
       "       5.42621e-04, 1.46427e-03, 9.83047e-04, 9.36636e-04, 1.31972e-04,\n",
       "       3.10250e-04, 2.60741e-04, 1.25265e-04, 1.92298e-09, 0.00000e+00,\n",
       "       1.35988e-04])\n",
       "Coordinates:\n",
       "  * vd_ins       (vd_ins) int64 0 1 2 3 4 5 6 7 8 ... 22 23 24 25 26 27 28 29 30\n",
       "    lbl__vd_ins  (vd_ins) int64 0 1 2 3 4 5 6 7 8 ... 22 23 24 25 26 27 28 29 30\n",
       "Attributes:\n",
       "    nickname:    vd_ins\n",
       "    event_type:  Insertion\n",
       "    seq_type:    VD_genes\n",
       "    seq_side:    Undefined_side\n",
       "    priority:    4\n",
       "    parents:     []\n",
       "    childs:      []"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mdl['vd_ins']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exporting model parms in file  mdl_parms1.txt\n",
      "Exporting model marginals in file  mdl_marginals1.txt\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 17128 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "mdl.parms.add_Egde('v_choice', 'vd_ins')\n",
    "mdl.parms.write_model_parms(\"mdl_parms1.txt\")\n",
    "mdl.marginals.initialize_uniform_from_model_parms(mdl.parms)\n",
    "mdl.marginals.write_model_marginals(\"mdl_marginals1.txt\", model_parms=mdl.parms)\n",
    "mdl.parms.plot_Graph()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exporting model parms in file  mdl_parms3.txt\n",
      "Exporting model marginals in file  mdl_marginals3.txt\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 16744 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "mdl.parms.remove_Edge('d_5_del', 'd_3_del')\n",
    "mdl.parms.write_model_parms(\"mdl_parms3.txt\")\n",
    "mdl.marginals.initialize_uniform_from_model_parms(mdl.parms)\n",
    "mdl.marginals.write_model_marginals(\"mdl_marginals3.txt\", model_parms=mdl.parms)\n",
    "mdl.parms.plot_Graph()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Changing Event realizations"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading default IGoR model from path :  /home/alfaceor/.local/share/igor/models/mouse/tcr_beta/\n",
      "Parms filename:  /home/alfaceor/.local/share/igor/models/mouse/tcr_beta/models/model_parms.txt\n",
      "Margs filename:  /home/alfaceor/.local/share/igor/models/mouse/tcr_beta/models/model_marginals.txt\n",
      "--------------------------------------------------\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 15888 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import pygor3 as p3\n",
    "species=\"mouse\"\n",
    "chain=\"tcr_beta\"\n",
    "mdl = p3.IgorModel.load_default(species, chain)\n",
    "mdl.parms.plot_Graph()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       "html[theme=dark],\n",
       "body.vscode-dark {\n",
       "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
       "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
       "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
       "  --xr-border-color: #1F1F1F;\n",
       "  --xr-disabled-color: #515151;\n",
       "  --xr-background-color: #111111;\n",
       "  --xr-background-color-row-even: #111111;\n",
       "  --xr-background-color-row-odd: #313131;\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  display: block;\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-text-repr-fallback {\n",
       "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray (j_choice: 14, d_gene: 2)&gt;\n",
       "array([[9.97119e-01, 2.88075e-03],\n",
       "       [9.91182e-01, 8.81843e-03],\n",
       "       [9.99812e-01, 1.87606e-04],\n",
       "       [9.99621e-01, 3.78589e-04],\n",
       "       [9.97135e-01, 2.86515e-03],\n",
       "       [9.93902e-01, 6.09815e-03],\n",
       "       [0.00000e+00, 0.00000e+00],\n",
       "       [5.02666e-01, 4.97334e-01],\n",
       "       [6.20184e-01, 3.79816e-01],\n",
       "       [5.45690e-01, 4.54310e-01],\n",
       "       [5.22695e-01, 4.77305e-01],\n",
       "       [5.28208e-01, 4.71792e-01],\n",
       "       [0.00000e+00, 0.00000e+00],\n",
       "       [5.10279e-01, 4.89721e-01]])\n",
       "Coordinates:\n",
       "  * j_choice       (j_choice) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n",
       "    lbl__j_choice  (j_choice) object &#x27;TRBJ1-1*01&#x27; &#x27;TRBJ1-2*01&#x27; ... &#x27;TRBJ2-7*01&#x27;\n",
       "    seq__j_choice  (j_choice) object &#x27;CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCA...\n",
       "  * d_gene         (d_gene) int64 0 1\n",
       "    lbl__d_gene    (d_gene) object &#x27;TRBD1*01&#x27; &#x27;TRBD2*01&#x27;\n",
       "    seq__d_gene    (d_gene) object &#x27;GGGACAGGGGGC&#x27; &#x27;GGGACTGGGGGGGC&#x27;\n",
       "Attributes:\n",
       "    nickname:    d_gene\n",
       "    event_type:  GeneChoice\n",
       "    seq_type:    D_gene\n",
       "    seq_side:    Undefined_side\n",
       "    priority:    6\n",
       "    parents:     [&#x27;j_choice&#x27;]\n",
       "    childs:      [&#x27;d_3_del&#x27;, &#x27;d_5_del&#x27;]</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'></div><ul class='xr-dim-list'><li><span class='xr-has-index'>j_choice</span>: 14</li><li><span class='xr-has-index'>d_gene</span>: 2</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-e1f151da-30ca-40ec-a2e5-ed4a23f61b67' class='xr-array-in' type='checkbox' checked><label for='section-e1f151da-30ca-40ec-a2e5-ed4a23f61b67' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>0.9971 0.002881 0.9912 0.008818 0.9998 ... 0.0 0.0 0.5103 0.4897</span></div><div class='xr-array-data'><pre>array([[9.97119e-01, 2.88075e-03],\n",
       "       [9.91182e-01, 8.81843e-03],\n",
       "       [9.99812e-01, 1.87606e-04],\n",
       "       [9.99621e-01, 3.78589e-04],\n",
       "       [9.97135e-01, 2.86515e-03],\n",
       "       [9.93902e-01, 6.09815e-03],\n",
       "       [0.00000e+00, 0.00000e+00],\n",
       "       [5.02666e-01, 4.97334e-01],\n",
       "       [6.20184e-01, 3.79816e-01],\n",
       "       [5.45690e-01, 4.54310e-01],\n",
       "       [5.22695e-01, 4.77305e-01],\n",
       "       [5.28208e-01, 4.71792e-01],\n",
       "       [0.00000e+00, 0.00000e+00],\n",
       "       [5.10279e-01, 4.89721e-01]])</pre></div></div></li><li class='xr-section-item'><input id='section-609c834f-78df-46ed-8755-abfd94400d1e' class='xr-section-summary-in' type='checkbox'  checked><label for='section-609c834f-78df-46ed-8755-abfd94400d1e' class='xr-section-summary' >Coordinates: <span>(6)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>j_choice</span></div><div class='xr-var-dims'>(j_choice)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 6 7 8 9 10 11 12 13</div><input id='attrs-cc284403-2efc-48a2-bbd4-613e94dd22e7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-cc284403-2efc-48a2-bbd4-613e94dd22e7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2c797f9a-ed7e-46fa-97d8-cf1499a2e109' class='xr-var-data-in' type='checkbox'><label for='data-2c797f9a-ed7e-46fa-97d8-cf1499a2e109' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lbl__j_choice</span></div><div class='xr-var-dims'>(j_choice)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;TRBJ1-1*01&#x27; ... &#x27;TRBJ2-7*01&#x27;</div><input id='attrs-5d020f4f-ead6-473e-b5f6-c5f0d7944121' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-5d020f4f-ead6-473e-b5f6-c5f0d7944121' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-fda0df91-b2c4-4b64-b6b9-7d4dc7f170f9' class='xr-var-data-in' type='checkbox'><label for='data-fda0df91-b2c4-4b64-b6b9-7d4dc7f170f9' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;TRBJ1-1*01&#x27;, &#x27;TRBJ1-2*01&#x27;, &#x27;TRBJ1-3*01&#x27;, &#x27;TRBJ1-4*01&#x27;,\n",
       "       &#x27;TRBJ1-5*01&#x27;, &#x27;TRBJ1-6*01&#x27;, &#x27;TRBJ1-7*01&#x27;, &#x27;TRBJ2-1*01&#x27;,\n",
       "       &#x27;TRBJ2-2*01&#x27;, &#x27;TRBJ2-3*01&#x27;, &#x27;TRBJ2-4*01&#x27;, &#x27;TRBJ2-5*01&#x27;,\n",
       "       &#x27;TRBJ2-6*01&#x27;, &#x27;TRBJ2-7*01&#x27;], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>seq__j_choice</span></div><div class='xr-var-dims'>(j_choice)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;CAAACACAGAAGTCTTCTTTGGTAAAGGAAC...</div><input id='attrs-69822bba-027e-4d57-a0d1-d59d46bfa9ea' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-69822bba-027e-4d57-a0d1-d59d46bfa9ea' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cd2cca33-38a5-4560-8a93-82e59c8c7d0b' class='xr-var-data-in' type='checkbox'><label for='data-cd2cca33-38a5-4560-8a93-82e59c8c7d0b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCACAGTTGTAG&#x27;,\n",
       "       &#x27;CAAACTCCGACTACACCTTCGGCTCAGGGACCAGGCTTTTGGTAATAG&#x27;,\n",
       "       &#x27;TTCTGGAAATACGCTCTATTTTGGAGAAGGAAGCCGGCTCATTGTTGTAG&#x27;,\n",
       "       &#x27;TTTCCAACGAAAGATTATTTTTCGGTCATGGAACCAAGCTGTCTGTCCTGG&#x27;,\n",
       "       &#x27;TAACAACCAGGCTCCGCTTTTTGGAGAGGGGACTCGACTCTCTGTTCTAG&#x27;,\n",
       "       &#x27;TTCCTATAATTCGCCCCTCTACTTTGCGGCAGGCACCCGGCTCACTGTGACAG&#x27;,\n",
       "       &#x27;CCTGTGTTGGATGACCATGGTCTTGGAAAGGAACTTAGGTATAAGA&#x27;,\n",
       "       &#x27;TAACTATGCTGAGCAGTTCTTCGGACCAGGGACACGACTCACCGTCCTAG&#x27;,\n",
       "       &#x27;CAAACACCGGGCAGCTCTACTTTGGTGAAGGCTCAAAGCTGACAGTGCTGG&#x27;,\n",
       "       &#x27;AGTGCAGAAACGCTGTATTTTGGCTCAGGAACCAGACTGACTGTTCTCG&#x27;,\n",
       "       &#x27;AGTCAAAACACCTTGTACTTTGGTGCGGGCACCCGACTATCGGTGCTAG&#x27;,\n",
       "       &#x27;AACCAAGACACCCAGTACTTTGGGCCAGGCACTCGGCTCCTCGTGTTAG&#x27;,\n",
       "       &#x27;CAGCCCTTGCCCTGACTGATTGGCAGCCGATTGAACAGCCTATGCGAG&#x27;,\n",
       "       &#x27;CTCCTATGAACAGTACTTCGGTCCCGGCACCAGGCTCACGGTTTTAG&#x27;], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>d_gene</span></div><div class='xr-var-dims'>(d_gene)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1</div><input id='attrs-21ee25bb-57ce-466a-954a-5debdf14531a' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-21ee25bb-57ce-466a-954a-5debdf14531a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c8877ad1-3d75-49e5-b3d5-98ea53ba4cb0' class='xr-var-data-in' type='checkbox'><label for='data-c8877ad1-3d75-49e5-b3d5-98ea53ba4cb0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lbl__d_gene</span></div><div class='xr-var-dims'>(d_gene)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;TRBD1*01&#x27; &#x27;TRBD2*01&#x27;</div><input id='attrs-02aeb710-bf66-4921-8c67-b235db32da78' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-02aeb710-bf66-4921-8c67-b235db32da78' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c2259740-2184-4a75-950a-901342eb93c3' class='xr-var-data-in' type='checkbox'><label for='data-c2259740-2184-4a75-950a-901342eb93c3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;TRBD1*01&#x27;, &#x27;TRBD2*01&#x27;], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>seq__d_gene</span></div><div class='xr-var-dims'>(d_gene)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;GGGACAGGGGGC&#x27; &#x27;GGGACTGGGGGGGC&#x27;</div><input id='attrs-6de1babb-26a0-44f3-92a7-1860df013b7d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6de1babb-26a0-44f3-92a7-1860df013b7d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-38bd18a2-3177-40d1-981e-190403033aff' class='xr-var-data-in' type='checkbox'><label for='data-38bd18a2-3177-40d1-981e-190403033aff' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;GGGACAGGGGGC&#x27;, &#x27;GGGACTGGGGGGGC&#x27;], dtype=object)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-b085c1c5-2821-415c-8bd7-f02f55921042' class='xr-section-summary-in' type='checkbox'  checked><label for='section-b085c1c5-2821-415c-8bd7-f02f55921042' class='xr-section-summary' >Attributes: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>nickname :</span></dt><dd>d_gene</dd><dt><span>event_type :</span></dt><dd>GeneChoice</dd><dt><span>seq_type :</span></dt><dd>D_gene</dd><dt><span>seq_side :</span></dt><dd>Undefined_side</dd><dt><span>priority :</span></dt><dd>6</dd><dt><span>parents :</span></dt><dd>[&#x27;j_choice&#x27;]</dd><dt><span>childs :</span></dt><dd>[&#x27;d_3_del&#x27;, &#x27;d_5_del&#x27;]</dd></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.DataArray (j_choice: 14, d_gene: 2)>\n",
       "array([[9.97119e-01, 2.88075e-03],\n",
       "       [9.91182e-01, 8.81843e-03],\n",
       "       [9.99812e-01, 1.87606e-04],\n",
       "       [9.99621e-01, 3.78589e-04],\n",
       "       [9.97135e-01, 2.86515e-03],\n",
       "       [9.93902e-01, 6.09815e-03],\n",
       "       [0.00000e+00, 0.00000e+00],\n",
       "       [5.02666e-01, 4.97334e-01],\n",
       "       [6.20184e-01, 3.79816e-01],\n",
       "       [5.45690e-01, 4.54310e-01],\n",
       "       [5.22695e-01, 4.77305e-01],\n",
       "       [5.28208e-01, 4.71792e-01],\n",
       "       [0.00000e+00, 0.00000e+00],\n",
       "       [5.10279e-01, 4.89721e-01]])\n",
       "Coordinates:\n",
       "  * j_choice       (j_choice) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n",
       "    lbl__j_choice  (j_choice) object 'TRBJ1-1*01' 'TRBJ1-2*01' ... 'TRBJ2-7*01'\n",
       "    seq__j_choice  (j_choice) object 'CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCA...\n",
       "  * d_gene         (d_gene) int64 0 1\n",
       "    lbl__d_gene    (d_gene) object 'TRBD1*01' 'TRBD2*01'\n",
       "    seq__d_gene    (d_gene) object 'GGGACAGGGGGC' 'GGGACTGGGGGGGC'\n",
       "Attributes:\n",
       "    nickname:    d_gene\n",
       "    event_type:  GeneChoice\n",
       "    seq_type:    D_gene\n",
       "    seq_side:    Undefined_side\n",
       "    priority:    6\n",
       "    parents:     ['j_choice']\n",
       "    childs:      ['d_3_del', 'd_5_del']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mdl['d_gene']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.QuadMesh at 0x7fb996c90b90>"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 9332 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mdl['d_gene'].plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>value</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCACAGTTGTAG</td>\n",
       "      <td>TRBJ1-1*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>CAAACTCCGACTACACCTTCGGCTCAGGGACCAGGCTTTTGGTAATAG</td>\n",
       "      <td>TRBJ1-2*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>TTCTGGAAATACGCTCTATTTTGGAGAAGGAAGCCGGCTCATTGTT...</td>\n",
       "      <td>TRBJ1-3*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>TTTCCAACGAAAGATTATTTTTCGGTCATGGAACCAAGCTGTCTGT...</td>\n",
       "      <td>TRBJ1-4*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>TAACAACCAGGCTCCGCTTTTTGGAGAGGGGACTCGACTCTCTGTT...</td>\n",
       "      <td>TRBJ1-5*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>TTCCTATAATTCGCCCCTCTACTTTGCGGCAGGCACCCGGCTCACT...</td>\n",
       "      <td>TRBJ1-6*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>CCTGTGTTGGATGACCATGGTCTTGGAAAGGAACTTAGGTATAAGA</td>\n",
       "      <td>TRBJ1-7*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>TAACTATGCTGAGCAGTTCTTCGGACCAGGGACACGACTCACCGTC...</td>\n",
       "      <td>TRBJ2-1*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>CAAACACCGGGCAGCTCTACTTTGGTGAAGGCTCAAAGCTGACAGT...</td>\n",
       "      <td>TRBJ2-2*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>AGTGCAGAAACGCTGTATTTTGGCTCAGGAACCAGACTGACTGTTCTCG</td>\n",
       "      <td>TRBJ2-3*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>AGTCAAAACACCTTGTACTTTGGTGCGGGCACCCGACTATCGGTGCTAG</td>\n",
       "      <td>TRBJ2-4*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>AACCAAGACACCCAGTACTTTGGGCCAGGCACTCGGCTCCTCGTGTTAG</td>\n",
       "      <td>TRBJ2-5*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>CAGCCCTTGCCCTGACTGATTGGCAGCCGATTGAACAGCCTATGCGAG</td>\n",
       "      <td>TRBJ2-6*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>CTCCTATGAACAGTACTTCGGTCCCGGCACCAGGCTCACGGTTTTAG</td>\n",
       "      <td>TRBJ2-7*01</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                value        name\n",
       "id                                                               \n",
       "0    CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCACAGTTGTAG  TRBJ1-1*01\n",
       "1    CAAACTCCGACTACACCTTCGGCTCAGGGACCAGGCTTTTGGTAATAG  TRBJ1-2*01\n",
       "2   TTCTGGAAATACGCTCTATTTTGGAGAAGGAAGCCGGCTCATTGTT...  TRBJ1-3*01\n",
       "3   TTTCCAACGAAAGATTATTTTTCGGTCATGGAACCAAGCTGTCTGT...  TRBJ1-4*01\n",
       "4   TAACAACCAGGCTCCGCTTTTTGGAGAGGGGACTCGACTCTCTGTT...  TRBJ1-5*01\n",
       "5   TTCCTATAATTCGCCCCTCTACTTTGCGGCAGGCACCCGGCTCACT...  TRBJ1-6*01\n",
       "6      CCTGTGTTGGATGACCATGGTCTTGGAAAGGAACTTAGGTATAAGA  TRBJ1-7*01\n",
       "7   TAACTATGCTGAGCAGTTCTTCGGACCAGGGACACGACTCACCGTC...  TRBJ2-1*01\n",
       "8   CAAACACCGGGCAGCTCTACTTTGGTGAAGGCTCAAAGCTGACAGT...  TRBJ2-2*01\n",
       "9   AGTGCAGAAACGCTGTATTTTGGCTCAGGAACCAGACTGACTGTTCTCG  TRBJ2-3*01\n",
       "10  AGTCAAAACACCTTGTACTTTGGTGCGGGCACCCGACTATCGGTGCTAG  TRBJ2-4*01\n",
       "11  AACCAAGACACCCAGTACTTTGGGCCAGGCACTCGGCTCCTCGTGTTAG  TRBJ2-5*01\n",
       "12   CAGCCCTTGCCCTGACTGATTGGCAGCCGATTGAACAGCCTATGCGAG  TRBJ2-6*01\n",
       "13    CTCCTATGAACAGTACTTCGGTCCCGGCACCAGGCTCACGGTTTTAG  TRBJ2-7*01"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = mdl.get_event_realizations_DataFrame('j_choice')\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we can simple edit this dataframe "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>value</th>\n",
       "      <th>name</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCACAGTTGTAG</td>\n",
       "      <td>TRBJ1-1*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>CAAACTCCGACTACACCTTCGGCTCAGGGACCAGGCTTTTGGTAATAG</td>\n",
       "      <td>TRBJ1-2*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>TTCTGGAAATACGCTCTATTTTGGAGAAGGAAGCCGGCTCATTGTT...</td>\n",
       "      <td>TRBJ1-3*01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>TTTCCAACGAAAGATTATTTTTCGGTCATGGAACCAAGCTGTCTGT...</td>\n",
       "      <td>TRBJ1-4*01</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                value        name\n",
       "id                                                               \n",
       "0    CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCACAGTTGTAG  TRBJ1-1*01\n",
       "1    CAAACTCCGACTACACCTTCGGCTCAGGGACCAGGCTTTTGGTAATAG  TRBJ1-2*01\n",
       "2   TTCTGGAAATACGCTCTATTTTGGAGAAGGAAGCCGGCTCATTGTT...  TRBJ1-3*01\n",
       "3   TTTCCAACGAAAGATTATTTTTCGGTCATGGAACCAAGCTGTCTGT...  TRBJ1-4*01"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_df = df[:4]\n",
    "new_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "and set it as the new realizations for this particular event and for our model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "mdl.set_realization_event_from_DataFrame('j_choice', new_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exporting model parms in file  mdl_parms3.txt\n",
      "Exporting model marginals in file  mdl_marginals3.txt\n"
     ]
    }
   ],
   "source": [
    "mdl.parms.write_model_parms(\"mdl_parms3.txt\")\n",
    "mdl.marginals.write_model_marginals(\"mdl_marginals3.txt\", model_parms=mdl.parms)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       "html[theme=dark],\n",
       "body.vscode-dark {\n",
       "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
       "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
       "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
       "  --xr-border-color: #1F1F1F;\n",
       "  --xr-disabled-color: #515151;\n",
       "  --xr-background-color: #111111;\n",
       "  --xr-background-color-row-even: #111111;\n",
       "  --xr-background-color-row-odd: #313131;\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  display: block;\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-text-repr-fallback {\n",
       "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray (j_choice: 4)&gt;\n",
       "array([1.  , 0.25, 0.25, 0.25])\n",
       "Coordinates:\n",
       "  * j_choice       (j_choice) int64 0 1 2 3\n",
       "    lbl__j_choice  (j_choice) object &#x27;TRBJ1-1*01&#x27; &#x27;TRBJ1-2*01&#x27; ... &#x27;TRBJ1-4*01&#x27;\n",
       "    seq__j_choice  (j_choice) object &#x27;CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCA...\n",
       "Attributes:\n",
       "    nickname:    j_choice\n",
       "    event_type:  GeneChoice\n",
       "    seq_type:    J_gene\n",
       "    seq_side:    Undefined_side\n",
       "    priority:    7\n",
       "    parents:     []\n",
       "    childs:      [&#x27;j_5_del&#x27;, &#x27;d_gene&#x27;]</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'></div><ul class='xr-dim-list'><li><span class='xr-has-index'>j_choice</span>: 4</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-317ada6f-4cd4-4134-9f42-478ba809c100' class='xr-array-in' type='checkbox' checked><label for='section-317ada6f-4cd4-4134-9f42-478ba809c100' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>1.0 0.25 0.25 0.25</span></div><div class='xr-array-data'><pre>array([1.  , 0.25, 0.25, 0.25])</pre></div></div></li><li class='xr-section-item'><input id='section-c38ed6c8-3ab8-4687-b8ef-30fee0253ae7' class='xr-section-summary-in' type='checkbox'  checked><label for='section-c38ed6c8-3ab8-4687-b8ef-30fee0253ae7' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>j_choice</span></div><div class='xr-var-dims'>(j_choice)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3</div><input id='attrs-cfd26c04-8ee1-443f-b59f-925a8a3171fa' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-cfd26c04-8ee1-443f-b59f-925a8a3171fa' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ce5b080a-8779-490c-965f-f24a3b625068' class='xr-var-data-in' type='checkbox'><label for='data-ce5b080a-8779-490c-965f-f24a3b625068' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([0, 1, 2, 3])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lbl__j_choice</span></div><div class='xr-var-dims'>(j_choice)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;TRBJ1-1*01&#x27; ... &#x27;TRBJ1-4*01&#x27;</div><input id='attrs-fe213b1a-85f9-4259-8f8c-2a6573b5e9e4' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-fe213b1a-85f9-4259-8f8c-2a6573b5e9e4' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-86031e99-0089-4923-9793-dc9b0b179502' class='xr-var-data-in' type='checkbox'><label for='data-86031e99-0089-4923-9793-dc9b0b179502' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;TRBJ1-1*01&#x27;, &#x27;TRBJ1-2*01&#x27;, &#x27;TRBJ1-3*01&#x27;, &#x27;TRBJ1-4*01&#x27;],\n",
       "      dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>seq__j_choice</span></div><div class='xr-var-dims'>(j_choice)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;CAAACACAGAAGTCTTCTTTGGTAAAGGAAC...</div><input id='attrs-e7ce8937-2c9a-4f3a-977c-3ba2e4e400be' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e7ce8937-2c9a-4f3a-977c-3ba2e4e400be' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cad12b18-0b46-49bf-b3d1-a4f6bc087338' class='xr-var-data-in' type='checkbox'><label for='data-cad12b18-0b46-49bf-b3d1-a4f6bc087338' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCACAGTTGTAG&#x27;,\n",
       "       &#x27;CAAACTCCGACTACACCTTCGGCTCAGGGACCAGGCTTTTGGTAATAG&#x27;,\n",
       "       &#x27;TTCTGGAAATACGCTCTATTTTGGAGAAGGAAGCCGGCTCATTGTTGTAG&#x27;,\n",
       "       &#x27;TTTCCAACGAAAGATTATTTTTCGGTCATGGAACCAAGCTGTCTGTCCTGG&#x27;],\n",
       "      dtype=object)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-c822e273-6c15-46a3-af3b-e3547520becd' class='xr-section-summary-in' type='checkbox'  checked><label for='section-c822e273-6c15-46a3-af3b-e3547520becd' class='xr-section-summary' >Attributes: <span>(7)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>nickname :</span></dt><dd>j_choice</dd><dt><span>event_type :</span></dt><dd>GeneChoice</dd><dt><span>seq_type :</span></dt><dd>J_gene</dd><dt><span>seq_side :</span></dt><dd>Undefined_side</dd><dt><span>priority :</span></dt><dd>7</dd><dt><span>parents :</span></dt><dd>[]</dd><dt><span>childs :</span></dt><dd>[&#x27;j_5_del&#x27;, &#x27;d_gene&#x27;]</dd></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.DataArray (j_choice: 4)>\n",
       "array([1.  , 0.25, 0.25, 0.25])\n",
       "Coordinates:\n",
       "  * j_choice       (j_choice) int64 0 1 2 3\n",
       "    lbl__j_choice  (j_choice) object 'TRBJ1-1*01' 'TRBJ1-2*01' ... 'TRBJ1-4*01'\n",
       "    seq__j_choice  (j_choice) object 'CAAACACAGAAGTCTTCTTTGGTAAAGGAACCAGACTCA...\n",
       "Attributes:\n",
       "    nickname:    j_choice\n",
       "    event_type:  GeneChoice\n",
       "    seq_type:    J_gene\n",
       "    seq_side:    Undefined_side\n",
       "    priority:    7\n",
       "    parents:     []\n",
       "    childs:      ['j_5_del', 'd_gene']"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mdl['j_choice'][0]=1\n",
    "mdl['j_choice']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.QuadMesh at 0x7f007974a0d0>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 10976 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "mdl['d_gene'].plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading default IGoR model from path :  /home/alfaceor/.local/share/igor/models/human/tcr_beta/\n",
      "Parms filename:  /home/alfaceor/.local/share/igor/models/human/tcr_beta/models/model_parms.txt\n",
      "Margs filename:  /home/alfaceor/.local/share/igor/models/human/tcr_beta/models/model_marginals.txt\n",
      "--------------------------------------------------\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 25868 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 9588 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 6232 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 17732 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 20128 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 16548 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 17112 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 15344 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 22068 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 15548 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 21228 characters]\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import pygor3 as p3\n",
    "mdl_HTRB = p3.IgorModel.load_default(\"human\", \"tcr_beta\")\n",
    "mdl_HTRB.export_plot_Pmarginals(\"OOO\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Making new model parms from IMGT website"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Downloading IMGT templates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'url.home': 'http://www.imgt.org',\n",
       " 'url.genelist': 'http://www.imgt.org/download/GENE-DB/IMGTGENEDB-GeneList',\n",
       " 'url.genedb': 'http://www.imgt.org/genedb/GENElect?',\n",
       " 'url.release': 'http://www.imgt.org/download/GENE-DB/RELEASE',\n",
       " 'url.readme': 'http://www.imgt.org/download/GENE-DB/README.txt',\n",
       " 'Genesymbol': [],\n",
       " 'data.chainlist': ['TRA', 'TRB', 'BCR']}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pygor3 as p3\n",
    "p3.imgt.imgt_params"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['', 'Ornithorhynchus+anatinus', 'Rattus+rattus', 'Mus+minutoides', 'Danio+rerio', 'Rattus+norvegicus', 'Equus+caballus', 'Papio+anubis+anubis', 'Capra+hircus', 'Mustela+putorius+furo', 'Camelus+dromedarius', 'Mus+cookii', 'Mus+spretus', 'Oncorhynchus+mykiss', 'Cercocebus+atys', 'Vicugna+pacos', 'Mus+saxicola', 'Sus+scrofa', 'Ovis+aries', 'Canis+lupus+familiaris', 'Bos+taurus', 'Mus+musculus', 'Macaca+nemestrina', 'Tursiops+truncatus', 'Felis+catus', 'Macaca+fascicularis', 'Mus+pahari', 'Homo+sapiens', 'Gallus+gallus', 'Salmo+salar', 'Oryctolagus+cuniculus', 'Macaca+mulatta']\n"
     ]
    }
   ],
   "source": [
    "imgt_species_list = p3.imgt.get_species_list()\n",
    "print( imgt_species_list )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Bos+taurus TRAV http://www.imgt.org/genedb/GENElect?query=7.2+TRAV&species=Bos+taurus\n",
      "http://www.imgt.org/genedb/GENElect?query=7.2+TRAV&species=Bos+taurus\n",
      "Bos+taurus TRAD http://www.imgt.org/genedb/GENElect?query=7.2+TRAD&species=Bos+taurus\n",
      "http://www.imgt.org/genedb/GENElect?query=7.2+TRAD&species=Bos+taurus\n",
      "Bos+taurus TRAJ http://www.imgt.org/genedb/GENElect?query=7.2+TRAJ&species=Bos+taurus\n",
      "http://www.imgt.org/genedb/GENElect?query=7.2+TRAJ&species=Bos+taurus\n",
      "Genomic VDJ templates in files:  models/Bos+taurus/TRA/ref_genome/genomicVs__imgt.fasta models/Bos+taurus/TRA/ref_genome/genomicDs__imgt.fasta models/Bos+taurus/TRA/ref_genome/genomicJs__imgt.fasta\n",
      "{}\n",
      "http://www.imgt.org/genedb/GENElect?query=8.1+TRAV&species=Bos+taurus&IMGTlabel=2nd-CYS\n",
      "No anchor is found for : IMGT000049|TRAV10-1*01|Bos taurus_Hereford|P|V-REGION|491414..491602|189 nt|1| | | | |189+0=189|partial in 3'| |\n",
      "No anchor is found for : IMGT000049|TRAV11-3*01|Bos taurus_Hereford|P|V-REGION|2783132..2783410|279 nt|1| | | | |279+0=279| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV12-2*01|Bos taurus_Hereford|P|V-REGION|2571766..2572041|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV13-2*01|Bos taurus_Hereford|P|V-REGION|2603881..2604161|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV13-3*01|Bos taurus_Hereford|P|V-REGION|2802008..2802286|279 nt|1| | | | |279+0=279| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.41|TRAV13-3*02|Bos taurus_Hereford|P|V-REGION|93845..94122|278 nt|1| | | | |278+0=278| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.41|TRAV13-3*03|Bos taurus_Hereford|P|V-REGION|378701..378978|278 nt|1| | | | |278+0=278| | |\n",
      "No anchor is found for : IMGT000049|TRAV14-2*01|Bos taurus_Hereford|P|V-REGION|2633487..2633775|289 nt|1| | | | |289+0=289| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV18-3*01|Bos taurus_Hereford|P|V-REGION|2300155..2300431|277 nt|1| | | | |277+0=277| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.41|TRAV18-3*02|Bos taurus_Hereford|P|V-REGION|3270..3546|277 nt|1| | | | |277+0=277| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV19-4*01|Bos taurus_Hereford|P|V-REGION|2526744..2527030|287 nt|1| | | | |287+0=287| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.221|TRAV19-4*02|Bos taurus_Hereford|P|V-REGION|65294..65582|289 nt|1| | | | |289+0=289| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV2-3*01|Bos taurus_Hereford|P|V-REGION|123100..123361|262 nt|1| | | | |262+0=262| | |\n",
      "No anchor is found for : IMGT000049|TRAV2-4*01|Bos taurus_Hereford|P|V-REGION|142135..142396|262 nt|1| | | | |262+0=262| | |\n",
      "No anchor is found for : IMGT000049|TRAV20-2*01|Bos taurus_Hereford|P|V-REGION|280619..280878|260 nt|1| | | | |260+0=260| | |\n",
      "No anchor is found for : IMGT000049|TRAV21-2*01|Bos taurus_Hereford|P|V-REGION|288669..288966|298 nt|1| | | | |298+0=298| | |\n",
      "No anchor is found for : IMGT000049|TRAV22-12*01|Bos taurus_Hereford|P|V-REGION|2457609..2457852|244 nt|1| | | | |244+0=244| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV22-5*01|Bos taurus_Hereford|P|V-REGION|675468..675653|186 nt|1| | | | |186+0=186|partial in 3'| |\n",
      "No anchor is found for : Btau3.1_ChrUn.139|TRAV22-5*02|Bos taurus_Hereford|P|V-REGION|346703..346888|186 nt|1| | | | |186+0=186|partial in 3'| |\n",
      "No anchor is found for : IMGT000049|TRAV22-7*01|Bos taurus_Hereford|P|V-REGION|1914744..1915003|260 nt|1| | | | |260+0=260| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.2188|TRAV22-7*03|Bos taurus_Hereford|P|V-REGION|22719..22978|260 nt|1| | | | |260+0=260| | |\n",
      "No anchor is found for : IMGT000049|TRAV22-9*01|Bos taurus_Hereford|P|V-REGION|2241982..2242250|269 nt|1| | | | |269+0=269| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.129|TRAV22-9*02|Bos taurus_Hereford|P|V-REGION|438285..438553|269 nt|1| | | | |269+0=269| | |\n",
      "No anchor is found for : IMGT000049|TRAV23-10*01|Bos taurus_Hereford|P|V-REGION|2456414..2456692|279 nt|1| | | | |279+0=279| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.221|TRAV23-12*02|Bos taurus_Hereford|P|V-REGION|225516..225811|296 nt|1| | | | |296+0=296| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV23-4*01|Bos taurus_Hereford|P|V-REGION|720239..720415|177 nt|1| | | | |177+0=177|partial in 5'| |\n",
      "No anchor is found for : Btau3.1_ChrUn.41|TRAV23-4*02|Bos taurus_Hereford|P|V-REGION|625400..625576|177 nt|1| | | | |177+0=177|partial in 5'| |\n",
      "No anchor is found for : IMGT000049|TRAV23-5*01|Bos taurus_Hereford|P|V-REGION|1836109..1836387|279 nt|1| | | | |279+0=279| | |\n",
      "No anchor is found for : IMGT000049|TRAV23-6*01|Bos taurus_Hereford|P|V-REGION|2168058..2168368|311 nt|1| | | | |311+0=311| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.158|TRAV23-6*02|Bos taurus_Hereford|P|V-REGION|241843..242154|312 nt|1| | | | |312+0=312| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV23-7*01|Bos taurus_Hereford|P|V-REGION|2194938..2195212|275 nt|1| | | | |275+0=275| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.158|TRAV23-7*02|Bos taurus_Hereford|P|V-REGION|214632..214907|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV23-9*01|Bos taurus_Hereford|P|V-REGION|2435752..2436029|278 nt|1| | | | |278+0=278| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV24-3*01|Bos taurus_Hereford|P|V-REGION|2183107..2183984|878 nt|1| | | | |878+0=878| | |\n",
      "No anchor is found for : IMGT000049|TRAV24-5*01|Bos taurus_Hereford|P|V-REGION|2647702..2647969|268 nt|1| | | | |268+0=268| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.221|TRAV24-5*02|Bos taurus_Hereford|P|V-REGION|208286..208553|268 nt|1| | | | |268+0=268| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV25-14*01|Bos taurus_Hereford|ORF|V-REGION|2696621..2696893|273 nt|1| | | | |273+0=273| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV25-5*01|Bos taurus_Hereford|P|V-REGION|1874937..1875210|274 nt|1| | | | |274+0=274| | |\n",
      "No anchor is found for : IMGT000049|TRAV25-6*01|Bos taurus_Hereford|P|V-REGION|1936888..1937159|272 nt|1| | | | |272+0=272| | |\n",
      "No anchor is found for : IMGT000049|TRAV25-7*01|Bos taurus_Hereford|P|V-REGION|1945054..1945310|257 nt|1| | | | |257+0=257| | |\n",
      "No anchor is found for : IMGT000049|TRAV27*01|Bos taurus_Hereford|P|V-REGION|1978613..1978887|275 nt|1| | | | |275+0=275| | |\n",
      "No anchor is found for : IMGT000049|TRAV28-2*01|Bos taurus_Hereford|P|V-REGION|2041403..2041526|124 nt|1| | | | |124+0=124|partial in 5' and in 3' | |\n",
      "No anchor is found for : Btau3.1_Chr10.28|TRAV3-3*02|Bos taurus_Hereford|P|V-REGION|414689..414974|286 nt|1| | | | |286+0=286| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV33-1*01|Bos taurus_Hereford|P|V-REGION|2005056..2005332|277 nt|1| | | | |277+0=277| | |\n",
      "No anchor is found for : IMGT000049|TRAV33-2*01|Bos taurus_Hereford|P|V-REGION|2037680..2038853|1174 nt|1| | | | |1174+0=1174| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.158|TRAV33-2*02|Bos taurus_Hereford|P|V-REGION|358531..359707|1177 nt|1| | | | |1177+0=1177| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV33-3*01|Bos taurus_Hereford|P|V-REGION|2051964..2052250|287 nt|1| | | | |287+0=287| | |\n",
      "No anchor is found for : IMGT000049|TRAV34-1*01|Bos taurus_Hereford|P|V-REGION|2028117..2028388|272 nt|1| | | | |272+0=272| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.158|TRAV34-1*02|Bos taurus_Hereford|P|V-REGION|365986..366257|272 nt|1| | | | |272+0=272| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV34-2*01|Bos taurus_Hereford|P|V-REGION|2071698..2071972|275 nt|1| | | | |275+0=275| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.1948|TRAV34-2*02|Bos taurus_Hereford|P|V-REGION|23287..23561|275 nt|1| | | | |275+0=275| | |\n",
      "No anchor is found for : IMGT000049|TRAV36-1*01|Bos taurus_Hereford|P|V-REGION|2092810..2093077|268 nt|1| | | | |268+0=268| | |\n",
      "No anchor is found for : IMGT000049|TRAV37-1*01|Bos taurus_Hereford|P|V-REGION|2129053..2129315|263 nt|1| | | | |263+0=263| | |\n",
      "No anchor is found for : IMGT000049|TRAV37-2*01|Bos taurus_Hereford|P|V-REGION|2918170..2918432|263 nt|1| | | | |263+0=263| | |\n",
      "No anchor is found for : IMGT000049|TRAV40*01|Bos taurus_Hereford|P|V-REGION|2965379..2965524|146 nt|1| | | | |146+0=146|partial in 5'| |\n",
      "No anchor is found for : IMGT000049|TRAV44-11*01|Bos taurus_Hereford|P|V-REGION|2260764..2261044|281 nt|1| | | | |281+0=281| | |\n",
      "No anchor is found for : IMGT000049|TRAV44-13*01|Bos taurus_Hereford|P|V-REGION|2358128..2358403|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV44-14*01|Bos taurus_Hereford|P|V-REGION|2399872..2400147|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.41|TRAV44-14*02|Bos taurus_Hereford|P|V-REGION|290083..290358|276 nt|1| | | | |276+0=276| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.41|TRAV44-16*02|Bos taurus_Hereford|P|V-REGION|178524..178804|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV44-17*01|Bos taurus_Hereford|P|V-REGION|2487985..2488259|275 nt|1| | | | |275+0=275| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.221|TRAV44-17*02|Bos taurus_Hereford|P|V-REGION|20606..20880|275 nt|1| | | | |275+0=275| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV44-7*01|Bos taurus_Hereford|P|V-REGION|1846083..1846354|272 nt|1| | | | |272+0=272| | |\n",
      "No anchor is found for : IMGT000049|TRAV45-14*01|Bos taurus_Hereford|P|V-REGION|2740644..2740928|285 nt|1| | | | |285+0=285| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV46*01|Bos taurus_Hereford|P|V-REGION|3072223..3072489|267 nt|1| | | | |267+0=267| | |\n",
      "No anchor is found for : IMGT000049|TRAV8-2*01|Bos taurus_Hereford|P|V-REGION|434107..434386|280 nt|1| | | | |280+0=280| | |\n",
      "No anchor is found for : IMGT000049|TRAV8-3*01|Bos taurus_Hereford|P|V-REGION|1913794..1914074|281 nt|1| | | | |281+0=281| | |\n",
      "No anchor is found for : Btau3.1_ChrUn.1227|TRAV8-3*02|Bos taurus_Hereford|P|V-REGION|52291..52571|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "No anchor is found for : Btau3.1_ChrUn.2188|TRAV8-3*03|Bos taurus_Hereford|P|V-REGION|21770..22050|281 nt|1| | | | |281+0=281| | |\n",
      "No anchor is found for : IMGT000049|TRAV8-4*01|Bos taurus_Hereford|P|V-REGION|2318954..2319233|280 nt|1| | | | |280+0=280| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV8-5*01|Bos taurus_Hereford|P|V-REGION|2337684..2337964|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV9-2*01|Bos taurus_Hereford|P|V-REGION|2591374..2591653|280 nt|1| | | | |280+0=280| |rev-compl|\n",
      "No anchor is found for : IMGT000049|TRAV9-4*01|Bos taurus_Hereford|P|V-REGION|2789764..2790033|270 nt|1| | | | |270+0=270| |rev-compl|\n",
      "http://www.imgt.org/genedb/GENElect?query=8.1+TRAJ&species=Bos+taurus&IMGTlabel=J-PHE\n",
      "http://www.imgt.org/genedb/GENElect?query=8.1+TRAJ&species=Bos+taurus&IMGTlabel=J-TRP\n",
      "No anchor is found for : IMGT000049|TRAJ35*01|Bos taurus_Hereford|ORF|J-REGION|3275122..3275177|56 nt|2| | | | |56+0=56| | |\n",
      "http://www.imgt.org/genedb/GENElect?query=8.1+TRAV&species=Bos+taurus&IMGTlabel=2nd-CYS\n",
      "IMGT000049|TRAV10-1*01|Bos taurus_Hereford|P|V-REGION|491414..491602|189 nt|1| | | | |189+0=189|partial in 3'| |\n",
      "IMGT000049|TRAV11-3*01|Bos taurus_Hereford|P|V-REGION|2783132..2783410|279 nt|1| | | | |279+0=279| |rev-compl|\n",
      "IMGT000049|TRAV12-2*01|Bos taurus_Hereford|P|V-REGION|2571766..2572041|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "IMGT000049|TRAV13-2*01|Bos taurus_Hereford|P|V-REGION|2603881..2604161|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "IMGT000049|TRAV13-3*01|Bos taurus_Hereford|P|V-REGION|2802008..2802286|279 nt|1| | | | |279+0=279| |rev-compl|\n",
      "Btau3.1_ChrUn.41|TRAV13-3*02|Bos taurus_Hereford|P|V-REGION|93845..94122|278 nt|1| | | | |278+0=278| |rev-compl|\n",
      "Btau3.1_ChrUn.41|TRAV13-3*03|Bos taurus_Hereford|P|V-REGION|378701..378978|278 nt|1| | | | |278+0=278| | |\n",
      "IMGT000049|TRAV14-2*01|Bos taurus_Hereford|P|V-REGION|2633487..2633775|289 nt|1| | | | |289+0=289| |rev-compl|\n",
      "IMGT000049|TRAV18-3*01|Bos taurus_Hereford|P|V-REGION|2300155..2300431|277 nt|1| | | | |277+0=277| |rev-compl|\n",
      "Btau3.1_ChrUn.41|TRAV18-3*02|Bos taurus_Hereford|P|V-REGION|3270..3546|277 nt|1| | | | |277+0=277| |rev-compl|\n",
      "IMGT000049|TRAV19-4*01|Bos taurus_Hereford|P|V-REGION|2526744..2527030|287 nt|1| | | | |287+0=287| |rev-compl|\n",
      "Btau3.1_ChrUn.221|TRAV19-4*02|Bos taurus_Hereford|P|V-REGION|65294..65582|289 nt|1| | | | |289+0=289| |rev-compl|\n",
      "IMGT000049|TRAV2-3*01|Bos taurus_Hereford|P|V-REGION|123100..123361|262 nt|1| | | | |262+0=262| | |\n",
      "IMGT000049|TRAV2-4*01|Bos taurus_Hereford|P|V-REGION|142135..142396|262 nt|1| | | | |262+0=262| | |\n",
      "IMGT000049|TRAV20-2*01|Bos taurus_Hereford|P|V-REGION|280619..280878|260 nt|1| | | | |260+0=260| | |\n",
      "IMGT000049|TRAV21-2*01|Bos taurus_Hereford|P|V-REGION|288669..288966|298 nt|1| | | | |298+0=298| | |\n",
      "IMGT000049|TRAV22-12*01|Bos taurus_Hereford|P|V-REGION|2457609..2457852|244 nt|1| | | | |244+0=244| |rev-compl|\n",
      "IMGT000049|TRAV22-5*01|Bos taurus_Hereford|P|V-REGION|675468..675653|186 nt|1| | | | |186+0=186|partial in 3'| |\n",
      "Btau3.1_ChrUn.139|TRAV22-5*02|Bos taurus_Hereford|P|V-REGION|346703..346888|186 nt|1| | | | |186+0=186|partial in 3'| |\n",
      "IMGT000049|TRAV22-7*01|Bos taurus_Hereford|P|V-REGION|1914744..1915003|260 nt|1| | | | |260+0=260| | |\n",
      "Btau3.1_ChrUn.2188|TRAV22-7*03|Bos taurus_Hereford|P|V-REGION|22719..22978|260 nt|1| | | | |260+0=260| | |\n",
      "IMGT000049|TRAV22-9*01|Bos taurus_Hereford|P|V-REGION|2241982..2242250|269 nt|1| | | | |269+0=269| | |\n",
      "Btau3.1_ChrUn.129|TRAV22-9*02|Bos taurus_Hereford|P|V-REGION|438285..438553|269 nt|1| | | | |269+0=269| | |\n",
      "IMGT000049|TRAV23-10*01|Bos taurus_Hereford|P|V-REGION|2456414..2456692|279 nt|1| | | | |279+0=279| |rev-compl|\n",
      "Btau3.1_ChrUn.221|TRAV23-12*02|Bos taurus_Hereford|P|V-REGION|225516..225811|296 nt|1| | | | |296+0=296| |rev-compl|\n",
      "IMGT000049|TRAV23-4*01|Bos taurus_Hereford|P|V-REGION|720239..720415|177 nt|1| | | | |177+0=177|partial in 5'| |\n",
      "Btau3.1_ChrUn.41|TRAV23-4*02|Bos taurus_Hereford|P|V-REGION|625400..625576|177 nt|1| | | | |177+0=177|partial in 5'| |\n",
      "IMGT000049|TRAV23-5*01|Bos taurus_Hereford|P|V-REGION|1836109..1836387|279 nt|1| | | | |279+0=279| | |\n",
      "IMGT000049|TRAV23-6*01|Bos taurus_Hereford|P|V-REGION|2168058..2168368|311 nt|1| | | | |311+0=311| | |\n",
      "Btau3.1_ChrUn.158|TRAV23-6*02|Bos taurus_Hereford|P|V-REGION|241843..242154|312 nt|1| | | | |312+0=312| |rev-compl|\n",
      "IMGT000049|TRAV23-7*01|Bos taurus_Hereford|P|V-REGION|2194938..2195212|275 nt|1| | | | |275+0=275| | |\n",
      "Btau3.1_ChrUn.158|TRAV23-7*02|Bos taurus_Hereford|P|V-REGION|214632..214907|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "IMGT000049|TRAV23-9*01|Bos taurus_Hereford|P|V-REGION|2435752..2436029|278 nt|1| | | | |278+0=278| |rev-compl|\n",
      "IMGT000049|TRAV24-3*01|Bos taurus_Hereford|P|V-REGION|2183107..2183984|878 nt|1| | | | |878+0=878| | |\n",
      "IMGT000049|TRAV24-5*01|Bos taurus_Hereford|P|V-REGION|2647702..2647969|268 nt|1| | | | |268+0=268| |rev-compl|\n",
      "Btau3.1_ChrUn.221|TRAV24-5*02|Bos taurus_Hereford|P|V-REGION|208286..208553|268 nt|1| | | | |268+0=268| |rev-compl|\n",
      "IMGT000049|TRAV25-14*01|Bos taurus_Hereford|ORF|V-REGION|2696621..2696893|273 nt|1| | | | |273+0=273| |rev-compl|\n",
      "IMGT000049|TRAV25-5*01|Bos taurus_Hereford|P|V-REGION|1874937..1875210|274 nt|1| | | | |274+0=274| | |\n",
      "IMGT000049|TRAV25-6*01|Bos taurus_Hereford|P|V-REGION|1936888..1937159|272 nt|1| | | | |272+0=272| | |\n",
      "IMGT000049|TRAV25-7*01|Bos taurus_Hereford|P|V-REGION|1945054..1945310|257 nt|1| | | | |257+0=257| | |\n",
      "IMGT000049|TRAV27*01|Bos taurus_Hereford|P|V-REGION|1978613..1978887|275 nt|1| | | | |275+0=275| | |\n",
      "IMGT000049|TRAV28-2*01|Bos taurus_Hereford|P|V-REGION|2041403..2041526|124 nt|1| | | | |124+0=124|partial in 5' and in 3' | |\n",
      "Btau3.1_Chr10.28|TRAV3-3*02|Bos taurus_Hereford|P|V-REGION|414689..414974|286 nt|1| | | | |286+0=286| |rev-compl|\n",
      "IMGT000049|TRAV33-1*01|Bos taurus_Hereford|P|V-REGION|2005056..2005332|277 nt|1| | | | |277+0=277| | |\n",
      "IMGT000049|TRAV33-2*01|Bos taurus_Hereford|P|V-REGION|2037680..2038853|1174 nt|1| | | | |1174+0=1174| | |\n",
      "Btau3.1_ChrUn.158|TRAV33-2*02|Bos taurus_Hereford|P|V-REGION|358531..359707|1177 nt|1| | | | |1177+0=1177| |rev-compl|\n",
      "IMGT000049|TRAV33-3*01|Bos taurus_Hereford|P|V-REGION|2051964..2052250|287 nt|1| | | | |287+0=287| | |\n",
      "IMGT000049|TRAV34-1*01|Bos taurus_Hereford|P|V-REGION|2028117..2028388|272 nt|1| | | | |272+0=272| | |\n",
      "Btau3.1_ChrUn.158|TRAV34-1*02|Bos taurus_Hereford|P|V-REGION|365986..366257|272 nt|1| | | | |272+0=272| |rev-compl|\n",
      "IMGT000049|TRAV34-2*01|Bos taurus_Hereford|P|V-REGION|2071698..2071972|275 nt|1| | | | |275+0=275| | |\n",
      "Btau3.1_ChrUn.1948|TRAV34-2*02|Bos taurus_Hereford|P|V-REGION|23287..23561|275 nt|1| | | | |275+0=275| | |\n",
      "IMGT000049|TRAV36-1*01|Bos taurus_Hereford|P|V-REGION|2092810..2093077|268 nt|1| | | | |268+0=268| | |\n",
      "IMGT000049|TRAV37-1*01|Bos taurus_Hereford|P|V-REGION|2129053..2129315|263 nt|1| | | | |263+0=263| | |\n",
      "IMGT000049|TRAV37-2*01|Bos taurus_Hereford|P|V-REGION|2918170..2918432|263 nt|1| | | | |263+0=263| | |\n",
      "IMGT000049|TRAV40*01|Bos taurus_Hereford|P|V-REGION|2965379..2965524|146 nt|1| | | | |146+0=146|partial in 5'| |\n",
      "IMGT000049|TRAV44-11*01|Bos taurus_Hereford|P|V-REGION|2260764..2261044|281 nt|1| | | | |281+0=281| | |\n",
      "IMGT000049|TRAV44-13*01|Bos taurus_Hereford|P|V-REGION|2358128..2358403|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "IMGT000049|TRAV44-14*01|Bos taurus_Hereford|P|V-REGION|2399872..2400147|276 nt|1| | | | |276+0=276| |rev-compl|\n",
      "Btau3.1_ChrUn.41|TRAV44-14*02|Bos taurus_Hereford|P|V-REGION|290083..290358|276 nt|1| | | | |276+0=276| | |\n",
      "Btau3.1_ChrUn.41|TRAV44-16*02|Bos taurus_Hereford|P|V-REGION|178524..178804|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "IMGT000049|TRAV44-17*01|Bos taurus_Hereford|P|V-REGION|2487985..2488259|275 nt|1| | | | |275+0=275| |rev-compl|\n",
      "Btau3.1_ChrUn.221|TRAV44-17*02|Bos taurus_Hereford|P|V-REGION|20606..20880|275 nt|1| | | | |275+0=275| |rev-compl|\n",
      "IMGT000049|TRAV44-7*01|Bos taurus_Hereford|P|V-REGION|1846083..1846354|272 nt|1| | | | |272+0=272| | |\n",
      "IMGT000049|TRAV45-14*01|Bos taurus_Hereford|P|V-REGION|2740644..2740928|285 nt|1| | | | |285+0=285| |rev-compl|\n",
      "IMGT000049|TRAV46*01|Bos taurus_Hereford|P|V-REGION|3072223..3072489|267 nt|1| | | | |267+0=267| | |\n",
      "IMGT000049|TRAV8-2*01|Bos taurus_Hereford|P|V-REGION|434107..434386|280 nt|1| | | | |280+0=280| | |\n",
      "IMGT000049|TRAV8-3*01|Bos taurus_Hereford|P|V-REGION|1913794..1914074|281 nt|1| | | | |281+0=281| | |\n",
      "Btau3.1_ChrUn.1227|TRAV8-3*02|Bos taurus_Hereford|P|V-REGION|52291..52571|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "Btau3.1_ChrUn.2188|TRAV8-3*03|Bos taurus_Hereford|P|V-REGION|21770..22050|281 nt|1| | | | |281+0=281| | |\n",
      "IMGT000049|TRAV8-4*01|Bos taurus_Hereford|P|V-REGION|2318954..2319233|280 nt|1| | | | |280+0=280| |rev-compl|\n",
      "IMGT000049|TRAV8-5*01|Bos taurus_Hereford|P|V-REGION|2337684..2337964|281 nt|1| | | | |281+0=281| |rev-compl|\n",
      "IMGT000049|TRAV9-2*01|Bos taurus_Hereford|P|V-REGION|2591374..2591653|280 nt|1| | | | |280+0=280| |rev-compl|\n",
      "IMGT000049|TRAV9-4*01|Bos taurus_Hereford|P|V-REGION|2789764..2790033|270 nt|1| | | | |270+0=270| |rev-compl|\n",
      "http://www.imgt.org/genedb/GENElect?query=8.1+Bos+taurusJ&species=Bos+taurus&IMGTlabel=J-PHE\n",
      "http://www.imgt.org/genedb/GENElect?query=8.1+Bos+taurusJ&species=Bos+taurus&IMGTlabel=J-TRP\n",
      "IMGT000049|TRAJ1*01|Bos taurus_Hereford|F|J-REGION|3312811..3312872|62 nt|2| | | | |62+0=62| | |\n",
      "IMGT000049|TRAJ10*01|Bos taurus_Hereford|F|J-REGION|3300577..3300639|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ11*01|Bos taurus_Hereford|F|J-REGION|3299569..3299628|60 nt|3| | | | |60+0=60| | |\n",
      "AY227782|TRAJ11*02|Bos taurus|F|J-REGION|37141..37200|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ12*01|Bos taurus_Hereford|F|J-REGION|3299008..3299067|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ13*01|Bos taurus_Hereford|P|J-REGION|3298152..3298212|61 nt|1| | | | |61+0=61| | |\n",
      "Btau3.1_Chr10.30|TRAJ13*02|Bos taurus_Hereford|P|J-REGION|335316..335376|61 nt|1| | | | |61+0=61| |rev-compl|\n",
      "IMGT000049|TRAJ14*01|Bos taurus_Hereford|P|J-REGION|3297372..3297428|57 nt|3| | | | |57+0=57| | |\n",
      "AY227782|TRAJ14*02|Bos taurus|P|J-REGION|35008..35064|57 nt|3| | | | |57+0=57| | |\n",
      "IMGT000049|TRAJ15*01|Bos taurus_Hereford|F|J-REGION|3296477..3296536|60 nt|3| | | | |60+0=60| | |\n",
      "AJ245969|TRAJ15*02|Bos taurus|P|J-REGION|1449..1509|61 nt|3| | | | |61+0=61| | |\n",
      "IMGT000049|TRAJ16*01|Bos taurus_Hereford|F|J-REGION|3295381..3295441|61 nt|1| | | | |61+0=61| | |\n",
      "IMGT000049|TRAJ17*01|Bos taurus_Hereford|F|J-REGION|3293762..3293824|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ18*01|Bos taurus_Hereford|F|J-REGION|3292652..3292717|66 nt|3| | | | |66+0=66| | |\n",
      "IMGT000049|TRAJ19*01|Bos taurus_Hereford|P|J-REGION|3292268..3292325|58 nt|1| | | | |58+0=58| | |\n",
      "IMGT000049|TRAJ2*01|Bos taurus_Hereford|F|J-REGION|3311840..3311905|66 nt|3| | | | |66+0=66| | |\n",
      "IMGT000049|TRAJ20*01|Bos taurus_Hereford|F|J-REGION|3291299..3291356|58 nt|1| | | | |58+0=58| | |\n",
      "IMGT000049|TRAJ21*01|Bos taurus_Hereford|F|J-REGION|3290593..3290647|55 nt|1| | | | |55+0=55| | |\n",
      "IMGT000049|TRAJ22*01|Bos taurus_Hereford|F|J-REGION|3289061..3289123|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ23*01|Bos taurus_Hereford|F|J-REGION|3287942..3288004|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ24*01|Bos taurus_Hereford|F|J-REGION|3287501..3287563|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ25*01|Bos taurus_Hereford|F|J-REGION|3286649..3286708|60 nt|3| | | | |60+0=60| | |\n",
      "AY227782|TRAJ25*02|Bos taurus|F|J-REGION|24285..24344|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ26*01|Bos taurus_Hereford|ORF|J-REGION|3286351..3286410|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ27*01|Bos taurus_Hereford|F|J-REGION|3284184..3284242|59 nt|2| | | | |59+0=59| | |\n",
      "IMGT000049|TRAJ28*01|Bos taurus_Hereford|F|J-REGION|3283529..3283594|66 nt|3| | | | |66+0=66| | |\n",
      "IMGT000049|TRAJ29*01|Bos taurus_Hereford|F|J-REGION|3282544..3282603|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ3*01|Bos taurus_Hereford|F|J-REGION|3311301..3311359|59 nt|2| | | | |59+0=59| | |\n",
      "IMGT000049|TRAJ30*01|Bos taurus_Hereford|F|J-REGION|3281482..3281540|59 nt|2| | | | |59+0=59| | |\n",
      "IMGT000049|TRAJ31*01|Bos taurus_Hereford|F|J-REGION|3279389..3279446|58 nt|1| | | | |58+0=58| | |\n",
      "AY227782|TRAJ31*02|Bos taurus|F|J-REGION|17025..17082|58 nt|1| | | | |58+0=58| | |\n",
      "IMGT000049|TRAJ32*01|Bos taurus_Hereford|F|J-REGION|3277576..3277641|66 nt|3| | | | |66+0=66| | |\n",
      "IMGT000049|TRAJ33*01|Bos taurus_Hereford|F|J-REGION|3276841..3276897|57 nt|3| | | | |57+0=57| | |\n",
      "IMGT000049|TRAJ34*01|Bos taurus_Hereford|F|J-REGION|3276151..3276207|57 nt|3| | | | |57+0=57| | |\n",
      "IMGT000049|TRAJ35*01|Bos taurus_Hereford|ORF|J-REGION|3275122..3275177|56 nt|2| | | | |56+0=56| | |\n",
      "IMGT000049|TRAJ36*01|Bos taurus_Hereford|F|J-REGION|3273652..3273712|61 nt|1| | | | |61+0=61| | |\n",
      "IMGT000049|TRAJ37*01|Bos taurus_Hereford|F|J-REGION|3272939..3273000|62 nt|2| | | | |62+0=62| | |\n",
      "AY227782|TRAJ37*02|Bos taurus|F|J-REGION|10570..10631|62 nt|2| | | | |62+0=62| | |\n",
      "IMGT000049|TRAJ38*01|Bos taurus_Hereford|F|J-REGION|3271437..3271498|62 nt|2| | | | |62+0=62| | |\n",
      "IMGT000049|TRAJ39*01|Bos taurus_Hereford|F|J-REGION|3270797..3270859|63 nt|3| | | | |63+0=63| | |\n",
      "AY227782|TRAJ39*02|Bos taurus|F|J-REGION|8427..8489|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ4*01|Bos taurus_Hereford|F|J-REGION|3310327..3310389|63 nt|3| | | | |63+0=63| | |\n",
      "AY227782|TRAJ4*02|Bos taurus|P|J-REGION|47900..47961|62 nt|3| | | | |62+0=62| | |\n",
      "IMGT000049|TRAJ40*01|Bos taurus_Hereford|F|J-REGION|3268691..3268747|57 nt|3| | | | |57+0=57| | |\n",
      "IMGT000049|TRAJ41*01|Bos taurus_Hereford|F|J-REGION|3266989..3267049|61 nt|1| | | | |61+0=61| | |\n",
      "AY227782|TRAJ41*02|Bos taurus|F|J-REGION|4622..4682|61 nt|1| | | | |61+0=61| | |\n",
      "IMGT000049|TRAJ42*01|Bos taurus_Hereford|F|J-REGION|3266515..3266580|66 nt|3| | | | |66+0=66| | |\n",
      "IMGT000049|TRAJ43*01|Bos taurus_Hereford|F|J-REGION|3265736..3265792|57 nt|3| | | | |57+0=57| | |\n",
      "IMGT000049|TRAJ44*01|Bos taurus_Hereford|F|J-REGION|3264429..3264490|62 nt|2| | | | |62+0=62| | |\n",
      "IMGT000049|TRAJ45*01|Bos taurus_Hereford|F|J-REGION|3263583..3263645|63 nt|3| | | | |63+0=63| | |\n",
      "Btau3.1_Chr10.30|TRAJ45*02|Bos taurus_Hereford|F|J-REGION|369885..369947|63 nt|3| | | | |63+0=63| |rev-compl|\n",
      "IMGT000049|TRAJ46*01|Bos taurus_Hereford|F|J-REGION|3263071..3263133|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ47*01|Bos taurus_Hereford|F|J-REGION|3262333..3262389|57 nt|3| | | | |57+0=57| | |\n",
      "IMGT000049|TRAJ48*01|Bos taurus_Hereford|F|J-REGION|3260307..3260369|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ49*01|Bos taurus_Hereford|F|J-REGION|3259424..3259479|56 nt|2| | | | |56+0=56| | |\n",
      "IMGT000049|TRAJ5*01|Bos taurus_Hereford|F|J-REGION|3307141..3307200|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ50*01|Bos taurus_Hereford|F|J-REGION|3258537..3258592|56 nt|2| | | | |56+0=56| | |\n",
      "IMGT000049|TRAJ52*01|Bos taurus_Hereford|F|J-REGION|3256179..3256247|69 nt|3| | | | |69+0=69| | |\n",
      "IMGT000049|TRAJ53*01|Bos taurus_Hereford|F|J-REGION|3252969..3253034|66 nt|3| | | | |66+0=66| | |\n",
      "IMGT000049|TRAJ54*01|Bos taurus_Hereford|F|J-REGION|3252317..3252380|64 nt|1| | | | |64+0=64| | |\n",
      "IMGT000049|TRAJ56*01|Bos taurus_Hereford|F|J-REGION|3249567..3249624|58 nt|1| | | | |58+0=58| | |\n",
      "IMGT000049|TRAJ57*01|Bos taurus_Hereford|F|J-REGION|3248933..3248995|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ58*01|Bos taurus_Hereford|F|J-REGION|3247695..3247757|63 nt|3| | | | |63+0=63| | |\n",
      "IMGT000049|TRAJ59*01|Bos taurus_Hereford|F|J-REGION|3246539..3246592|54 nt|3| | | | |54+0=54| | |\n",
      "IMGT000049|TRAJ6*01|Bos taurus_Hereford|F|J-REGION|3305951..3306012|62 nt|2| | | | |62+0=62| | |\n",
      "IMGT000049|TRAJ60*01|Bos taurus_Hereford|F|J-REGION|3246302..3246358|57 nt|3| | | | |57+0=57| | |\n",
      "IMGT000049|TRAJ61*01|Bos taurus_Hereford|P|J-REGION|3245332..3245392|61 nt|1| | | | |61+0=61| | |\n",
      "IMGT000049|TRAJ7*01|Bos taurus_Hereford|F|J-REGION|3305376..3305431|56 nt|2| | | | |56+0=56| | |\n",
      "IMGT000049|TRAJ8-1*01|Bos taurus_Hereford|F|J-REGION|3303827..3303886|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ8-2*01|Bos taurus_Hereford|F|J-REGION|3301039..3301098|60 nt|3| | | | |60+0=60| | |\n",
      "AY227782|TRAJ8-2*02|Bos taurus|F|J-REGION|38611..38670|60 nt|3| | | | |60+0=60| | |\n",
      "IMGT000049|TRAJ9*01|Bos taurus_Hereford|F|J-REGION|3303237..3303297|61 nt|1| | | | |61+0=61| | |\n"
     ]
    }
   ],
   "source": [
    "import pygor3 as p3\n",
    "imgt_species = \"Bos+taurus\"\n",
    "imgt_chain = \"TRA\"\n",
    "p3.imgt.download_ref_genome_VDJ(imgt_species, imgt_chain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "tas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "models\tref_genome\n"
     ]
    }
   ],
   "source": [
    "# Now make a IGoR model\n",
    "model_dir_path = \"models/\"+imgt_species+\"/\"+imgt_chain\n",
    "path_ref_genome = model_dir_path+\"/ref_genome\"\n",
    "!ls {model_dir_path}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'igor_species': None,\n",
       " 'igor_chain': None,\n",
       " 'igor_model_dir_path': None,\n",
       " 'igor_path_ref_genome': '',\n",
       " 'fln_genomicVs': '',\n",
       " 'fln_genomicDs': '',\n",
       " 'fln_genomicJs': '',\n",
       " 'fln_V_gene_CDR3_anchors': '',\n",
       " 'igor_wd': '/home/alfaceor/Dropbox/PosDoc/IGoR/dev/MyGithub/pygor3/notebooks',\n",
       " 'igor_batchname': 'dataIGoRHZ1q17HCSQ',\n",
       " 'igor_model_parms_file': '',\n",
       " 'igor_model_marginals_file': '',\n",
       " 'igor_read_seqs': '',\n",
       " 'igor_threads': '',\n",
       " 'igor_fln_indexed_sequences': '',\n",
       " 'igor_fln_indexed_CDR3': '',\n",
       " 'igor_fln_align_V_alignments': '',\n",
       " 'igor_fln_align_J_alignments': '',\n",
       " 'igor_fln_align_D_alignments': '',\n",
       " 'igor_fln_infer_final_marginals': '',\n",
       " 'igor_fln_infer_final_parms': '',\n",
       " 'igor_fln_evaluate_final_marginals': '',\n",
       " 'igor_fln_evaluate_final_parms': '',\n",
       " 'igor_fln_output_pgen': '',\n",
       " 'igor_fln_output_scenarios': '',\n",
       " 'igor_fln_output_coverage': '',\n",
       " 'igor_fln_generated_realizations_werr': '',\n",
       " 'igor_fln_generated_seqs_werr': '',\n",
       " 'igor_fln_generation_info': '',\n",
       " 'igor_fln_db': '',\n",
       " 'b_read_seqs': False,\n",
       " 'b_align': False,\n",
       " 'b_infer': False,\n",
       " 'b_evaluate': False,\n",
       " 'b_generate': False}"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pygor3 as p3\n",
    "tasss = p3.IgorTask()\n",
    "tasss.to_dict()\n",
    "# tasss.genomes.df_genomicDs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "#tasss.make_default_VDJ()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loading default IGoR model from path :  /home/alfaceor/.local/share/igor/models/human/tcr_beta/\n",
      "Parms filename:  /home/alfaceor/.local/share/igor/models/human/tcr_beta/models/model_parms.txt\n",
      "Margs filename:  /home/alfaceor/.local/share/igor/models/human/tcr_beta/models/model_marginals.txt\n",
      "--------------------------------------------------\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'error_type': 'SingleErrorRate', 'error_values': '0.000396072'}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mdl_reference = p3.IgorModel.load_default(\"human\",\"tcr_beta\")\n",
    "mdl_reference.parms.ErrorRate_dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'event_type': 'GeneChoice',\n",
       " 'seq_type': 'V_gene',\n",
       " 'seq_side': 'Undefined_side',\n",
       " 'priority': 7,\n",
       " 'realizations': [],\n",
       " 'name': '',\n",
       " 'nickname': 'v_choice'}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# p3.IgorRec_Event_default_dict\n",
    "p3.IgorRec_Event_default_dict['v_choice']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "# TODO: ADD FILENAME AND DIRE\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exporting model parms in file  don.txt\n",
      "Exporting model marginals in file  don_ma.txt\n"
     ]
    }
   ],
   "source": [
    "# From this MDL CREATE A PARMS AND MARGINALS\n",
    "mdl.parms.write_model_parms('don.txt')\n",
    "mdl.marginals.write_model_marginals('don_ma.txt', mdl.parms)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Homo+sapiens TRAV http://www.imgt.org/genedb/GENElect?query=7.2+TRAV&species=Homo+sapiens\n",
      "http://www.imgt.org/genedb/GENElect?query=7.2+TRAV&species=Homo+sapiens\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'models/Homo+sapiens/TRA/ref_genome/genomicVs__imgt.fasta'"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p3.imgt.download_gene_template('Homo+sapiens', 'TRAV')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "genomicVs__imgt.fasta\n"
     ]
    }
   ],
   "source": [
    "!ls models/Homo+sapiens/TRA/ref_genome"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      ">AE000658|TRAV1-1*01|Homo sapiens|F|V-REGION|128090..128364|275 nt|1| | | | |275+0=275| | |\n",
      "GGACAAAGCCTTGAGCAGCCCTCTGAAGTGACAGCTGTGGAAGGAGCCATTGTCCAGATA\n",
      "AACTGCACGTACCAGACATCTGGGTTTTATGGGCTGTCCTGGTACCAGCAACATGATGGC\n",
      "GGAGCACCCACATTTCTTTCTTACAATGCTCTGGATGGTTTGGAGGAGACAGGTCGTTTT\n",
      "TCTTCATTCCTTAGTCGCTCTGATAGTTATGGTTACCTCCTTCTACAGGAGCTCCAGATG\n",
      "AAAGACTCTGCCTCTTACTTCTGCGCTGTGAGAGA\n",
      ">X04939|TRAV1-1*02|Homo sapiens|(F)|V-REGION|52..320|269 nt|1| | | | |269+0=269| | |\n",
      "GGACAAAGCCTTGAGCAGCCCTCTGAAGTGACAGCTGTGGAAGGAGCCATTGTCCAGATA\n",
      "AACTGCACGTACCAGACATCTGGGTTTTATGGGCTGTCCTGGTACCAGCAACATGATGGC\n",
      "GGAGCACCCACATTTCTTTCTTACAATGGTCTGGATGGTTTGGAGGAGACAGGTCGTTTT\n"
     ]
    }
   ],
   "source": [
    "!head models/Homo+sapiens/TRA/ref_genome/genomicVs__imgt.fasta\n"
   ]
  },
  {
   "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
