Skip to content

feat: rank and filter logic for biolink:statistical_significance_qualifier - #2859

Open
SkyeAv wants to merge 3 commits into
RTXteam:masterfrom
SkyeAv:feat/implement-ranking-logic-for-the-statistical-significance-qualifier
Open

feat: rank and filter logic for biolink:statistical_significance_qualifier#2859
SkyeAv wants to merge 3 commits into
RTXteam:masterfrom
SkyeAv:feat/implement-ranking-logic-for-the-statistical-significance-qualifier

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Jul 28, 2026

Copy link
Copy Markdown

Adds ranking and KG-level filtering support for the biolink:statistical_significance_qualifier (biolink/biolink-model#1766), which categorizes an edge's evidence into coarse significance bands (very_strongly_significant through not_significant) as a companion to the authoritative numeric p value / adjusted p value slots. Closes #2858.

Design note: the statistical_significance_qualifier is is_a: statement_qualifier (a descendant of qualifier in biolink-model), so BMT routes it into edge.qualifiers[]. It is treated only as a qualifier here — never as an edge attribute. (See the decision documented in #2858.)

Ranker

  • Additive scoring signal: edge_attribute_score_combiner() in ARAX_ranker.py now injects a significance-band score into the existing loop algorithm (W_r = W_r + (1 - W_r) * W_i) alongside numeric p-value and other attributes — the qualifier can only boost, never penalize.
  • Conservative trust weight: Held in a standalone _significance_trust_weight constant at 0.5, with band scores ranging 0.00.70 (max effective contribution 0.35). TODO comment marks this for revisit once adoption is widespread.
  • Categorical bypass: Added _get_significance_qualifier_value(self: Self, edge: Edge) -> Optional[str] to look up the qualifier before the float() conversion in edge_attribute_score_normalizer() (which would otherwise ValueError on enum strings and silently return 0).
  • Qualifier-only lookup: Reads the value exclusively from edge.qualifiers (the TRAPI path for biolink qualifier descendants), stripping any biolink: prefix from the value.

KG Filter

  • New action: remove_edges_by_statistical_significance in ARAX_filter_kg.py + Filter_KG/remove_edges.py — an ordinal threshold filter, not exact-match. minimum_significance=significant removes suggestive and not_significant edges while keeping significant and above.
  • DSL: filter_kg(action=remove_edges_by_statistical_significance, minimum_significance=suggestive) removes only not_significant; supports remove_connected_nodes, qedge_keys, and qnode_keys.
  • Registered: Added to allowable_actions, command_definitions, and parameter descriptors matching the existing remove_edges_by_discrete_attribute pattern.

Design

  • Qualifier, not attribute. The qualifier is a biolink qualifier descendant, so BMT routes it into edge.qualifiers[]. It is read only from there — it is not registered as an edge attribute in the decorator and is not read from edge.attributes anywhere.
  • Edges without the qualifier are never penalized. The ranker only boosts positive bands; the filter only removes edges that explicitly carry a below-threshold value. This is intentional during rollout — penalizing would unfairly downrank sources that haven't adopted the qualifier yet.
  • Deferred: Result-level filtering (ARAX_filter.py) — edge-level KG filtering is the right granularity. Significance-aware pathfinding is a candidate for future work.

Testing

  • Unit verification of ARAX_ranker.py — score mapping, qualifier lookup (edge.qualifiers/prefixed), edge cases (multiple qualifiers, empty lists, unrecognized values), additive-with-pValue → all PASS
  • Unit verification of Filter_KG/remove_edges.py — ordinal removal, threshold boundaries (very_strongly_significant removes 4/5, not_significant removes 0/5), qualifier-less edges kept, command_definitions registration → all PASS
  • Slow integration tests (@pytest.mark.slow) included that query live infores:retriever end-to-end; these are forward-looking until BioPack-team/retriever#197 ships.

@SkyeAv
SkyeAv force-pushed the feat/implement-ranking-logic-for-the-statistical-significance-qualifier branch from 9e65dcb to 3da09b3 Compare July 28, 2026 20:52
SkyeAv added 3 commits July 29, 2026 15:18
…lter action

- Register significance band scores and trust weight in ARAX_ranker
- Add _get_significance_qualifier_value() to read from edge.qualifiers
- Integrate qualifier as additive signal in edge_attribute_score_combiner
- Add remove_edges_by_statistical_significance action to KG filter
- Implement ordinal threshold logic in Filter_KG/remove_edges.py
…lifier

- Score mapping, qualifier lookup, and edge-case tests for ranker
- Ordinal filter, threshold boundary, and registration tests for filter_kg
- Two @pytest.mark.slow integration tests (expand → filter/rank → resultify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement ranking and filtering logic for the new biolink:statistical_significance_qualifier

1 participant