当前位置: 首页>>代码示例>>Python>>正文


Python PysbAssembler.save_model方法代码示例

本文整理汇总了Python中indra.assemblers.PysbAssembler.save_model方法的典型用法代码示例。如果您正苦于以下问题:Python PysbAssembler.save_model方法的具体用法?Python PysbAssembler.save_model怎么用?Python PysbAssembler.save_model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在indra.assemblers.PysbAssembler的用法示例。


在下文中一共展示了PysbAssembler.save_model方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: assemble_pysb

# 需要导入模块: from indra.assemblers import PysbAssembler [as 别名]
# 或者: from indra.assemblers.PysbAssembler import save_model [as 别名]
def assemble_pysb(stmts, data_genes, out_file):
    """Return an assembled PySB model."""
    stmts = ac.filter_direct(stmts)
    stmts = ac.filter_belief(stmts, 0.95)
    stmts = ac.filter_top_level(stmts)
    stmts = ac.filter_gene_list(stmts, data_genes, 'all')
    stmts = ac.reduce_activities(stmts)
    pa = PysbAssembler()
    pa.add_statements(stmts)
    model = pa.make_model()
    # Add observables
    o = Observable('MAPK1p', model.monomers['MAPK1'](T185='p', Y187='p'))
    model.add_component(o)
    o = Observable('MAPK3p', model.monomers['MAPK3'](T202='p', Y204='p'))
    model.add_component(o)
    o = Observable('GSK3Ap', model.monomers['GSK3A'](S21='p'))
    model.add_component(o)
    o = Observable('GSK3Bp', model.monomers['GSK3B'](S9='p'))
    model.add_component(o)
    o = Observable('RPS6p', model.monomers['RPS6'](S235='p'))
    model.add_component(o)
    o = Observable('EIF4EBP1p', model.monomers['EIF4EBP1'](S65='p'))
    model.add_component(o)
    o = Observable('JUNp', model.monomers['JUN'](S73='p'))
    model.add_component(o)
    o = Observable('FOXO3p', model.monomers['FOXO3'](S315='p'))
    model.add_component(o)
    o = Observable('AKT1p', model.monomers['AKT1'](S473='p'))
    model.add_component(o)
    o = Observable('AKT2p', model.monomers['AKT2'](S474='p'))
    model.add_component(o)
    o = Observable('AKT3p', model.monomers['AKT3'](S='p'))
    model.add_component(o)
    o = Observable('ELK1', model.monomers['ELK1'](S383='p'))
    model.add_component(o)
    # Set context
    pa.set_context('SKMEL28_SKIN')
    pa.save_model(out_file)

    ke = KappaExporter(model)
    with open('%s.ka' % base_file, 'wb') as fh:
        base_file, _ = os.path.splitext(out_file)
        fh.write(ke.export().encode('utf-8'))

    return model
开发者ID:jmuhlich,项目名称:indra,代码行数:47,代码来源:assemble_pysb.py

示例2: test_print_model

# 需要导入模块: from indra.assemblers import PysbAssembler [as 别名]
# 或者: from indra.assemblers.PysbAssembler import save_model [as 别名]
def test_print_model():
    st = Phosphorylation(Agent("MAP2K1"), Agent("MAPK3"))
    pa = PysbAssembler()
    pa.add_statements([st])
    pa.make_model()
    pa.save_model("/dev/null")
开发者ID:jmuhlich,项目名称:indra,代码行数:8,代码来源:test_pysb_assembler.py

示例3: assemble_model

# 需要导入模块: from indra.assemblers import PysbAssembler [as 别名]
# 或者: from indra.assemblers.PysbAssembler import save_model [as 别名]
def assemble_model(model_name, reread=False):
    xml_fname = model_name + '.xml'
    if not reread:
        print('Processing %s' % xml_fname)
        if os.path.exists(xml_fname):
            with open(xml_fname, 'rb') as fh:
                tp = trips.process_xml(fh.read())
        else:
            reread = True
    if reread:
        fname = model_name + '.txt'
        print('Reading %s' % fname)
        with open(fname, 'rb') as fh:
            tp = trips.process_text(fh.read(), xml_fname)

    print('Assembling statements:')
    for i, st in enumerate(tp.statements):
        print('%d: %s' % (i, st))
    print('----------------------')

    pa = PysbAssembler()
    pa.add_statements(tp.statements)
    model = pa.make_model()
    model.name = model_name

    p53 = model.monomers['TP53']
    obs = Observable(b'p53_active', p53(activity='active'))
    model.add_component(obs)
    if not model_name.endswith('var'):
        model.parameters['kf_aa_act_1'].value = 5e-06
    model.parameters['kf_pt_act_1'].value = 1e-05

    if model_name == 'p53_ATM':
        model.add_component(Parameter('ATMa_0', 1))
        atm = model.monomers['ATM']
        model.initial(atm(activity='active'),
                      model.parameters['ATMa_0'])
        model.parameters['kf_pa_act_1'].value = 1e-04
        obs = Observable(b'atm_active', atm(activity='active'))
        model.add_component(obs)

    if model_name == 'p53_ATR':
        model.add_component(Parameter('ATRa_0', 1))
        atr = model.monomers['ATR']
        model.initial(atr(activity='active'),
                      model.parameters['ATRa_0'])
        obs = Observable(b'atr_active', atr(activity='active'))
        model.add_component(obs)

    if model_name == 'p53_ATM_var':
        #model.add_component(Parameter('ATMa_0', 1))
        #atm = model.monomers['ATM']
        #model.initial(atm(activity='active'),
        #              model.parameters['ATMa_0'])
        model.add_component(Parameter('ATMa_0', 1))
        atm = model.monomers['ATM']
        model.initial(atm(phospho='p'),
                      model.parameters['ATMa_0'])
        model.parameters['kf_pa_dephosphorylation_1'].value = 1e-04
        model.parameters['MDM2_0'].value = 0
        model.parameters['kf_m_deg_1'].value = 8e-01
        model.parameters['kf_tm_synth_1'].value = 0.2
        model.parameters['kf_aa_phosphorylation_1'].value = 5e-06
        obs = Observable(b'atm_active', atm(phospho='p'))
        model.add_component(obs)

    pa.model = model
    pa.save_model('%s.py' % model_name)
    return model
开发者ID:jmuhlich,项目名称:indra,代码行数:71,代码来源:run_p53_model.py


注:本文中的indra.assemblers.PysbAssembler.save_model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。