def run_b(config=None, force=False): "모델의 베이신크기를 계산." outputfile = config['output']['b'] if exists(outputfile) and force == False: return data = tab_s7.load_a() model = "\n".join(data['equation'].values.tolist()) samples = config['parameters']['samples'] steps = config['parameters']['steps'] on_states = config['parameters']['on_states'] off_states = config['parameters']['off_states'] attr_cy.build(model, on_states=on_states, off_states=off_states) result_data = attr_cy.run(samples=samples, steps=steps, debug=True) # on_states=[], off_states=[] json.dump(result_data, open(outputfile, 'w'), indent=4)
def test_this_1(): modeltext = ''' A= Random B= Random C= Random A*= A or C B*= A and C C*= not A or B ''' # if not exists('engine.pyx'): attr_cy.build(modeltext) import pyximport pyximport.install() res = attr_cy.run(samples=1000000, steps=50, debug=False, on_states=['A'], \ progress=True) json.dump(res, open('test_attr_cy.json', 'w'), indent=4)
def test_hello(with_small, force): if not exists('fumia_engine.pyx'): attr_cy.build(preproc_model_file(datast_fumia), pyx='fumia_engine.pyx', weighted_sum=False) import pyximport pyximport.install() import fumia_engine res = attr_cy.parallel(fumia_engine, steps=80, samples=100, ncpus=100, repeats=1000, on_states=[], off_states=[]) with open(output_attr, 'w') as f: json.dump(res, f, indent=4)
'b2-simul-result-table-summary.csv') with open(file_a2, 'r') as fobj: lines = fobj.readlines() lines2 = [] for lin in lines: lin = lin.strip() if lin[0] == '#': continue right = lin.split('=')[1].strip() if right == 'input': lines2.append( lin.split('=')[0].strip() + '=' + 'False') else: lines2.append(lin) modeltext = "\n".join(lines2) attr_cy.build(modeltext, pyx='engine.pyx', weighted_sum=True) import pyximport; pyximport.install() template = { 'State_Mutagen' : False, 'State_GFs': False, 'State_Nutrients': False, 'State_TNFalpha': False, 'State_Hypoxia': False, 'State_Gli': False, }
# with open(file_a2, 'r') as fobj: # lines = fobj.readlines() # lines2 = [] # for lin in lines: # lin = lin.strip() # if lin[0] == '#': # continue # right = lin.split('=')[1].strip() # if right == 'input': # lines2.append( lin.split('=')[0].strip() + '=' + 'False') # else: # lines2.append(lin) # modeltext = "\n".join(lines2) from sbie_optdrug2.results import fumia attr_cy.build(fumia.modeltext(), pyx='engine.pyx', weighted_sum=False) import pyximport pyximport.install() inplabels = [ 'State_Mutagen', 'State_GFs', 'State_Nutrients', 'State_TNFalpha', 'State_Hypoxia' ] mutlabels = ['State_APC', 'State_Ras', 'State_Smad', 'State_PTEN', 'State_p53'] chk_fumia_simul = 'chk-fumia-simul.json'
dataset_ccle_dose_resp = join(basedir, '../table_s2/download/CCLE_NP24.2009_Drug_data_2015.02.24.csv') # CRC subset of CCLE dataset_ccle_crc_info = join(basedir, '../table_s3/dataset-ccle_crc_info.csv') chk_drug_model_target_dict = join(basedir, '../table_s3/chk-drug-modeltarget.json') msigdb = dataset_msigdb.load_msigdb() if not exists('fumia_engine.pyx'): attr_cy.build(model_fumia2013.modeltext(), pyx='fumia_engine.pyx', weighted_sum=True ) import pyximport; pyximport.install() max_num_drugs = 2; samples = 10 with open('dataset-goterms-in-apq.json', 'r') as f: goterms_in_apq = json.load(f) def genesymdict():
# from termutil import progressbar from os import system from os.path import dirname, join, exists from boolean3_addon import attr_cy import numpy as np from sbie_optdrug.result import tab_s3 from sbie_optdrug.result import tab_s7 from boolean3 import Model from boolean3_addon import attractor import pandas as pd if not exists('engine.pyx'): data = tab_s7.load_a() model = "\n".join(data['equation'].values.tolist()) attr_cy.build(model) import pyximport pyximport.install() import engine def getconfig(): "return config object" return tab_s7.config def run_a(config=None, force=False): "푸미아네트워크 이큐에이션을 준비한다." if exists(config['output']['a']) and force == False: return
PPP2CA*= p38 Proliferation*= p70 and MYC and not p21 PTEN*= p53 RAF*= (RAS or PKC) and not (ERK or AKT) RAS*= SOS or PLCG RSK*= ERK SMAD*= TGFBR SOS*= GRB2 and not RSK SPRY*= ERK TAK1*= TGFBR TAOK*= ATM TGFBR*= TGFBR_stimulus TGFBR_stimulus*= TGFBR_stimulus ''' attr_cy.build(modeltext) import pyximport pyximport.install() res = attr_cy.run(samples=100000, steps=100, debug=False, progress=True, on_states=[ 'DNA_damage', 'TGFBR_stimulus', 'p53', 'p38', 'PKC', 'GRB2', 'GAB1' ], off_states=['EGFR_stimulus', 'ERK', 'FGFR3_stimulus']) # on_states=['A01', 'A51'], off_states=['A38', 'A40'] # debug needs to be changed to 'True' to check trajectory
S_E2F_CyclinE *= S_CycE and S_E2F S_cdh1_UbcH10 *= S_UbcH10 and S_cdh1 S_TAK1 *= S_TNFalpha S_GSH *= S_Myc_Max or S_NF_kB or S_p21 S_TCF *= S_beta_cat and not S_TAK1 S_Miz_1 *= not S_Myc_Max S_p70 *= S_PDK1 or S_mTOR S_ATM_ATR *= S_DnaDamage S_CHK1_2 *= S_ATM_ATR S_DNARepair *= S_ATM_ATR S_eEF2K *= S_p70 or S_p90 S_eEF2 *= not S_eEF2K S_p53_PTEN *= S_PTEN and S_p53 S_LDHA *= S_HIF1 and S_Myc_Max S_AcidLactic *= S_LDHA S_Snail *= S_NF_kB and S_Smad and not S_GSK_3 and not S_p53 ''' # if not exists('engine.pyx'): attr_cy.build(text) import pyximport pyximport.install() import engine def test_this_2(): result = engine.main(samples=1000000, steps=50, debug=False, \ progress=True, on_states=[], off_states=[]) json.dump(result, open('test_attr_cy_long.json', 'w'), indent=4)