diff --git a/tests/test_lexica.py b/tests/test_lexica.py index 85d4e85..0a7d1a2 100644 --- a/tests/test_lexica.py +++ b/tests/test_lexica.py @@ -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 @@ -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.""" @@ -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() + ) + )