Skip to content

Fix broken constructor chain after #1195 refactor — aim_ids, gff_gene_type and related params no longer forwarded to subclasses #1209

@khushthecoder

Description

@khushthecoder

Description

PR #1195 (GH1194-species-config-refactor) refactored species-specific parameters to be read from the JSON config. However, as noted by @jonbrenas in their review comment, removing aim_ids, aim_palettes, gff_gene_type, gff_gene_name_attribute, gff_default_attributes, and gene_names from AnophelesDataResource.__init__() breaks the constructor chain — these parameters no longer reach AnophelesAimData or AnophelesGenomeFeaturesData.


Root Cause

The cooperative inheritance chain works like this:

Ag3.__init__() → AnophelesDataResource.__init__() → ... → AnophelesAimData.__init__()
                                                      → AnophelesGenomeFeaturesData.__init__()

Previously, ag3.py passed values like aim_ids=("gambcolu_vs_arab", "gamb_vs_colu") through AnophelesDataResource, which forwarded them via **kwargs to the subclasses.

After the refactor:

  1. These parameters were removed from AnophelesDataResource.__init__(), so they're no longer forwarded
  2. The JSON configs (v3-config.json, v1.0-config.json) do not contain AIM_IDS, AIM_PALETTES, GFF_GENE_TYPE, etc.
  3. Both the config lookup and constructor fallback return None

Impact

Species Parameter Effect
ag3 aim_ids resolves to None AIM calls (aim_variants(), aim_calls(), plot_aim_heatmap()) will fail
af1 gff_gene_type defaults to "gene" instead of "protein_coding_gene" Genome feature queries return wrong results
af1 gff_gene_name_attribute defaults to "Name" instead of "Note" Genome feature queries return wrong results
adar1, adir1, amin1 Same GFF params affected Same incorrect defaults applied

Proposed Fix

Re-add the 6 removed parameters to AnophelesDataResource.__init__() and restore the corresponding values in the species files (ag3.py, af1.py, adar1.py, adir1.py, amin1.py). The subclass constructors (AnophelesAimData, AnophelesGenomeFeaturesData) already implement config-first-then-constructor-fallback logic, so this restores backward compatibility without undoing the config refactoring work.

Note: Moving AIM_PALETTES to the JSON config is not straightforward because the palette colors are computed from plotly at runtime.


Related

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