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

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)
@dkoslicki

Copy link
Copy Markdown
Member

Hi @SkyeAv, this got pushed to the back-burner due to no reviewers assigned. Is this still relevant and accurate? Also, for context, do such statistical significance qualifiers show up in the translator tier0 graph, or just the multiomics/pharmacophenomics/clinical trials/etc. KP? If such edges are not in tier0 KG, this code likely would never trigger/be used

@SkyeAv

SkyeAv commented Sep 3, 2026

Copy link
Copy Markdown
Author

@dkoslicki no CURRENT tier0 graph uses the qualifier. However, MultiomicsKG and the WellnessKG will be both ingested as a tier0 graph in the NEAR FUTURE and this PR was my attempt of preparing RTX for that. I'll add that Matt, Sierra, and I envision this qualifier becoming standard.

@dkoslicki

Copy link
Copy Markdown
Member

Gotcha, thanks for clarifying. I'm seeing that the CI/CD tests haven't been run on this PR (don't know why they didn't automatically trigger). Can you confirm that all the tests pass locally?

@dkoslicki

Copy link
Copy Markdown
Member

/deploy

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

❌ ARAX preview not deployed: fork PRs are not supported (CICD-Dockerfile clones by branch name from RTXteam/RTX)

@dkoslicki

Copy link
Copy Markdown
Member

@bazarkua any idea if we can get your fancy /deploy mechanism to work on fork PR (or how to convert this fork PR to a standard PR)?

@SkyeAv

SkyeAv commented Sep 3, 2026

Copy link
Copy Markdown
Author

@dkoslicki I'm confirming all tests were able to pass locally. I used databases I downloaded per the wiki with the help of Steve Ramsey and Frankie Hodges.

@bazarkua

bazarkua commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

I can change CICD-Dockerfile to fetch PR ref instead of a branch name and remove the fork refusal from deploy-preview.yml. The comment gate already limits /deploy to only members of RTXteam, outside people can not trigger it. We just need to be careful preview runs the fork code on cicd.rtx.ai, so we should /deploy a fork PR only after reading the diff.

@bazarkua

bazarkua commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

/deploy

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

ARAX preview

✅ deployed

URL: https://cicd.rtx.ai/2859/

Build: pull/2859/head @ c915b7d

Deploy: full rebuild (--force was given)

Smoke test

check result detail
container rtx_pr_2859 running pass up
GET /api/arax/v1.4/status pass HTTP 200
GET / serves the ARAX UI pass HTTP 200, body contains ARAX
GET /api/arax/v1.4/ui/ pass HTTP 200
GET /api/arax/v1.4/meta_knowledge_graph pass HTTP 200
[2026-09-08T00:08:04Z] wrote the status page /var/www/arax-preview/index.html
[2026-09-08T00:08:04Z] all smoke checks passed for PR 2859

Workflow run

Comment /deploy to rebuild from scratch, /redeploy to restart with the latest commit, /undeploy to remove. Previews are garbage-collected after 7 days or when the PR closes.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Preview pytest

Build: pull/2859/head @ c915b7d

Container: rtx_pr_2859

pytest: 160 passed, 0 failed, 146 skipped in 129.82s (0:02:09)
[2026-09-08T00:10:25Z] wrote the status page /var/www/arax-preview/index.html

Workflow run

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Preview live queries

Build: pull/2859/head @ c915b7d

Endpoint: https://cicd.rtx.ai/2859/api/arax/v1.4/query

# query HTTP s results KG nodes/edges status
Example 1 interacts_with (CHEBI:46195) 200 2.12 58 59/132 Success
Example 2 treats inferred (MONDO:0015564) 200 4.82 116 223/1525 Success
Example 3 affects qualified (NCBIGene:1576) 200 3.36 500 506/1690 Success
Pathfinder pathfinder (MONDO:0005011 to MONDO:0005180) 200 94.23 1 254/2401 Success
[2026-09-08T00:12:17Z] wrote the status page /var/www/arax-preview/index.html

Workflow run

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

3 participants