Exemple #1
0
def test_model_undo():
    m = MRA()
    stmts1 = [sts.Phosphorylation(sts.Agent('A'), sts.Agent('B'))]
    m.new_model(stmts1)
    res = m.model_undo()
    action = res.get('action')
    assert action is not None
    assert action.get('action') == 'remove_stmts'
    assert action.get('statements') == stmts1
Exemple #2
0
def test_sbgn():
    m = MRA()
    ekb = ekb_from_text('KRAS activates BRAF.')
    res = m.build_model_from_ekb(ekb)
    ekb = ekb_from_text('NRAS activates BRAF.')
    res = m.expand_model_from_ekb(ekb, 1)
    sbgn = res['diagrams']['sbgn']
    tree = ET.fromstring(sbgn)
    glyphs = tree.findall('s:map/s:glyph',
                          namespaces={'s': 'http://sbgn.org/libsbgn/0.3'})
    assert len(glyphs) == 6
    res = m.model_undo()
    sbgn = res['diagrams']['sbgn']
    tree = ET.fromstring(sbgn)
    glyphs = tree.findall('s:map/s:glyph',
                          namespaces={'s': 'http://sbgn.org/libsbgn/0.3'})
    assert len(glyphs) == 4