Example #1
0
def make_ontology_with_annotation() -> pyhpo.ontology.OntologyClass:
    """
    Generates the following Ontology
    - HP:0001
        - HP:0011
            - HP:0021               <- Gene/Disease 0 / Negative Disease 2
                - HP:0031(*)
        - HP:0012                   <- Gene/Disease 1
            - HP:0031(*)
                - HP:0041
        - HP:0013

    """

    Gene.clear()
    Omim.clear()
    Orpha.clear()
    Decipher.clear()

    items = make_terms()

    terms = Ontology(from_obo_file=False)
    for item in items:
        terms._append(item)

    terms._connect_all()

    genes = make_genes(2)
    genes[0].hpo.add(21)
    genes[1].hpo.add(12)

    omim = make_omim(3)
    omim[0].hpo.add(21)
    omim[1].hpo.add(12)
    omim[2].negative_hpo.add(21)

    decipher = make_decipher(3)
    decipher[0].hpo.add(21)
    decipher[1].hpo.add(12)
    decipher[2].negative_hpo.add(21)

    orpha = make_orpha(3)
    orpha[0].hpo.add(21)
    orpha[1].hpo.add(12)
    orpha[2].negative_hpo.add(21)

    ds._add_omim_to_ontology(terms)
    ds._add_decipher_to_ontology(terms)
    ds._add_orpha_to_ontology(terms)
    _add_genes_to_ontology(terms)

    return terms
Example #2
0
    def test_indexing(self):
        def subindex_length(x):
            return (
                len(x.keys()),
                len(x._indicies.keys()),
            )

        self.assertEqual(subindex_length(Omim), (0, 0))
        _ = Omim(diseaseid=1, name='Gaucher')
        self.assertEqual(subindex_length(Omim), (1, 1))
        _ = Omim(diseaseid=2, name='Fabry')
        self.assertEqual(subindex_length(Omim), (2, 2))
        Omim.clear()
        self.assertEqual(subindex_length(Omim), (0, 0))
Example #3
0
def tearDown():
    Gene.clear()
    Omim.clear()
    Orpha.clear()
    Decipher.clear()
Example #4
0
def make_omim(n) -> List[pyhpo.annotations.DiseaseSingleton]:
    Omim.clear()
    return [Omim(diseaseid=i, name='Omim{}'.format(i)) for i in range(n)]
Example #5
0
 def setUp(self):
     Omim.clear()
     self.ontology = make_ontology()
     self.omim_diseases = make_omim(5)
Example #6
0
 def tearDown(self):
     Omim.clear()
Example #7
0
 def setUp(self):
     Omim.clear()