示例#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')