# run_egfr_extended.bngl
# load and run EGFR extended model using NF, HPP and SSA methods
version("2.2.4+")
setModelName("egfr_extended")
readFile({file=>"egfr_extended.bngl",allow_actions=>0})

# configure HPP
begin parameters
    # fraction of cell to simulate
    f  0.01
    # population lumping rate, /s
    k_lump 100000
end parameters
begin population maps
    Egf(r) -> X0001()    k_lump
    PLCg(a,b~0,c~0) -> X0002()  k_lump
    PLCg(a,b~P,c~0) -> X0003()  k_lump
    PLCg(a,b~P,c~I) -> X0004()  k_lump
    GAP(ras) -> X0005()  k_lump
    Ras(nuc~U,raf,cat)   -> X0006()  k_lump
    Ras(nuc~GDP,raf,cat) -> X0007()  k_lump
    Ras(nuc~GTP,raf,cat) -> X0008()  k_lump
    Ras(nuc~GDP,raf,cat!0).GAP(ras!0) -> X0009()  k_lump
    Raf(ras,bind,phos~U) -> X0010()  k_lump
    Raf(ras,bind,phos~P) -> X0011()  k_lump
    Ras(nuc~GTP,raf!0,cat).Raf(ras!0,bind,phos~P) -> X0012()  k_lump
    Ras(nuc~GTP,raf!0,cat).Raf(ras!0,bind!1,phos~P).MEK(bind!1,phos~U,loc~cyt) -> X0013()  k_lump
    MEK(bind,phos~U,loc~cyt) -> X0014()  k_lump
    MEK(bind,phos~U,loc~nuc) -> X0015()  k_lump
    MEK(bind,phos~P,loc~cyt) -> X0016()  k_lump
    MEK(bind,phos~P,loc~nuc) -> X0017()  k_lump
    ERK(bind,phos~U,loc~cyt) -> X0018()  k_lump
    ERK(bind,phos~U,loc~nuc) -> X0019()  k_lump
    ERK(bind,phos~P,loc~cyt) -> X0020()  k_lump
    ERK(bind,phos~P,loc~nuc) -> X0021()  k_lump
    MEK(bind!0,phos~U,loc~cyt).ERK(bind!0,phos~U,loc~cyt) -> X0022()  k_lump
    MEK(bind!0,phos~U,loc~nuc).ERK(bind!0,phos~U,loc~nuc) -> X0023()  k_lump
    MEK(bind!0,phos~P,loc~cyt).ERK(bind!0,phos~U,loc~cyt) -> X0024()  k_lump
    MEK(bind!0,phos~P,loc~nuc).ERK(bind!0,phos~U,loc~nuc) -> X0025()  k_lump
end population maps

# actions:
saveConcentrations()
# simulate with NFsim
simulate_nf({ suffix=>"nf", t_end=>2400, n_steps=>120, gml=>10000000, complex=>0, get_final_state=>0 })
# generate partial network and simulate with HPP
resetConcentrations()
generate_hybrid_model({ suffix=>"hpp", overwrite=>1, verbose=>1, execute=>1,\
                        actions=>["simulate_nf({ t_end=>2400, n_steps=>120 ,gml=>10000000, complex=>0 })"] })
# generate reaction network and simulate with SSA 
resetConcentrations()
generate_network({ overwrite=>1 })
simulate_ssa({ suffix=>"ssa", t_end=>2400,n_steps=>120, print_CDAT=>0 })