Skip to content

Commit

Permalink
Add option lineplot_antibody_label_loc ("right" or "top") for label…
Browse files Browse the repository at this point in the history
…s on antibody-escape lineplots ((see [this issue](dms-vep/Flu_H5_American-Wigeon_South-Carolina_2021-H5N1_DMS#136)).
  • Loading branch information
jbloom committed Dec 20, 2024
1 parent 0d4241d commit a3f0894
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### version 3.20.0
- Add option `no_mean_lineplot` to summaries to not show antibody-escape mean lineplot (see [this issue](https://github.com/dms-vep/Flu_H5_American-Wigeon_South-Carolina_2021-H5N1_DMS/issues/136)).
- Add option `lineplot_antibody_label_loc` ("right" or "top") for labels on antibody-escape lineplots ((see [this issue](https://github.com/dms-vep/Flu_H5_American-Wigeon_South-Carolina_2021-H5N1_DMS/issues/136)).

#### version 3.19.3
- Fix bug in `func_effect_diffs` tooltips introduced in 3.19.2.
Expand Down
21 changes: 14 additions & 7 deletions notebooks/summary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
"min_frac_models = config[\"min_frac_models\"]\n",
"alphabet = polyclonal.alphabets.biochem_order_aas(config[\"alphabet\"])\n",
"\n",
"lineplot_antibody_label_loc = (\n",
" config[\"lineplot_antibody_label_loc\"]\n",
" if \"lineplot_antibody_label_loc\" in config\n",
" else \"right\"\n",
")\n",
"assert lineplot_antibody_label_loc in {\"right\", \"top\"}, lineplot_antibody_label_loc\n",
"\n",
"print(f\"Using {min_times_seen=} and {min_frac_models=}\")"
]
},
Expand Down Expand Up @@ -697,7 +704,7 @@
" )\n",
" )\n",
"\n",
" if len(antibody_set) < 14:\n",
" if (len(antibody_set) < 14) or (lineplot_antibody_label_loc == \"top\"):\n",
" individual_title = f\"individual {antibody_set}\"\n",
" mean_title = f\"mean {antibody_set}\"\n",
" else:\n",
Expand All @@ -721,16 +728,16 @@
" \"antibody:N\",\n",
" title=individual_title,\n",
" header=alt.Header(\n",
" labelOrient=\"right\",\n",
" labelOrient=lineplot_antibody_label_loc,\n",
" labelFontSize=10,\n",
" labelPadding=3,\n",
" titleOrient=\"right\",\n",
" titleOrient=lineplot_antibody_label_loc,\n",
" titlePadding=3,\n",
" ),\n",
" sort=antibodies,\n",
" ),\n",
" columns=1,\n",
" spacing=0,\n",
" spacing=3 * (lineplot_antibody_label_loc != \"right\"),\n",
" )\n",
" .resolve_scale(y=\"independent\")\n",
" )\n",
Expand All @@ -751,7 +758,7 @@
" individual_title,\n",
" fontSize=11,\n",
" fontWeight=\"bold\",\n",
" orient=\"right\",\n",
" orient=lineplot_antibody_label_loc,\n",
" ),\n",
" )\n",
"\n",
Expand Down Expand Up @@ -782,7 +789,7 @@
" mean_title,\n",
" fontSize=11,\n",
" fontWeight=\"bold\",\n",
" orient=\"right\",\n",
" orient=lineplot_antibody_label_loc,\n",
" ),\n",
" )\n",
" )\n",
Expand Down Expand Up @@ -815,7 +822,7 @@
" )\n",
" ]\n",
" ),\n",
" spacing=0,\n",
" spacing=4 * (lineplot_antibody_label_loc != \"right\"),\n",
" ).add_params(\n",
" site_escape_selection,\n",
" site_selection,\n",
Expand Down
2 changes: 2 additions & 0 deletions test_example/data/summaries_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ summary_of_all_phenotypes:
alphabet: [A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S, T, V, W, Y, -] # amino acids to include
init_floor_escape_at_zero: true # initially floor site escape to be >= 0?
init_site_escape_stat: mean # initially show site escape as this statistic
lineplot_antibody_label_loc: right # can be right or top
antibody_escape: # show effects on antibody escape, empty dict if no antibodies being shown
monoclonal antibodies: # name each set of antibodies
stat: escape_median # columin in CSV with value
Expand Down Expand Up @@ -65,6 +66,7 @@ summary_of_just_antibodies:
alphabet: [A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S, T, V, W, Y, -] # amino acids to include
init_floor_escape_at_zero: true # initially floor site escape to be >= 0?
init_site_escape_stat: mean # initially show site escape as this statistic
lineplot_antibody_label_loc: top # can be right or top
antibody_escape: # show effects on antibody escape, empty dict if no antibodies being shown
monoclonal antibodies: # name each set of antibodies
stat: escape_median # columin in CSV with value
Expand Down

0 comments on commit a3f0894

Please sign in to comment.