sys-bio / tellurium

Python Environment for Modeling and Simulating Biological Systems
http://tellurium.analogmachine.org/
Apache License 2.0
106 stars 36 forks source link

Is inline_omex with multiple SED-ML / phrasedml supported? #232

Closed matthiaskoenig closed 7 years ago

matthiaskoenig commented 7 years ago

How can I run multiple phrasedml simulations with the same model in inline_omex? How would I switch the master attribute between 2 phrasedml simulations?

Currently only the master file is executed

        for sedml_asset in self.getSedmlAssets():
            if sedml_asset.getMaster():
                sedml_path = os.path.join(workingDir, sedml_asset.getLocation())
                executeSEDML(sedml_path,
                             workingDir=os.path.dirname(sedml_path))
0u812 commented 7 years ago

This is supported. Here is a demo (also printed below) with two SED-ML files. Both files have the master attribute set, so they are both executed. The %tasks ./BorisEJB-Figure2A.xml --master=True directive marks the start of one of the phrasedml strings (it specifies the filepath in the archive and the master attribute).

%model ./BorisEJB.xml
// -- Begin Antimony block converted from BorisEJB.xml
// Created by libAntimony v2.9.3
model *BorisEJB()

  // Compartments and Species:
  compartment compartment_;
  species MKKK in compartment_, MKKK_P in compartment_, MKK in compartment_;
  species MKK_P in compartment_, MKK_PP in compartment_, MAPK in compartment_;
  species MAPK_P in compartment_, MAPK_PP in compartment_;

  // Reactions:
  J0: MKKK => MKKK_P; J0_V1*MKKK/((1 + (MAPK_PP/J0_Ki)^J0_n)*(J0_K1 + MKKK));
  J1: MKKK_P => MKKK; J1_V2*MKKK_P/(J1_KK2 + MKKK_P);
  J2: MKK => MKK_P; J2_k3*MKKK_P*MKK/(J2_KK3 + MKK);
  J3: MKK_P => MKK_PP; J3_k4*MKKK_P*MKK_P/(J3_KK4 + MKK_P);
  J4: MKK_PP => MKK_P; J4_V5*MKK_PP/(J4_KK5 + MKK_PP);
  J5: MKK_P => MKK; J5_V6*MKK_P/(J5_KK6 + MKK_P);
  J6: MAPK => MAPK_P; J6_k7*MKK_PP*MAPK/(J6_KK7 + MAPK);
  J7: MAPK_P => MAPK_PP; J7_k8*MKK_PP*MAPK_P/(J7_KK8 + MAPK_P);
  J8: MAPK_PP => MAPK_P; J8_V9*MAPK_PP/(J8_KK9 + MAPK_PP);
  J9: MAPK_P => MAPK; J9_V10*MAPK_P/(J9_KK10 + MAPK_P);

  // Species initializations:
  MKKK = 90;
  MKKK_P = 10;
  MKK = 280;
  MKK_P = 10;
  MKK_PP = 10;
  MAPK = 280;
  MAPK_P = 10;
  MAPK_PP = 10;

  // Compartment initializations:
  compartment_ = 1;

  // Variable initializations:
  J0_V1 = 2.5;
  J0_Ki = 9;
  J0_n = 1;
  J0_K1 = 10;
  J1_V2 = 0.25;
  J1_KK2 = 8;
  J2_k3 = 0.025;
  J2_KK3 = 15;
  J3_k4 = 0.025;
  J3_KK4 = 15;
  J4_V5 = 0.75;
  J4_KK5 = 15;
  J5_V6 = 0.75;
  J5_KK6 = 15;
  J6_k7 = 0.025;
  J6_KK7 = 15;
  J7_k8 = 0.025;
  J7_KK8 = 15;
  J8_V9 = 0.5;
  J8_KK9 = 15;
  J9_V10 = 0.5;
  J9_KK10 = 15;

  // Other declarations:
  const compartment_, J0_V1, J0_Ki, J0_n, J0_K1, J1_V2, J1_KK2, J2_k3, J2_KK3;
  const J3_k4, J3_KK4, J4_V5, J4_KK5, J5_V6, J5_KK6, J6_k7, J6_KK7, J7_k8;
  const J7_KK8, J8_V9, J8_KK9, J9_V10, J9_KK10;
end
// -- End Antimony block

%tasks ./BorisEJB-Figure2A.xml --master=True
// -- Begin PhraSEDML block converted from BorisEJB-Figure2A.xml
// Created by libphrasedml v1.0.6
// Models
model1 = model "BorisEJB"

// Simulations
timecourse1 = simulate uniform(0, 9000, 9000)

// Tasks
task1 = run timecourse1 on model1

// Outputs
plot "Figure 2A" time vs MAPK, MAPK_PP
// -- End PhraSEDML block

%tasks ./BorisEJB-Figure2B.xml --master=True
// -- Begin PhraSEDML block converted from BorisEJB-Figure2B.xml
// Created by libphrasedml v1.0.6
// Models
model1 = model "BorisEJB"
model1_1 = model model1 with J0_Ki = 18, J0_n = 2, J0_K1 = 50, J1_KK2 = 40, J2_KK3 = 100, J3_KK4 = 100, J4_KK5 = 100, J5_KK6 = 100, J6_KK7 = 100, J7_KK8 = 100, J8_V9 = 1.25, J8_KK9 = 100, J9_V10 = 1.25, J9_KK10 = 100

// Simulations
timecourse1 = simulate uniform(0, 12000, 12000)

// Tasks
task1 = run timecourse1 on model1_1

// Outputs
plot "Figure 2B" time vs MAPK, MAPK_PP

// Names
model1_1 is "model1 modified"
// -- End PhraSEDML block
matthiaskoenig commented 7 years ago

thanks for the clarification