Exemplo n.º 1
0
def simulateAndPlot(r, start, end, steps, selection=None):
    import tellurium as te
    if selection is None:
        result = r.simulate(start, end, steps)
    else:
        result = r.simulate(start, end, steps, selection)
    te.plotWithLegend(r, result)
Exemplo n.º 2
0
def simulateAndPlot(rr, startTime=0, endTime=5, numberOfPoints=500):
    """
    Carry out a simulation and plot the results. Returns the result to the caller 
    
    Example:
    
    simulateAndPlot (rr)
    
    simulateAndPlot (rr, 0, 10, 100)
    """
    result = rr.simulate(startTime, endTime, numberOfPoints)
    tellurium.plotWithLegend(rr, result)
    return result
Exemplo n.º 3
0
def simulateAndPlot(r, *args, **kwargs):
    """ Simulate with r.simulate with given arguments and plot with tellurium. """
    result = r.simulate(*args, **kwargs)
    import tellurium as te

    te.plotWithLegend(r, result)
Exemplo n.º 4
0
rr = te.loada('''
     $Xo -> S1; k1*Xo;
     S1 -> $X1; k2*S1;
     S1 -> $X2; k3*S1;
     
     // Initial Value
     Xo = 10; X1 = 0; 
     X2 = 0; k1 = 3;
     k2 = 1.5; k3 = 0.5;
     
     // Initial Starting Point
     S1 = 1;
''')

#rr.steadyState()

print rr.S1
m1 = rr.simulate(0, 20, 100, ["time", "S1"])
rr.Xo = rr.Xo + 0.75
m2 = rr.simulate(20, 40, 100, ["time", "S1"])
m3 = numpy.vstack((m1, m2))
rr.Xo = rr.Xo - 0.75
m4 = rr.simulate(40, 60, 100, ["time", "S1"])
result = numpy.vstack((m3, m4))

#Plotting
te.plotWithLegend(rr, result)
plt.title('Concentration of S1 with Perturbation', fontsize=14)
plt.xlabel('Time(s)', fontsize=14)
plt.ylabel('Concentration(M)', fontsize=14)
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 11 14:53:42 2014

@author: mgaldzic
"""

import tellurium as te
#Single gene expressing protein and protein undergoing degradation
model = '''
  model mygene() 

      # Reactions: 
      J1:   -> P; Vm*T^4/(K+T^4)
      J2: P ->  ; k1*P; 

      # Species initializations: 
      P = 0;   T = 5; Vm = 10
      K = 0.5; k1 = 4.5;   
  end
''' 

r = te.loadAntimonyModel(model)
result = r.simulate(0, 10, 50)
te.plotWithLegend (r, result)
Exemplo n.º 6
0
# Incoherent Type I Genetic Network, Pulse generator
rr = te.loada ('''
    $G1 -> P2; t1*a1*P1/(1 + a1*P1);
    P2 -> $w;  gamma_1*P2;
    $G3 -> P3; t2*b1*P1/(1 + b1*P1 + b2*P2 + b3*P1*P2^8);
    P3 -> $w;  gamma_2*P3;

    P2 = 0;
    P3 = 0;
    P1 = 0.01;
    G3 = 0;
    G1 = 0;
    t1 = 5;
    a1 = 0.1;
    t2 = 1;
    b1 = 1;
    b2 = 0.1;
    b3 = 10;
    gamma_1 = 0.1;
    gamma_2 = 0.1;
''')

# Time course response for a step pulse
rr.P1 = 0.0;
m1 = rr.simulate(0, 10, 100, ["Time", "P1", "P3"])
rr.P1 = 0.4 # Input stimulus
m2 = rr.simulate(10, 50, 200, ["Time", "P1", "P3"])
m = numpy.vstack((m1, m2))
te.plotWithLegend(rr, m)