Skip to content

plot_haplotypes_frequencies.ipynb: ag3 used instead of af1 in Af1 section #1117

@star-lord1234

Description

@star-lord1234

Bug description:

In notebooks/plot_haplotypes_frequencies.ipynb, the Af1 section computes haplotype frequencies using af1, but the final plotting call is made on ag3.

hap_xr = af1.haplotypes_frequencies_advanced(
region="2RL:2,358,158-2,431,617",
area_by="admin1_iso",
period_by="year",
sample_sets=["1232-VO-KE-OCHOMO-VMF00044"],
min_cohort_size=10,
)

ag3.plot_frequencies_time_series(hap_xr)
Expected behaviour

The plotting call should use the same dataset instance (af1) that was used to compute the haplotypes:

af1.plot_frequencies_time_series(hap_xr)
Impact

After inspecting the implementation of plot_frequencies_time_series in
malariagen_data/anoph/frq_base.py, the current code still produces the correct output because the function operates entirely on the dataset argument (ds) and does not rely on instance-specific state.

However, the mismatch may still cause confusion because:

It appears inconsistent within an otherwise af1-only section of the notebook

Readers may assume the wrong API client is intended

It could lead to incorrect copy-paste usage in contexts where instance state does matter

Proposed fix

Change the final line of the Af1 section from:

ag3.plot_frequencies_time_series(hap_xr)

to:

af1.plot_frequencies_time_series(hap_xr)

Simple change that does not change behaiviour for user convenience

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions