def test_modification(): st1 = Phosphorylation(Agent('BRAF'), Agent('MAP2K1'), 'S', '222') sa = SifAssembler([st1]) sa.make_model(True, True, True) assert len(sa.graph.nodes()) == 2 assert len(sa.graph.edges()) == 1 sa.save_model('test_sif.sif', True) with open('test_sif.sif', 'rb') as fh: txt = fh.read().decode('utf-8') assert txt == 'BRAF 0 MAP2K1\n', txt
bn_str = boolean2.modify_states(bn_str, turnon=on, turnoff=off) model = boolean2.Model(text=bn_str, mode='async') for i in range(nsim): model.initialize() model.iterate(steps=nsteps) coll.collect(states=model.states, nodes=model.nodes) avgs = coll.get_averages(normalize=True) return avgs if __name__ == '__main__': # Build Boolean net for basic pathway st = ac.load_statements('ras_pathway.pkl') sa = SifAssembler(st) sa.make_model(use_name_as_key=True) sa.save_model('ras_pathway.sif') bn_str = sa.print_boolean_net('ras_pathway_bn.txt') # Build Boolean net for extended pathway st_ext = ac.load_statements('ras_pathway_extension.pkl') sa = SifAssembler(st + st_ext) sa.make_model(use_name_as_key=True) sa.save_model('ras_pathway_extension.sif') bn_str = sa.print_boolean_net('ras_pathway_extension_bn.txt') # Condition 1 off = [] on = ['GROWTH-FACTOR'] avgs = get_sim_avgs(bn_str, off=off, on=on) jun_basic_noinh = avgs['JUN']
bn_str = boolean2.modify_states(bn_str, turnon=on, turnoff=off) model = boolean2.Model(text=bn_str, mode='async') for i in range(nsim): model.initialize() model.iterate(steps=nsteps) coll.collect(states=model.states, nodes=model.nodes) avgs = coll.get_averages(normalize=True) return avgs if __name__ == '__main__': # Build Boolean net for basic pathway st = ac.load_statements('ras_pathway.pkl') sa = SifAssembler(st) sa.make_model(use_name_as_key=True) sa.save_model('ras_pathway.sif') bn_str = sa.print_boolean_net('ras_pathway_bn.txt') # Build Boolean net for extended pathway st_ext = ac.load_statements('ras_pathway_extension.pkl') sa = SifAssembler(st + st_ext) sa.make_model(use_name_as_key=True) sa.save_model('ras_pathway_extension.sif') bn_str = sa.print_boolean_net('ras_pathway_extension_bn.txt') # Condition 1 off = [] on = ['GROWTH-FACTOR'] avgs = get_sim_avgs(bn_str, off=off, on=on) jun_basic_noinh = avgs['JUN']