{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1effe8f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import seaborn as sns\n",
    "from matplotlib import pyplot as plt\n",
    "import statistics\n",
    "plt.rc('figure', facecolor='w', figsize=[4,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "23a26787",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "sys.argv = [0,\"5\",\"6\",\"7\",\"8\"]\n",
    "import get_num_hits_per_read"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ed997797",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "dataleft = []\n",
    "dataright = []\n",
    "for k in get_num_hits_per_read.k_list:\n",
    "    x_ax_r, y_ax_r, x_ax_p, y_ax_p, first_non100, x_ax_n, y_ax_n = get_num_hits_per_read.obtain_stats_for_k(k)\n",
    "    for (xr, yr) in zip(x_ax_r, y_ax_r):\n",
    "        dataleft += [(k,xr,yr)]\n",
    "    for (xn, yn) in zip(x_ax_n, y_ax_n):\n",
    "        dataright += [(k,xn,yn)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "488b9766",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.DataFrame([x for x in dataleft],columns=(\"k\",\"xr\",\"yr\"))\n",
    "\n",
    "sns_plot = sns.lineplot(data=df,x=\"xr\",y=\"yr\",hue=\"k\")\n",
    "sns_plot.set(xlabel='Maximal pseudo-chain score per read', ylabel='Number of reads')\n",
    "fig = sns_plot.get_figure()\n",
    "plt.show()\n",
    "fig.savefig(\"pseudochain_left_panel.pdf\", bbox_inches='tight', dpi =300)\n",
    "\n",
    "\n",
    "df = pd.DataFrame([x for x in dataright],columns=(\"k\",\"xn\",\"yn\"))\n",
    "sns_plot = sns.lineplot(data=df,x=\"xn\",y=\"yn\",hue=\"k\")\n",
    "sns_plot.set(xlabel='Maximal pseudo-chain score per read', ylabel='% of correctly mapped reads')\n",
    "fig = sns_plot.get_figure()\n",
    "plt.show()\n",
    "fig.savefig(\"pseudochain_right_panel.pdf\", bbox_inches='tight', dpi =300)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
