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)
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 json.dump(res, open('FVS_application_to_r10.json', 'w'), indent=4)
multilineString = modeltext.splitlines() nodeRaw = [] node = [] combination = {} for line in multilineString: if not (line == "" or line.count("*=") >= 1): nodeRaw.append(line) for line in nodeRaw: line.find("=") node.append(line[0:line.find("=")]) combinationNumber = 2 for subset1 in itertools.combinations(node, combinationNumber): for k in range(0, combinationNumber + 1): for subset2 in itertools.combinations(subset1, k): nodeOnList = [i for i in subset2] nodeOffList = list(subset1) for j in nodeOnList: nodeOffList.remove(j) res = attr_cy.run(samples=100000, steps=200, debug=False, progress=True, on_states=nodeOnList, off_states=nodeOffList) combination["On" + str(nodeOnList) + "Off" + str(nodeOffList)] = res json.dump(combination, open('CK_application_to_r9.json', 'w'), indent=4)
PKC*= PLCG PLCG*= EGFR or FGFR3 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=['EGFR'], off_states=['p14']) # on_states=['A01', 'A51'], off_states=['A38', 'A40'] # debug needs to be changed to 'True' to check trajectory json.dump(res, open('EGFR_p14.json', 'w'), indent=4)
p38*= (TAOK and MAP3K1_3) or (MAP3K1_3 and MTK1) or (TAOK and MTK1) or (TAK1 and MTK1) or (TAK1 and MAP3K1_3) or (TAK1 and TAOK) or ((TAOK or MTK1 or MAP3K1_3 or TAK1) and not DUSP1) p53*= (ATM and p38) or ((ATM or p38) and not MDM2) p70*= PDK1 and ERK PDK1*= PI3K PI3K*= GAB1 or (RAS and SOS) PKC*= PLCG PLCG*= EGFR or FGFR3 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=['A01', 'A51'], off_states=['A38', 'A40'] # debug needs to be changed to 'True' to check trajectory json.dump(res, open('normal.json', 'w'), indent=4)