Skip to content

Commit

Permalink
Show *escape_std* in PolyclonalCollection.mut_icXX_plot
Browse files Browse the repository at this point in the history
  • Loading branch information
jbloom committed Oct 17, 2023
1 parent 5f15365 commit 7b03efe
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 100 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The format is based on `Keep a Changelog <https://keepachangelog.com>`_.
6.8
---
- Add ``addtl_slider_stats_as_max`` to ``lineplot_and_heatmap``.
- Show *escape_std* in ``PolyclonalCollection.mut_escape_plot``.
- Show *escape_std* in ``PolyclonalCollection.mut_escape_plot`` and ``PolyclonalCollectios.mut_icXX_plot``

6.7
---
Expand Down
186 changes: 93 additions & 93 deletions notebooks/RBD_average.ipynb

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions polyclonal/polyclonal_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1108,6 +1108,7 @@ def mut_icXX_plot(
if "addtl_tooltip_stats" not in kwargs:
kwargs["addtl_tooltip_stats"] = []

std_col = f"{log_fold_change_icXX_col} std"
if per_model_tooltip:
df = self.mut_icXX_df_w_model_values(
x=x,
Expand All @@ -1133,8 +1134,8 @@ def mut_icXX_plot(
logbase=logbase,
check_wt_icXX=check_wt_icXX,
)
if "escape_std" not in kwargs["addtl_tooltip_stats"]:
kwargs["addtl_tooltip_stats"].append("escape_std")
if std_col not in kwargs["addtl_tooltip_stats"]:
kwargs["addtl_tooltip_stats"].append(std_col)
stat_cols = [log_fold_change_icXX_col]

kwargs["data_df"] = df.assign(epitope="all").rename(
Expand All @@ -1143,12 +1144,12 @@ def mut_icXX_plot(
for col in stat_cols:
kwargs["data_df"][col] = scale_stat_col * kwargs["data_df"][col]

if "addtl_slider_stats" not in kwargs:
kwargs["addtl_slider_stats"] = {}

if init_n_models is None:
init_n_models = int(math.ceil(len(self.models) / 2))
if "addtl_slider_stats" in kwargs:
kwargs["addtl_slider_stats"]["n_models"] = init_n_models
else:
kwargs["addtl_slider_stats"] = {"n_models": init_n_models}
kwargs["addtl_slider_stats"]["n_models"] = init_n_models

kwargs["data_df"] = polyclonal.Polyclonal._merge_df_to_merge(
kwargs["data_df"],
Expand All @@ -1167,6 +1168,11 @@ def mut_icXX_plot(
if "times_seen" not in kwargs["addtl_slider_stats"]:
kwargs["addtl_slider_stats"]["times_seen"] = 1

if std_col not in kwargs["addtl_slider_stats"]:
max_escape_std = kwargs["data_df"][std_col].max()
kwargs["addtl_slider_stats"][std_col] = max_escape_std
kwargs["addtl_slider_stats_as_max"].append(std_col)

if "heatmap_min_at_least" not in kwargs:
kwargs["heatmap_min_at_least"] = -2
if "heatmap_max_at_least" not in kwargs:
Expand Down

0 comments on commit 7b03efe

Please sign in to comment.