예제 #1
0
 def _make_activity_graph(self):
     self.activity_graph = networkx.DiGraph()
     for a1, a2 in itertools.combinations(self.activity_types, 2):
         if bio_ontology.isa('INDRA_ACTIVITIES', a1, 'INDRA_ACTIVITIES',
                             a2):
             self.activity_graph.add_edge(a2, a1)
         if bio_ontology.isa('INDRA_ACTIVITIES', a2, 'INDRA_ACTIVITIES',
                             a1):
             self.activity_graph.add_edge(a1, a2)
예제 #2
0
 def isa_cmp(a, b):
     """Compare two entries based on isa relationships for sorting."""
     if not a.startswith('CHEBI:'):
         a = 'CHEBI:%s' % a
     if not b.startswith('CHEBI:'):
         b = 'CHEBI:%s' % b
     if bio_ontology.isa('CHEBI', a, 'CHEBI', b):
         return -1
     if bio_ontology.isa('CHEBI', b, 'CHEBI', a):
         return 1
     return 0
예제 #3
0
def test_erk_isa():
    assert bio_ontology.isa('HGNC', '6871', 'FPLX', 'MAPK')
    assert not bio_ontology.isa('HGNC', '6871', 'FPLX', 'JNK')
예제 #4
0
def test_isa_activity_not():
    assert not bio_ontology.isa('INDRA_ACTIVITIES', 'kinase',
                                'INDRA_ACTIVITIES', 'phosphatase')
예제 #5
0
def test_isa_entity():
    assert bio_ontology.isa('HGNC', '1097', 'FPLX', 'RAF')
예제 #6
0
def test_isa_mod_not():
    assert not bio_ontology.isa('INDRA_MODS', 'phosphorylation', 'INDRA_MODS',
                                'ubiquitination')
예제 #7
0
def test_isa_activity():
    assert bio_ontology.isa('INDRA_ACTIVITIES', 'kinase', 'INDRA_ACTIVITIES',
                            'activity')
예제 #8
0
def test_isa_mod():
    assert bio_ontology.isa('INDRA_MODS', 'phosphorylation', 'INDRA_MODS',
                            'modification')
예제 #9
0
def test_isa_entity3():
    assert not bio_ontology.isa('FPLX', 'RAF', 'HGNC', '1097')
예제 #10
0
def test_chebi_isa():
    assert bio_ontology.isa('CHEBI', 'CHEBI:87307', 'CHEBI', 'CHEBI:36962')
예제 #11
0
def test_isa_entity2():
    assert not bio_ontology.isa('HGNC', '1097', 'HGNC', '646')
예제 #12
0
def test_eccode_isa():
    parents = set(bio_ontology.get_parents('ECCODE', '1.1.1.1'))
    assert parents == {('ECCODE', '1.1.1'), ('ECCODE', '1.1'),
                       ('ECCODE', '1')}, parents
    assert bio_ontology.isa('ECCODE', '1.1.1.1', 'ECCODE', '1.1.1')