sys.path.append(pyssa_path)
import pyssa.ssa as ssa
import pyssa.models.standard_models as sm
from pyssa.models.reaction_model import ReactionModel
import pyssa.ssa_compiled.gillespie as gillespie
from pyssa.models.cle_model import RREModel

pymbvi_path = '/Users/christian/Documents/Code/pymbvi'
sys.path.append(pymbvi_path)
from pymbvi.models.observation.kinetic_obs_model import LognormObs

# fix seed
np.random.seed(2007141048)

# prepare  model for simulation
pre, post, rates = sm.get_standard_model("degradation_oscillator")
pre = np.array(pre, dtype=np.float64)
post = np.array(post, dtype=np.float64)
rates = np.array(rates)
initial = np.array([0.0, 0.0, 0.0, 0.0])
tspan = np.array([0.0, 6 * 60 * 60])

# number of trajectories
num_samples = 5000

# prepare initial conditions
t_plot = np.linspace(tspan[0], tspan[1], 200)

# compute ODE mean
rre_model = RREModel(pre, post, rates)
import linear_memory.utils as ut
from import_utils import add_path
from scipy.interpolate import interp1d

add_path('pyssa')
import pyssa.ssa as ssa
import pyssa.models.standard_models as sm

add_path('pymbvi')
from pymbvi.models.mjp.autograd_partition_specific_models import SimpleGeneExpression
from pymbvi.util import num_derivative, autograd_jacobian

torch.manual_seed(2007301620)

# get simulation model
pre, post, rates = sm.get_standard_model("simple_gene_expression")

# prepare initial conditions
initial = np.array([0.0, 1.0, 0.0, 0.0])
tspan = np.array([0.0, 3e3])

# set up gene expression model
moment_initial = np.zeros(9)
moment_initial[0:3] = initial[1:4]
model = SimpleGeneExpression(moment_initial, np.log(np.array(rates)), tspan)


def searchsorted(vector, elements):
    ind = np.searchsorted(vector.detach().numpy(), elements.detach().numpy())
    return (torch.tensor(ind))
sys.path.append(pyssa_path)
import pyssa.ssa as ssa
import pyssa.models.standard_models as sm
from pyssa.models.reaction_model import ReactionModel
import pyssa.ssa_compiled.gillespie as gillespie
from pyssa.models.cle_model import RREModel

pymbvi_path = '/Users/christian/Documents/Code/pymbvi'
sys.path.append(pymbvi_path)
from pymbvi.models.observation.kinetic_obs_model import LognormObs

# fix seed
np.random.seed(2007141048)

# prepare  model for simulation
pre, post, rates = sm.get_standard_model("single_gene_oscillator")
pre = np.array(pre, dtype=np.float64)
post = np.array(post, dtype=np.float64)
rates = np.array(rates)
initial = np.array([1.0, 0.0, 0.0, 0.0])
tspan = np.array([0.0, 5000.0])

# number of trajectories
num_samples = 1000

# prepare initial conditions
initial = np.array([1.0, 0.0, 0.0, 0.0])
tspan = np.array([0.0, 2e3])
t_plot = np.linspace(tspan[0], tspan[1], 200)

# compute ODE mean
from pyssa.models.reaction_model import ReactionModel
import pyssa.ssa_compiled.gillespie as gillespie
from pyssa.models.cle_model import RREModel

pymbvi_path = '/Users/christian/Documents/Code/pymbvi'
sys.path.append(pymbvi_path)
from pymbvi.models.observation.kinetic_obs_model import LognormObs

# fix seed
np.random.seed(2008061030)

file_path = '/Users/christian/Documents/Code/pyssa/pyssa/models/collection/stochastic_repressilator.xlsx'
df = pd.ExcelFile(file_path).parse()

# load model
pre, post, rates = sm.get_standard_model("stochastic_toggle_switch")

# prepare initial conditions
initial = np.zeros(8)
initial[1] = 1
#initial[2] = 10
#initial[3] = 300
initial[5] = 1
tspan = np.array([0.0, 200 * 60 * 60])
t_plot = np.linspace(tspan[0], tspan[1], 200)

# compute rre solution
rre_model = RREModel(pre, post, rates)


def odefun(time, state):
示例#5
0
from pyssa.models.reaction_model import ReactionModel
import pyssa.ssa_compiled.gillespie as gillespie
from pyssa.models.cle_model import RREModel

pymbvi_path = '/Users/christian/Documents/Code/pymbvi'
sys.path.append(pymbvi_path)
from pymbvi.models.observation.kinetic_obs_model import LognormObs

# fix seed
#np.random.seed(2007211010)

file_path = '/Users/christian/Documents/Code/pyssa/pyssa/models/collection/stochastic_repressilator.xlsx'
df = pd.ExcelFile(file_path).parse()

# load model
pre, post, rates = sm.get_standard_model("stochastic_repressilator")

# prepare initial conditions
initial = np.zeros(15)
initial[1] = 20
initial[2] = 0.1
initial[3] = 0
initial[6] = 20
initial[11] = 20
tspan = np.array([0.0, 50000 * 60])
t_plot = np.linspace(tspan[0], tspan[1], 200)

# compute rre solution
rre_model = RREModel(pre, post, rates)