Closed Bernadetadad closed 1 year ago
@Bernadetadad, The issue is that you need to add the new key to the YAML dictionary, not overwrite it. This just has to do with how adding keys in YAML syntax via the merge operator works.
Consider this starting YAML file:
# overall default (contains some shared options)
overall_default: &overall_default
min_epitope_activity_to_include: 0.2
plot_kwargs:
avg_type: median
addtl_slider_stats:
times_seen: 3
functional effect: -4
slider_binding_range_kwargs:
n_models:
step: 1
times_seen:
step: 1
min: 1
max: 25
heatmap_max_at_least: 2
heatmap_min_at_least: -2
# default configuration for monoclonal antibodies (mAbs)
mAb_default: &mAb_default
<<: *overall_default
max_epitopes: 1
fit_kwargs:
reg_escape_weight: 0.1
reg_spread_weight: 0.25
reg_activity_weight: 1.0
The mAb_default
key is inheriting everything from overall_default
(that is what <<: *overall_default
means), and then it is adding to new keys for subdictionaries not defined in overall_default
(these are max_epitopes
and fit_kwargs
).
Now consider if you do the following:
# overall default (contains some shared options)
overall_default: &overall_default
min_epitope_activity_to_include: 0.2
plot_kwargs:
avg_type: median
addtl_slider_stats:
times_seen: 3
functional effect: -4
slider_binding_range_kwargs:
n_models:
step: 1
times_seen:
step: 1
min: 1
max: 25
heatmap_max_at_least: 2
heatmap_min_at_least: -2
# default configuration for monoclonal antibodies (mAbs)
mAb_default: &mAb_default
<<: *overall_default
plot_kwargs:
avg_type: min_magnitude
max_epitopes: 1
fit_kwargs:
reg_escape_weight: 0.1
reg_spread_weight: 0.25
reg_activity_weight: 1.0
What you may intend to do here is add a new values for the avg_type
key to the plot_kwargs
dictionary for mAb_default
. But instead you are totally re-defining the plot_kwargs
dictionary for mAb_default
to only be {"plot_kwargs": {"avg_type": "min_magnitude"}}
.
Instead what you need to do is this:
# default plot keyword arguments
default_plot_kwargs: &default_plot_kwargs
avg_type: median
addtl_slider_stats:
times_seen: 3
functional effect: -4
slider_binding_range_kwargs:
n_models:
step: 1
times_seen:
step: 1
min: 1
max: 25
heatmap_max_at_least: 2
heatmap_min_at_least: -2
# overall default (contains some shared options)
overall_default: &overall_default
min_epitope_activity_to_include: 0.2
plot_kwargs:
<<: *default_plot_kwargs
# default configuration for monoclonal antibodies (mAbs)
mAb_default: &mAb_default
<<: *overall_default
plot_kwargs:
<<: *default_plot_kwargs
avg_type: min_magnitude
max_epitopes: 1
fit_kwargs:
reg_escape_weight: 0.1
reg_spread_weight: 0.25
reg_activity_weight: 1.0
I know it gets a bit complicated in syntax, but this is the best possible with YAML
When
avg_type
is added topolyclonal_config.yaml
it overrides alladdtl_slider_stats
and resets everything to altair defaults.