Пример #1
0
def main():
    #Creates SSA version of model.
    ODEmodel, SSAmodel, state_names, param_names = FullModel(True)

    ODEsol = ctb.CircEval(ODEmodel, param, y0in)
    y0LC = ODEsol.burnTransient_sim(tf=000, numsteps=1000)
    sol = ODEsol.intODEs_sim(y0LC, 10, numsteps=1000)
    tsol = ODEsol.ts

    pdb.set_trace()
    trajectories = stk.stochkit(SSAmodel,
                                job_id='tyson',
                                t=10,
                                number_of_trajectories=100,
                                increment=0.1)

    StochEval = stk.StochEval(trajectories, state_names, param_names, vol)
    StochEval.PlotAvg('X', color='red', traces=True)
    StochEval.PlotAvg('Y', color='black', traces=True)

    pl.plot(tsol, vol * sol)

    pl.show()
    pdb.set_trace()
        SSA_builder.SSA_MM('Cell'+str(indx)+'_Reaction3','vd',
                           km=['kd'],Rct=['Pc'+index])
        
        #The complexing four:
        SSA_builder.SSA_MA_cytonuc('Cell'+str(indx)+'_Reaction4','Pc'+index,
                                   'Pn'+index,'k1_','k2_')
        

    return SSAmodel,state_names,param_names
    

if __name__=='__main__':
    
    print param
    
    ODEsolC = ctb.CircEval(ODEmodel(), param, y0in)
    sol = ODEsolC.intODEs_sim(100)
    tsol = ODEsolC.ts
    plt.plot(sol)
    plt.show()
    
    tf=10
    inc = 0.05
    adjacency = np.array([[1,1,0],[0,1,1],[0,0,1]])#, 
                              #[0,0.5,0.5,0], 
                              #[0,0,0.5,0],
                              #[0,0,0,0]])
    
    SSAnet,state_names,param_names = SSAnetwork(ODEmodel(),
                                                    y0in,param,adjacency)
    
    fn.setOption("name", "kiss_oscillator_2011")

    return fn


if __name__ == "__main__":
    """
    Test suite for the model. We will run with both casadi deterministic 
    and gillespy stochastic simulations.
    """

    import circadiantoolbox as ctb
    import PlotOptions as plo

    # create deterministic circadian object
    kiss_odes = ctb.CircEval(kiss_model_ode(), param, y0in)
    kiss_odes.burnTransient_sim()
    kiss_odes.intODEs_sim(200)

    # plot deterministic solutions
    plo.PlotOptions()
    plt.figure()
    plt.plot(kiss_odes.ts, kiss_odes.sol[:, 0], label='e1, V oscillatory')
    plt.plot(kiss_odes.ts, kiss_odes.sol[:, 2], label='e2')
    plt.title('High-Freq. Signal Propagates as described by TF')
    plt.xlabel('t')
    plt.ylabel('e')
    plt.legend(loc=0)
    plt.tight_layout(**plo.layout_pad)

    # fft setup data
    return fn


if __name__ == "__main__":

    import circadiantoolbox as ctb
    import PlotOptions as plo
    from numpy import fft
    import pdb

    #param[1]=0
    #param[2]=0

    # create deterministic circadian object
    coupled_odes = ctb.CircEval(ODEmodel(), param, y0in)
    #coupled_odes.burnTransient_sim()
    coupled_odes.intODEs_sim(200)

    #Fixing signal to show perturbation
    coupled_odes.sol[:, 8] = coupled_odes.sol[:, 8] + amp * np.sin(
        freq * coupled_odes.ts)

    plo.PlotOptions()
    """
    plt.plot(coupled_odes.ts, coupled_odes.sol[:,8],label='C1P 1')
    plt.plot(coupled_odes.ts, coupled_odes.sol[:,3], label='vip 1')
    plt.plot(coupled_odes.ts, coupled_odes.sol[:,18], label = 'VIP 2')
    plt.plot(coupled_odes.ts, coupled_odes.sol[:,21], label = 'CREB 2')
    plt.plot(coupled_odes.ts, coupled_odes.sol[:,11], label = 'per 2')
    plt.plot(coupled_odes.ts, coupled_odes.sol[:,0], label = 'per 1')