Skip to content

Commit

Permalink
Merge pull request #110 from geneontology/issue-wc-ribbon-48
Browse files Browse the repository at this point in the history
fixes issue-wc-ribbon-48 - MGI results not showing up in ribbon when orthology is selected - Alliance
  • Loading branch information
sierra-moxon authored Nov 15, 2024
2 parents 0e6a79b + f35ae0e commit bb6d386
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/routers/ribbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@ async def get_ribbon_results(
),
):
"""Fetch the summary of annotations for a given gene or set of genes."""
mgied_subjects = []

for sub in subject:
if sub.startswith("MGI:"):
subject.remove(sub)
sub = "MGI:" + sub
subject.append(sub)
sub = sub.replace("MGI:", "MGI:MGI:") # Assign the result back to sub
mgied_subjects.append(sub)
else:
mgied_subjects.append(sub)

subject = mgied_subjects

# Step 1: create the categories
categories = ontology_utils.get_ontology_subsets_by_id(subset)
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/test_ribbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@ def test_rgd_ribbon(self):
self.assertTrue(subject.get("groups").get("GO:0005575").get("ALL").get("nb_annotations") >= 10)
self.assertTrue(response.status_code == 200)

def test_mgi_ortho_ribbon_calls(self):
"""Test MGI ortholog ribbon annotations."""
data = {"subset": "goslim_agr", "subject": ["MGI:88469","Xenbase:XB-GENE-994160",
"HGNC:2227","RGD:2378",
"ZFIN:ZDB-GENE-060606-1","FB:FBgn003185"],
"exclude_PB":"true",
"exclude_IBA":"false",
"cross_aspect":"false"
}
response = test_client.get("/api/ontology/ribbon/", params=data)
self.assertGreater(len(response.json().get("subjects")), 0)
self.assertIn("MGI:88469", [subject.get("id") for subject in response.json().get("subjects")])
self.assertEqual(response.status_code, 200)


def test_term_subsets_endpoint(self):
"""Test the endpoint to get the subsets of a Gene Ontology term by its identifier."""
for id in go_ids:
Expand Down

0 comments on commit bb6d386

Please sign in to comment.