def test_get_ontology(self): ontology_source = ols.get_ols_ontology('efo') self.assertIsInstance(ontology_source, OntologySource) self.assertEqual(ontology_source.name, 'efo') self.assertEqual(ontology_source.file, 'http://www.ebi.ac.uk/ols/api/ontologies/efo') self.assertIsInstance(ontology_source.version, str) self.assertEqual(ontology_source.description, 'Experimental Factor Ontology')
def test_search_for_term(self): ontology_source = ols.get_ols_ontology('efo') ontology_annotations = ols.search_ols('cell type', ontology_source) self.assertIsInstance(ontology_annotations, list) self.assertGreater(len(ontology_annotations), 0) ontology_anotations = [oa for oa in ontology_annotations if oa.term == 'cell type'] self.assertIsInstance(ontology_anotations[-1], OntologyAnnotation) self.assertEqual(ontology_anotations[-1].term, 'cell type') self.assertIn('http://www.ebi.ac.uk/efo/EFO_0000324', [oa.term_accession for oa in ontology_anotations]) self.assertEqual(ontology_anotations[-1].term_source, ontology_source)