예제 #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
예제 #2
0
def test_transformations():
    m = MRA()
    stmts1 = [sts.Phosphorylation(sts.Agent('A'), sts.Agent('B'))]
    m.new_model(stmts1)
    assert(len(m.transformations) == 1)
    tr = m.transformations[0]
    assert(tr[0] == 'add_stmts')
    assert(tr[1] == stmts1)
    assert(tr[2] is None)
    assert(tr[3] == 1)
    stmts2 = [sts.Phosphorylation(sts.Agent('C'), sts.Agent('D'))]
    m.extend_model(stmts2, 1)
    assert(len(m.transformations) == 2)
    tr = m.transformations[1]
    assert(tr[0] == 'add_stmts')
    assert(tr[1] == stmts2)
    assert(tr[2] == 1)
    assert(tr[3] == 2)
예제 #3
0
def test_get_upstream():
    m = MRA()
    egfr = sts.Agent('EGFR', db_refs={'HGNC': '3236', 'TEXT': 'EGFR'})
    kras = sts.Agent('KRAS', db_refs={'HGNC': '6407', 'TEXT': 'KRAS'})
    stmts = [sts.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')