Skip to content

Commit

Permalink
add per-variant stat
Browse files Browse the repository at this point in the history
  • Loading branch information
jykr committed Nov 25, 2023
1 parent e8632f7 commit 32cd6b7
Showing 1 changed file with 75 additions and 3 deletions.
78 changes: 75 additions & 3 deletions notebooks/sample_quality_report.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import perturb_tools as pt\n",
"import bean as be\n",
"from bean.qc.utils import fill_in_missing_samples\n",
"import matplotlib.pyplot as plt\n",
"plt.style.use('default')"
"\n",
"plt.style.use(\"default\")"
]
},
{
Expand Down Expand Up @@ -282,6 +284,46 @@
" editable_base_end=edit_quantification_end_pos\n",
" )\n",
" be.qc.plot_sample_edit_rates(bdata)"
<<<<<<< Updated upstream
=======
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5. Variant coverage"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if not tiling:\n",
" n_guides = bdata.guides.groupby(\"target\").size()\n",
" int_bins = np.arange(min(0.5, n_guides.min() - 0.5), n_guides.max() + 0.5, 1)\n",
" plt.hist(n_guides, bins=int_bins)\n",
" plt.xticks(np.arange(n_guides.min() - 1, n_guides.max() + 1, 1))\n",
" plt.title(\"# Guides per target\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if \"target_base_change\" not in bdata.uns or not base_edit_data:\n",
" print(\n",
" \"Not a base editing data or target base change not provided. Passing editing-related QC\"\n",
" )\n",
"elif tiling:\n",
" total_edits = bdata.guides.groupby(\"target\")[\"edit_rate\"].sum()\n",
" plt.hist(n_guides)\n",
" plt.title(\"Total edit rates per target\")"
>>>>>>> Stashed changes
]
},
{
Expand Down Expand Up @@ -348,12 +390,42 @@
"bdata_filtered.samples.style.background_gradient(cmap=\"coolwarm_r\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5. Variant coverage"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"if not tiling:\n",
" n_guides = bdata.guides.groupby(\"target\").size()\n",
" int_bins = np.arange(min(0.5, n_guides.min() - 0.5), n_guides.max() + 0.5, 1)\n",
" plt.hist(n_guides, bins=int_bins)\n",
" plt.xticks(np.arange(n_guides.min() - 1, n_guides.max() + 1, 1))\n",
" plt.title(\"# Guides per target\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if \"target_base_change\" not in bdata.uns or not base_edit_data:\n",
" print(\n",
" \"Not a base editing data or target base change not provided. Passing editing-related QC\"\n",
" )\n",
"elif not tiling:\n",
" total_edits = bdata.guides.groupby(\"target\")[\"edit_rate\"].sum()\n",
" plt.hist(n_guides)\n",
" plt.title(\"Total edit rates per target\")"
]
},
{
"cell_type": "markdown",
Expand Down

0 comments on commit 32cd6b7

Please sign in to comment.