diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f5a42c1..311fd78 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_. +6.14 +---- +- Fix bug in ``plot.lineplot_and_heatmap`` where the ``minimum max of at site`` failed to keep only the top sites when the hide-not-filter option was being used. Addresses `this issue `_. + 6.13 ---- - Fixed ``altair`` plots to work with ``numpy`` version 2, which caused problems in some cases apparently due to a data type conversion issue. diff --git a/notebooks/real_LyCoV1404.ipynb b/notebooks/real_LyCoV1404.ipynb index 85c7767..4cf637b 100644 --- a/notebooks/real_LyCoV1404.ipynb +++ b/notebooks/real_LyCoV1404.ipynb @@ -18,11 +18,11 @@ "id": "0b46edd2", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:31:05.986024Z", - "iopub.status.busy": "2024-01-30T00:31:05.985362Z", - "iopub.status.idle": "2024-01-30T00:31:09.251302Z", - "shell.execute_reply": "2024-01-30T00:31:09.250503Z", - "shell.execute_reply.started": "2024-01-30T00:31:05.985984Z" + "iopub.execute_input": "2024-12-16T04:27:50.334279Z", + "iopub.status.busy": "2024-12-16T04:27:50.333736Z", + "iopub.status.idle": "2024-12-16T04:27:56.369117Z", + "shell.execute_reply": "2024-12-16T04:27:56.367516Z", + "shell.execute_reply.started": "2024-12-16T04:27:50.334233Z" }, "tags": [] }, @@ -53,11 +53,11 @@ "id": "46127941", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:31:09.252784Z", - "iopub.status.busy": "2024-01-30T00:31:09.252414Z", - "iopub.status.idle": "2024-01-30T00:31:10.120975Z", - "shell.execute_reply": "2024-01-30T00:31:10.120248Z", - "shell.execute_reply.started": "2024-01-30T00:31:09.252760Z" + "iopub.execute_input": "2024-12-16T04:27:56.374936Z", + "iopub.status.busy": "2024-12-16T04:27:56.374435Z", + "iopub.status.idle": "2024-12-16T04:27:57.364522Z", + "shell.execute_reply": "2024-12-16T04:27:57.363808Z", + "shell.execute_reply.started": "2024-12-16T04:27:56.374899Z" }, "tags": [] }, @@ -227,11 +227,11 @@ "id": "ad21ccc1", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:31:10.122151Z", - "iopub.status.busy": "2024-01-30T00:31:10.121916Z", - "iopub.status.idle": "2024-01-30T00:31:10.262787Z", - "shell.execute_reply": "2024-01-30T00:31:10.261975Z", - "shell.execute_reply.started": "2024-01-30T00:31:10.122129Z" + "iopub.execute_input": "2024-12-16T04:27:57.367631Z", + "iopub.status.busy": "2024-12-16T04:27:57.367415Z", + "iopub.status.idle": "2024-12-16T04:27:57.489342Z", + "shell.execute_reply": "2024-12-16T04:27:57.488661Z", + "shell.execute_reply.started": "2024-12-16T04:27:57.367607Z" }, "tags": [] }, @@ -356,11 +356,11 @@ "id": "2646efb0", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:31:10.265476Z", - "iopub.status.busy": "2024-01-30T00:31:10.265178Z", - "iopub.status.idle": "2024-01-30T00:31:10.764362Z", - "shell.execute_reply": "2024-01-30T00:31:10.763650Z", - "shell.execute_reply.started": "2024-01-30T00:31:10.265453Z" + "iopub.execute_input": "2024-12-16T04:27:57.492831Z", + "iopub.status.busy": "2024-12-16T04:27:57.492647Z", + "iopub.status.idle": "2024-12-16T04:27:57.936801Z", + "shell.execute_reply": "2024-12-16T04:27:57.936016Z", + "shell.execute_reply.started": "2024-12-16T04:27:57.492811Z" }, "tags": [] }, @@ -370,28 +370,29 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -519,11 +521,11 @@ "id": "9d265060", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:31:10.767460Z", - "iopub.status.busy": "2024-01-30T00:31:10.767287Z", - "iopub.status.idle": "2024-01-30T00:33:16.269066Z", - "shell.execute_reply": "2024-01-30T00:33:16.267817Z", - "shell.execute_reply.started": "2024-01-30T00:31:10.767441Z" + "iopub.execute_input": "2024-12-16T04:27:57.941086Z", + "iopub.status.busy": "2024-12-16T04:27:57.940808Z", + "iopub.status.idle": "2024-12-16T04:29:38.574578Z", + "shell.execute_reply": "2024-12-16T04:29:38.573392Z", + "shell.execute_reply.started": "2024-12-16T04:27:57.941055Z" }, "tags": [] }, @@ -534,28 +536,28 @@ "text": [ "#\n", "# Fitting site-level fixed Hill coefficient and non-neutralized frac model.\n", - "# Starting optimization of 1248 parameters at Mon Jan 29 16:31:23 2024.\n", + "# Starting optimization of 1248 parameters at Sun Dec 15 20:28:07 2024.\n", " step time_sec loss fit_loss reg_escape reg_spread reg_spatial reg_uniqueness reg_uniqueness2 reg_activity reg_hill_coefficient reg_non_neutralized_frac\n", - " 0 0.13355 37333 37314 0 0 0 0 0 18.641 0 0\n", - " 100 14.986 4910 4825 38.888 0 0 0 0 46.108 0 0\n", - " 177 26.404 4908.2 4822.5 39.589 0 0 0 0 46.145 0 0\n", - "# Successfully finished at Mon Jan 29 16:31:49 2024.\n", + " 0 0.12375 37333 37314 0 0 0 0 0 18.641 0 0\n", + " 100 14.227 4910.1 4825.1 38.855 0 0 0 0 46.105 0 0\n", + " 187 25.963 4908.2 4822.4 39.656 0 0 0 0 46.141 0 0\n", + "# Successfully finished at Sun Dec 15 20:28:33 2024.\n", "#\n", "# Fitting fixed Hill coefficient and non-neutralized frac model.\n", - "# Starting optimization of 8450 parameters at Mon Jan 29 16:31:50 2024.\n", + "# Starting optimization of 8450 parameters at Sun Dec 15 20:28:34 2024.\n", " step time_sec loss fit_loss reg_escape reg_spread reg_spatial reg_uniqueness reg_uniqueness2 reg_activity reg_hill_coefficient reg_non_neutralized_frac\n", - " 0 2.2456 7347.8 7034.8 266.82 3.6355e-31 0 0 0 46.145 0 0\n", - " 100 35.417 6864.9 6706.7 95.063 10.674 0 0 0 52.402 0 0\n", - " 200 65.438 6855.5 6701.8 89.625 11.611 0 0 0 52.473 0 0\n", - " 265 80.776 6854.7 6701.4 89.038 11.746 0 0 0 52.456 0 0\n", - "# Successfully finished at Mon Jan 29 16:33:11 2024.\n", + " 0 0.18938 7348.2 7035 267.1 2.6718e-31 0 0 0 46.141 0 0\n", + " 100 20.974 6863.7 6706.5 94.085 10.714 0 0 0 52.397 0 0\n", + " 200 42.6 6855.7 6702.1 89.569 11.63 0 0 0 52.447 0 0\n", + " 276 58.941 6854.6 6701.4 89.028 11.747 0 0 0 52.464 0 0\n", + "# Successfully finished at Sun Dec 15 20:29:33 2024.\n", "#\n", "# Fitting model.\n", - "# Starting optimization of 8452 parameters at Mon Jan 29 16:33:11 2024.\n", + "# Starting optimization of 8452 parameters at Sun Dec 15 20:29:33 2024.\n", " step time_sec loss fit_loss reg_escape reg_spread reg_spatial reg_uniqueness reg_uniqueness2 reg_activity reg_hill_coefficient reg_non_neutralized_frac\n", - " 0 0.23519 6812.7 6701.4 89.038 11.746 0 0 0 10.491 0 0\n", - " 19 5.2434 6750.3 6638.1 89.041 11.747 0 0 0 10.444 0.90715 0.076633\n", - "# Successfully finished at Mon Jan 29 16:33:16 2024.\n" + " 0 0.2008 6812.7 6701.4 89.028 11.747 0 0 0 10.493 0 0\n", + " 25 5.409 6749 6636.3 89.421 11.796 0 0 0 10.426 1.0524 0.079315\n", + "# Successfully finished at Sun Dec 15 20:29:38 2024.\n" ] } ], @@ -594,11 +596,11 @@ "id": "8e887519", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:16.271248Z", - "iopub.status.busy": "2024-01-30T00:33:16.270761Z", - "iopub.status.idle": "2024-01-30T00:33:16.291062Z", - "shell.execute_reply": "2024-01-30T00:33:16.290394Z", - "shell.execute_reply.started": "2024-01-30T00:33:16.271214Z" + "iopub.execute_input": "2024-12-16T04:29:38.578617Z", + "iopub.status.busy": "2024-12-16T04:29:38.578407Z", + "iopub.status.idle": "2024-12-16T04:29:38.600242Z", + "shell.execute_reply": "2024-12-16T04:29:38.599644Z", + "shell.execute_reply.started": "2024-12-16T04:29:38.578593Z" }, "tags": [] }, @@ -674,11 +676,11 @@ "id": "d7b168a4", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:16.292741Z", - "iopub.status.busy": "2024-01-30T00:33:16.292354Z", - "iopub.status.idle": "2024-01-30T00:33:16.296224Z", - "shell.execute_reply": "2024-01-30T00:33:16.295398Z", - "shell.execute_reply.started": "2024-01-30T00:33:16.292714Z" + "iopub.execute_input": "2024-12-16T04:29:38.605027Z", + "iopub.status.busy": "2024-12-16T04:29:38.604788Z", + "iopub.status.idle": "2024-12-16T04:29:38.609199Z", + "shell.execute_reply": "2024-12-16T04:29:38.608448Z", + "shell.execute_reply.started": "2024-12-16T04:29:38.605001Z" }, "tags": [] }, @@ -702,11 +704,11 @@ "id": "f7db9fc1-1a45-403e-b504-6cbc02f68af7", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:16.298068Z", - "iopub.status.busy": "2024-01-30T00:33:16.297723Z", - "iopub.status.idle": "2024-01-30T00:33:16.403470Z", - "shell.execute_reply": "2024-01-30T00:33:16.402824Z", - "shell.execute_reply.started": "2024-01-30T00:33:16.298042Z" + "iopub.execute_input": "2024-12-16T04:29:38.612785Z", + "iopub.status.busy": "2024-12-16T04:29:38.612279Z", + "iopub.status.idle": "2024-12-16T04:29:38.754789Z", + "shell.execute_reply": "2024-12-16T04:29:38.753789Z", + "shell.execute_reply.started": "2024-12-16T04:29:38.612753Z" }, "tags": [] }, @@ -818,11 +820,11 @@ "id": "1a9d6f5d", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:16.405062Z", - "iopub.status.busy": "2024-01-30T00:33:16.404719Z", - "iopub.status.idle": "2024-01-30T00:33:22.850549Z", - "shell.execute_reply": "2024-01-30T00:33:22.849370Z", - "shell.execute_reply.started": "2024-01-30T00:33:16.405039Z" + "iopub.execute_input": "2024-12-16T04:29:38.756022Z", + "iopub.status.busy": "2024-12-16T04:29:38.755646Z", + "iopub.status.idle": "2024-12-16T04:29:43.915549Z", + "shell.execute_reply": "2024-12-16T04:29:43.914490Z", + "shell.execute_reply.started": "2024-12-16T04:29:38.755996Z" }, "tags": [] }, @@ -832,28 +834,29 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -938,11 +942,11 @@ "id": "e06e0259-9ad4-4d3a-81bb-dbf38631d702", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:22.853070Z", - "iopub.status.busy": "2024-01-30T00:33:22.852479Z", - "iopub.status.idle": "2024-01-30T00:33:37.048502Z", - "shell.execute_reply": "2024-01-30T00:33:37.047681Z", - "shell.execute_reply.started": "2024-01-30T00:33:22.853022Z" + "iopub.execute_input": "2024-12-16T04:29:43.917080Z", + "iopub.status.busy": "2024-12-16T04:29:43.916824Z", + "iopub.status.idle": "2024-12-16T04:29:55.977861Z", + "shell.execute_reply": "2024-12-16T04:29:55.977214Z", + "shell.execute_reply.started": "2024-12-16T04:29:43.917056Z" }, "tags": [] }, @@ -952,28 +956,29 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -1053,11 +1059,11 @@ "id": "837eb0ea-e56e-4b5a-badd-94923ceca75d", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:37.049866Z", - "iopub.status.busy": "2024-01-30T00:33:37.049556Z", - "iopub.status.idle": "2024-01-30T00:33:40.016559Z", - "shell.execute_reply": "2024-01-30T00:33:40.015911Z", - "shell.execute_reply.started": "2024-01-30T00:33:37.049848Z" + "iopub.execute_input": "2024-12-16T04:29:55.979029Z", + "iopub.status.busy": "2024-12-16T04:29:55.978601Z", + "iopub.status.idle": "2024-12-16T04:29:57.156109Z", + "shell.execute_reply": "2024-12-16T04:29:57.155276Z", + "shell.execute_reply.started": "2024-12-16T04:29:55.979005Z" }, "tags": [] }, @@ -1067,28 +1073,29 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -1168,11 +1176,11 @@ "id": "f9d15bf6-c67b-46aa-9f69-96b97133e701", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:40.019810Z", - "iopub.status.busy": "2024-01-30T00:33:40.019413Z", - "iopub.status.idle": "2024-01-30T00:33:42.895588Z", - "shell.execute_reply": "2024-01-30T00:33:42.894880Z", - "shell.execute_reply.started": "2024-01-30T00:33:40.019785Z" + "iopub.execute_input": "2024-12-16T04:29:57.157139Z", + "iopub.status.busy": "2024-12-16T04:29:57.156916Z", + "iopub.status.idle": "2024-12-16T04:29:58.304802Z", + "shell.execute_reply": "2024-12-16T04:29:58.304107Z", + "shell.execute_reply.started": "2024-12-16T04:29:57.157116Z" }, "tags": [] }, @@ -1182,28 +1190,29 @@ "text/html": [ "\n", "\n", - "
\n", + "
\n", "" ], "text/plain": [ @@ -1283,11 +1293,11 @@ "id": "aeff75ca", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:42.896845Z", - "iopub.status.busy": "2024-01-30T00:33:42.896610Z", - "iopub.status.idle": "2024-01-30T00:33:43.017592Z", - "shell.execute_reply": "2024-01-30T00:33:43.016901Z", - "shell.execute_reply.started": "2024-01-30T00:33:42.896823Z" + "iopub.execute_input": "2024-12-16T04:29:58.306569Z", + "iopub.status.busy": "2024-12-16T04:29:58.306169Z", + "iopub.status.idle": "2024-12-16T04:29:58.405000Z", + "shell.execute_reply": "2024-12-16T04:29:58.404308Z", + "shell.execute_reply.started": "2024-12-16T04:29:58.306541Z" }, "tags": [] }, @@ -1321,7 +1331,7 @@ " \n", " 0\n", " 444\n", - " 6.7\n", + " 6.6\n", " \n", " \n", " 1\n", @@ -1340,7 +1350,7 @@ " \n", " \n", " 4\n", - " 443\n", + " 442\n", " 5.9\n", " \n", " \n", @@ -1349,11 +1359,11 @@ ], "text/plain": [ " site largest_mutation_escape_at_site\n", - "0 444 6.7\n", + "0 444 6.6\n", "1 447 6.3\n", "2 496 6.2\n", "3 441 6.1\n", - "4 443 5.9" + "4 442 5.9" ] }, "execution_count": 13, @@ -1383,11 +1393,11 @@ "id": "c05b9029-6c4b-4c14-88cd-ed997a32b84a", "metadata": { "execution": { - "iopub.execute_input": "2024-01-30T00:33:43.019148Z", - "iopub.status.busy": "2024-01-30T00:33:43.018903Z", - "iopub.status.idle": "2024-01-30T00:33:43.023519Z", - "shell.execute_reply": "2024-01-30T00:33:43.022539Z", - "shell.execute_reply.started": "2024-01-30T00:33:43.019126Z" + "iopub.execute_input": "2024-12-16T04:29:58.406158Z", + "iopub.status.busy": "2024-12-16T04:29:58.405915Z", + "iopub.status.idle": "2024-12-16T04:29:58.410033Z", + "shell.execute_reply": "2024-12-16T04:29:58.409366Z", + "shell.execute_reply.started": "2024-12-16T04:29:58.406133Z" }, "tags": [] }, @@ -1421,7 +1431,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.12.8" } }, "nbformat": 4, diff --git a/polyclonal/__init__.py b/polyclonal/__init__.py index 734610c..93bc1c7 100644 --- a/polyclonal/__init__.py +++ b/polyclonal/__init__.py @@ -31,7 +31,7 @@ __author__ = "`the Bloom lab `_" __email__ = "jbloom@fredhutch.org" -__version__ = "6.13" +__version__ = "6.14" __url__ = "https://github.com/jbloomlab/polyclonal" from polyclonal.alphabets import AAS diff --git a/polyclonal/plot.py b/polyclonal/plot.py index 4d4f829..31e4275 100644 --- a/polyclonal/plot.py +++ b/polyclonal/plot.py @@ -952,7 +952,11 @@ def replace_std(col): _stat_site_max="max(_stat_not_hidden)", groupby=["site"], ) - if slider_stat not in addtl_slider_stats_hide_not_filter: + base_chart = base_chart.transform_filter( + (alt.datum[slider_stat] >= (slider - 1e-6)) # round tol + | ~alt.expr.isFinite(alt.datum[slider_stat]) # do not filter null + ) + elif slider_stat not in addtl_slider_stats_hide_not_filter: if slider_stat in addtl_slider_stats_as_max: base_chart = base_chart.transform_filter( (alt.datum[slider_stat] <= (slider + 1e-6)) # round tol