Skip to content

Fix: Strip None values from orthology mapping API response#1207

Merged
adkinsrs merged 3 commits intoIGS:develfrom
Swargambharath987:fix/ortholog-mapping-strip-none
Apr 6, 2026
Merged

Fix: Strip None values from orthology mapping API response#1207
adkinsrs merged 3 commits intoIGS:develfrom
Swargambharath987:fix/ortholog-mapping-strip-none

Conversation

@Swargambharath987
Copy link
Copy Markdown
Contributor

Fixes
#1150

The list comprehensions in both the GET and POST handlers of the orthologs API could include None values when normalize_gene() fails to find a match, which gets serialized
as null in the JSON response. Updated both comprehensions to filter out None results using a walrus operator guard.

@jorvis jorvis requested a review from adkinsrs March 1, 2026 04:46
@adkinsrs
Copy link
Copy Markdown
Member

We need to ensure that if the resulting JSON is empty after all the None/nulls are removed, the UI handles that situation appropriately if it isn't already doing so. Still need to figure out the root cause as well as per ticket #1150

@Swargambharath987
Copy link
Copy Markdown
Contributor Author

Swargambharath987 commented Apr 2, 2026

Looked at the root cause: The None values come from comma-separated gs2 values in the orthology files — calm1a maps to "CALM1,CALM3,CALM2" stored as a single string. map_single_gene() was treating this as one gene name, which never matches anything in the dataset's gene map, causing the mapping to fail and return None. Fixed by splitting gs2 values by comma so each ortholog is returned as a separate gene symbol. Tested against a real local dataset : calm1a now correctly returns CALM1, CALM3, CALM2 and all three are found in the dataset. Single-mapping genes like "Actb" are unaffected.

@adkinsrs
Copy link
Copy Markdown
Member

adkinsrs commented Apr 2, 2026

Good catch there!

Can you also apply this to the map_multiple_genes function below the one you edited? Also I don't think the "strip" method is necessary... did you find any genes with whitespace or newline characters?

A good way to test this ortholog functionality on the UI is to perform a gene expression search for "calm1a" on the front page using the Hearing (default) profile, and see if some of the displays show a dropdown box in the upper-left to let you choose an ortholog. I'm attaching the inverse of this (searching "calm1" in zebrafish datasets, as "calm1a" is a zebrafish gene)

Screenshot 2026-04-02 at 9 12 16 AM

@Swargambharath987
Copy link
Copy Markdown
Contributor Author

Swargambharath987 commented Apr 2, 2026

Removed .strip() from map_single_gene() and applied the same comma-split fix to map_multiple_genes().

@adkinsrs adkinsrs merged commit bf3207d into IGS:devel Apr 6, 2026
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.

2 participants