Example #1
0
    def make_protein_complex_descendents_if_not_present(
            self, ontology: Optional[ontol.Ontology]) -> Set:
        if ontology is not None and self.protein_containing_complex_descendents is None:
            closure = gafparser.protein_complex_sublcass_closure(ontology)
            self.protein_containing_complex_descendents = closure

        return {} if self.protein_containing_complex_descendents is None else self.protein_containing_complex_descendents
Example #2
0
def test_gaf_2_1_creates_cell_component_closure():
    ontology = OntologyFactory().create("tests/resources/goslim_generic.json")
    closure = gafparser.protein_complex_sublcass_closure(ontology)
    # "GO:1902494" as an example that should be in the set
    assert "GO:0005840" in closure

    p = GafParser(config=assocparser.AssocParserConfig(ontology=ontology))
    with open("tests/resources/pombase_single.gaf") as gaf:
        # First line will be version declaration, triggering closure computation
        p.parse_line(gaf.readline())

    assert "GO:0005840" in p.cell_component_descendants_closure