Пример #1
0
def test_replace_agent_one():
    m = MRA()
    m.build_model_from_text('BRAF binds MEK1.')
    m.replace_agent('BRAF', ['RAF1'], 1)
    assert(len(m.statements) == 1)
    assert(len(m.statements[0]) == 1)
    assert((m.statements[0][0].members[0].name == 'RAF1') or\
            (m.statements[0][0].members[1].name == 'RAF1'))
Пример #2
0
def test_build_model_from_text():
    m = MRA()
    model = m.build_model_from_text('MEK1 phosphorylates ERK2.')
    assert (model is not None)
    assert (len(m.statements) == 1)
    assert (len(m.statements[0]) == 1)
    assert (isinstance(m.statements[0][0], indra.statements.Phosphorylation))
    assert (m.statements[0][0].enz.name == 'MAP2K1')
    assert (m.statements[0][0].sub.name == 'MAPK1')
Пример #3
0
def test_build_model_from_text():
    m = MRA()
    model = m.build_model_from_text('MEK1 phosphorylates ERK2.')
    assert(model is not None)
    assert(len(m.statements) == 1)
    assert(len(m.statements[0]) == 1)
    assert(isinstance(m.statements[0][0], indra.statements.Phosphorylation))
    assert(m.statements[0][0].enz.name == 'MAP2K1')
    assert(m.statements[0][0].sub.name == 'MAPK1')
Пример #4
0
def test_build_model_from_ekb():
    m = MRA()
    html = trips_client.send_query('MEK1 phosphorylates ERK2.')
    ekb_xml = trips_client.get_xml(html)
    model = m.build_model_from_ekb(ekb_xml)
    assert (model is not None)
    assert (len(m.statements[0]) == 1)
    assert (isinstance(m.statements[0][0], indra.statements.Phosphorylation))
    assert (m.statements[0][0].enz.name == 'MAP2K1')
    assert (m.statements[0][0].sub.name == 'MAPK1')
Пример #5
0
def test_build_model_from_ekb():
    m = MRA()
    html = trips_client.send_query('MEK1 phosphorylates ERK2.')
    ekb_xml = trips_client.get_xml(html)
    model = m.build_model_from_ekb(ekb_xml)
    assert(model is not None)
    assert(len(m.statements[0]) == 1)
    assert(isinstance(m.statements[0][0], indra.statements.Phosphorylation))
    assert(m.statements[0][0].enz.name == 'MAP2K1')
    assert(m.statements[0][0].sub.name == 'MAPK1')
Пример #6
0
def test_build_model_from_ekb():
    m = MRA()
    html = trips_client.send_query('MAP2K1 phosphorylates ERK2.')
    ekb_xml = trips_client.get_xml(html)
    res = m.build_model_from_ekb(ekb_xml)
    assert (res.get('model'))
    assert (res.get('model_id') == 1)
    assert (res.get('model_exec'))
    assert (len(m.models[1]) == 1)
    assert (isinstance(m.models[1][0], Phosphorylation))
    assert (m.models[1][0].enz.name == 'MAP2K1')
    assert (m.models[1][0].sub.name == 'MAPK1')
Пример #7
0
def test_get_upstream():
    m = MRA()
    egfr = Agent('EGFR', db_refs={'HGNC': '3236', 'TEXT': 'EGFR'})
    kras = Agent('KRAS', db_refs={'HGNC': '6407', 'TEXT': 'KRAS'})
    stmts = [Activation(egfr, kras)]
    model_id = m.new_model(stmts)
    upstream = m.get_upstream(kras, model_id)
    assert (len(upstream) == 1)
    assert (upstream[0].name == 'EGFR')
    mm = MRA_Module(testing=True)
    mm.mra = m
    kras_term = ekb_from_agent(kras)
    msg = KQMLList('MODEL-GET-UPSTREAM')
    msg.sets('target', kras_term)
    msg.set('model-id', str(model_id))
    print(msg)
    reply = mm.respond_model_get_upstream(msg)
    ups = reply.get('upstream')
    assert (len(ups) == 1)
    print(reply)
Пример #8
0
def test_replace_agent_one():
    m = MRA()
    m.build_model_from_text('BRAF binds MEK1.')
    m.replace_agent('BRAF', ['RAF1'], 1)
    assert (len(m.statements) == 1)
    assert (len(m.statements[0]) == 1)
    assert((m.statements[0][0].members[0].name == 'RAF1') or\
            (m.statements[0][0].members[1].name == 'RAF1'))
Пример #9
0
def test_has_mechanism():
    m = MRA()
    ekb = '<ekb><EVENT id="V33716"><type>ONT::BIND</type><arg1 id="V33712" role=":AGENT" /><arg2 id="V33734" role=":AFFECTED" /></EVENT><TERM id="V33712" dbid="HGNC:1097|NCIT:C51194|NCIT:C17476"><features></features><type>ONT::GENE-PROTEIN</type><name>BRAF</name></TERM><TERM id="V33734" dbid="NCIT:C52823|NCIT:C105947|NCIT:C17808|HGNC:6840|UP:Q91447|UP:Q05116"><features></features><type>ONT::GENE-PROTEIN</type><name>MEK-1</name></TERM></ekb>'
    m.build_model_from_ekb(ekb)
    has_mechanism = m.has_mechanism(ekb, 1)
    assert (has_mechanism)
Пример #10
0
def test_find_family_members_id():
    m = MRA()
    family_members = m.find_family_members('', family_id='FA:03114')
    assert (family_members is not None)
    assert (len(family_members) == 3)
    assert ('BRAF' in family_members)
Пример #11
0
def test_find_family_members_name():
    m = MRA()
    family_members = m.find_family_members('Raf')
    assert (family_members is not None)
    assert (len(family_members) == 3)
    assert ('BRAF' in family_members)
Пример #12
0
def test_has_mechanism():
    m = MRA()
    ekb = '<ekb><EVENT id="V33716"><type>ONT::BIND</type><arg1 id="V33712" role=":AGENT" /><arg2 id="V33734" role=":AFFECTED" /></EVENT><TERM id="V33712" dbid="HGNC:1097|NCIT:C51194|NCIT:C17476"><features></features><type>ONT::GENE-PROTEIN</type><name>BRAF</name></TERM><TERM id="V33734" dbid="NCIT:C52823|NCIT:C105947|NCIT:C17808|HGNC:6840|UP:Q91447|UP:Q05116"><features></features><type>ONT::GENE-PROTEIN</type><name>MEK-1</name></TERM></ekb>'
    m.build_model_from_ekb(ekb)
    has_mechanism = m.has_mechanism(ekb, 1)
    assert(has_mechanism)
Пример #13
0
def test_find_family_members_id():
    m = MRA()
    family_members = m.find_family_members('', family_id='FA:03114')
    assert(family_members is not None)
    assert(len(family_members) == 3)
    assert('BRAF' in family_members)
Пример #14
0
def test_find_family_members_name():
    m = MRA()
    family_members = m.find_family_members('Raf')
    assert(family_members is not None)
    assert(len(family_members) == 3)
    assert('BRAF' in family_members)