Skip to content

Commit

Permalink
Update test_lexica.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Jan 31, 2024
1 parent d965793 commit 520638c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_lexica.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import biolexica
from biolexica.api import PREDEFINED
from biolexica.literature import annotate_abstracts_from_search

HERE = Path(__file__).parent.resolve()
ROOT = HERE.parent
Expand All @@ -22,7 +23,7 @@ def setUpClass(cls):
"""Set up the class with several grounders."""
cls.cell_grounder = biolexica.load_grounder(CELL_TERMS)
# cls.anatomy_grounder = biolexica.load_grounder(ANATOMY_TERMS)
# cls.phenotype_grounder = biolexica.load_grounder(PHENOTYPE_TERMS)
cls.phenotype_grounder = biolexica.load_grounder(PHENOTYPE_TERMS)

def test_predefined_list(self):
"""Check the predefined list is right."""
Expand All @@ -35,3 +36,16 @@ def test_ground_cells(self):
self.assertEqual(1, len(res))
self.assertEqual("cellosaurus", res[0].term.db)
self.assertEqual("0030", res[0].term.id)

def test_search_alz(self):
"""Test searching and annotating Alzheimer's docs gets a desired annotation."""
results = annotate_abstracts_from_search(
"alzheimers", grounder=self.phenotype_grounder, limit=20
)
self.assertTrue(
any(
ref.curie == "doid:10652" # this is the DOID term for Alzheimer's disease
for result in results
for ref, _name in result.count_references()
)
)

0 comments on commit 520638c

Please sign in to comment.