From b435eb5c872163381b655e7eec2f4ddc7e457568 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Thu, 2 Jun 2022 15:17:02 -0600 Subject: [PATCH 01/13] Updated Files for the Translator --- .../async/ibiosim/conversion/Converter.java | 46 ++- .../async/ibiosim/conversion/SBML2PRISM.java | 305 ++++++++++++++++++ .../dataModels/biomodel/parser/BioModel.java | 2 +- 3 files changed, 348 insertions(+), 5 deletions(-) create mode 100644 conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java index 319356dcd..6be3e9a08 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java @@ -90,7 +90,7 @@ private static void usage() System.err.println("\t-esf Export SBML hierarchical models in a single output file."); System.err.println("\t-f continue after first error"); System.err.println("\t-i allow SBOL document to be incomplete"); - System.err.println("\t-l specifies language (SBOL1/SBOL2/GenBank/FASTA/SBML) for output (default=SBOL2). To output FASTA or GenBank, no SBOL default URI prefix is needed."); + System.err.println("\t-l specifies language (SBOL1/SBOL2/GenBank/FASTA/SBML/PRISM) for output (default=SBOL2). To output FASTA or GenBank, no SBOL default URI prefix is needed."); System.err.println("\t-mf The name of the file that will be produced to hold the result of the main SBOL file, if SBOL file diff was selected."); System.err.println("\t-n allow non-compliant URIs"); System.err.println("\t-o specifies the full path of the output file produced from the converter"); @@ -105,6 +105,8 @@ private static void usage() System.err.println("\t-r The specified synbiohub repository the user wants VPR model generator to connect to"); System.err.println("\t -env is the complete directory path of the environmental file to instantiate to your model. This only works when VPR model generator is used"); System.err.println("\t-Cello This option is for dynamic modeling of Cello parts and parametrization"); + System.err.println("\t-tmID Set the ID of the top SBML model"); + System.err.println("\t-prism SBOL to PRISM converter"); System.exit(1); } @@ -129,6 +131,7 @@ public static void main(String[] args) boolean sbolV1out = false; //-l boolean sbolV2out = false; //-l boolean sbmlOut = false; //-l + boolean prismOut = false; //-l boolean compliant = true; //-n boolean noOutput = false; //-no boolean typesInURI = false; //-t @@ -150,6 +153,7 @@ public static void main(String[] args) String version = null; //-v String urlVPR = ""; //The specified synbiohub repository the user wants VPR model generator to connect to. String environment =""; + String topModelId = null; HashSet ref_sbolInputFilePath = new HashSet(); //rsbol @@ -224,6 +228,11 @@ else if (args[index+1].equals("SBOL2")) sbolV2out = true; ++index; } + else if (args[index+1].equals("PRISM")) + { + prismOut = true; + ++index; + } else { usage(); @@ -309,6 +318,12 @@ else if (args[index+1].equals("SBOL2")) topEnvir = true; environment = args[++index]; break; + case "-tmID": + if(index+1 >= args.length || (!args[index+1].isEmpty() && args[index+1].charAt(0)=='-')) + { + usage(); + } + topModelId = args[++index]; default: fullInputFileName = args[index]; } @@ -405,7 +420,30 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) boolean isDirectory = file.isDirectory(); if (!isDirectory) { - if(inputIsSBML) + if(inputIsSBML && prismOut) + { + SBMLDocument inputSBMLDoc; + + try + { + inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null); + SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, "First.prism"); + } + catch (XMLStreamException e) + { + System.err.println("ERROR: Invalid XML file"); + e.printStackTrace(); + } + catch (IOException e) + { + System.err.println("ERROR: Unable to read or write file"); + e.printStackTrace(); + } + catch (BioSimException e) { + System.err.println("ERROR: Invalid SBML file"); + } + + }else if(inputIsSBML) { SBOLDocument outSBOLDoc = new SBOLDocument(); SBMLDocument inputSBMLDoc; @@ -544,7 +582,7 @@ else if(inputIsSBOL) SBMLutilities.exportSBMLModels(models, outputDir, outputFileName, noOutput, sbmlOut, singleSBMLOutput); } } - /* TODO: PEDRO FIX ME + if (topModelId != null) { SBMLDocument topModel = SBMLutilities.readSBML(vpr_output+".xml", null, null); topModel.getModel().setId(topModelId); @@ -563,7 +601,7 @@ else if(inputIsSBOL) e.printStackTrace(); } } - */ + if (doVPR) { if (topEnvir) { SBMLDocument topEnvironment = SBMLutilities.readSBML(environment, null, null); diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java new file mode 100644 index 000000000..c5cad83da --- /dev/null +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -0,0 +1,305 @@ +/******************************************************************************* + * + * This file is part of iBioSim. Please visit + * for the latest version of iBioSim. + * + * Copyright (C) 2017 University of Utah + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the Apache License. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online at . + * + *******************************************************************************/ +package edu.utah.ece.async.ibiosim.conversion; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.FilenameFilter; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +import javax.xml.stream.XMLStreamException; + +import org.sbml.jsbml.Model; +import org.sbml.jsbml.ModifierSpeciesReference; +import org.sbml.jsbml.Reaction; +import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.SBMLReader; +import org.sbml.jsbml.Species; +import org.sbml.jsbml.SpeciesReference; +import org.sbml.jsbml.ext.comp.CompModelPlugin; +import org.sbml.jsbml.ext.comp.CompSBMLDocumentPlugin; +import org.sbml.jsbml.ext.comp.CompSBasePlugin; +import org.sbml.jsbml.ext.comp.ExternalModelDefinition; +import org.sbml.jsbml.ext.comp.ReplacedBy; +import org.sbml.jsbml.ext.comp.ReplacedElement; +import org.sbolstandard.core2.AccessType; +import org.sbolstandard.core2.ComponentDefinition; +import org.sbolstandard.core2.DirectionType; +import org.sbolstandard.core2.EDAMOntology; +import org.sbolstandard.core2.FunctionalComponent; +import org.sbolstandard.core2.Interaction; +import org.sbolstandard.core2.Module; +import org.sbolstandard.core2.ModuleDefinition; +import org.sbolstandard.core2.RefinementType; +import org.sbolstandard.core2.SBOLConversionException; +import org.sbolstandard.core2.SBOLDocument; +import org.sbolstandard.core2.SBOLReader; +import org.sbolstandard.core2.SBOLValidationException; +import org.sbolstandard.core2.Sequence; +import org.sbolstandard.core2.SequenceOntology; +import org.sbolstandard.core2.SystemsBiologyOntology; +import org.sbolstandard.core2.TopLevel; + +import edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.AnnotationUtility; +import edu.utah.ece.async.ibiosim.dataModels.biomodel.parser.BioModel; +import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.SBMLutilities; +import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants; + +/** + * Perform conversion from SBML to PRISM. + * + * @author Lukas Buecherl + * @author Chris Myers + * @author iBioSim Contributors + * @version %I% + */ +public class SBML2PRISM { + + + public static void GoodJob() //throws XMLStreamException, IOException, BioSimException + { + System.err.println("Good Job!"); + } + + + public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) throws IOException + { + Model model = sbmlDoc.getModel(); + File file = new File(filename); + + System.err.println("Species: "); + for (int i = 0; i < model.getSpeciesCount(); i++) + { + Species species = model.getSpecies(i); + System.err.println(species); + } + + System.err.println("Reactions: "); + for (int i = 0; i < model.getReactionCount(); i++) + { + Reaction reaction = model.getReaction(i); + System.err.println(reaction); + + } + + for (int i = 0; i < model.getConstraintCount(); i++) + { + System.err.println(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath())); + } + + + + FileWriter out = new FileWriter(file); + out.write("ctmc\n"); + out.close(); + + /*if (s.isConstant()) { + // write const + } else { + // write modules + } + */ + } + + + + + + +/* + + + + private int executePrism(String filename) throws IOException, InterruptedException, XMLStreamException, BioSimException { + int exitValue = 255; + String prop = null; + String directory = properties.getDirectory() + File.separator; + String out = properties.getModelFile().replace(".xml", "").replaceAll(".lpn", "").replaceAll(".sbml", ""); + LPN lhpnFile = null; + // String root = properties.getRoot(); + + + new File(filename.replace(".gcm", "").replace(".sbml", "").replace(".xml", "") + ".lpn").delete(); + ArrayList specs = new ArrayList<>(); + ArrayList conLevel = new ArrayList<>(); + retrieveSpeciesAndConLevels(specs, conLevel); + BioModel bioModel = BioModel.createBioModel(properties.getDirectory(), this); + bioModel.load(filename); + if (bioModel.flattenModel(true) != null) { + if (properties.getVerificationProperties().getLpnProperty() != null && !properties.getVerificationProperties().getLpnProperty().equals("")) { + prop = properties.getVerificationProperties().getLpnProperty(); + } else { + prop = properties.getVerificationProperties().getConstraintProperty(); + } + MutableString mutProp = new MutableString(prop); + lhpnFile = LPN.convertToLHPN(specs, conLevel, mutProp, bioModel); + prop = mutProp.getString(); + if (lhpnFile == null) { + new File(properties.getDirectory() + File.separator + "running").delete(); + return 0; + } + message.setLog("Saving SBML file as PRISM file:\n" + filename.replace(".xml", ".prism")); + this.notifyObservers(message); + message.setLog("Saving PRISM Property file:\n" + filename.replace(".xml", ".pctl")); + this.notifyObservers(message); + // TODO: LUKAS + // bioModel.convertSBML2PRISM(logFile, filename); + LPN.convertLPN2PRISM(logFile, lhpnFile, filename.replace(".xml", ".prism"), bioModel.getSBMLDocument()); + Preferences biosimrc = Preferences.userRoot(); + String prismCmd = biosimrc.get("biosim.general.prism", ""); + if (prismCmd.contains("$prism")) { + prismCmd = prismCmd.replace("$prism", directory + out + ".prism"); + } else { + prismCmd = prismCmd + " " + directory + out + ".prism"; + } + if (prismCmd.contains("$pctl")) { + prismCmd = prismCmd.replace("$pctl", directory + out + ".pctl"); + } else { + prismCmd = prismCmd + " " + directory + out + ".pctl"; + } + message.setLog("Executing:\n" + prismCmd); + this.notifyObservers(message); + reb2sac = exec.exec(prismCmd, null, work); + String error = "", result = ""; + try { + InputStream reb = reb2sac.getInputStream(); + InputStreamReader isr = new InputStreamReader(reb); + BufferedReader br = new BufferedReader(isr); + String line; + while ((line = br.readLine()) != null) { + if (line.startsWith("Result")) { + result = line + '\n'; + } + } + InputStream reb2 = reb2sac.getErrorStream(); + int read = reb2.read(); + while (read != -1) { + error += (char) read; + read = reb2.read(); + } + br.close(); + isr.close(); + reb.close(); + reb2.close(); + } + catch (Exception e) { + // e.printStackTrace(); + } + if (reb2sac != null) { + exitValue = reb2sac.waitFor(); + } + if (!error.equals("")) { + message.setLog("Errors:\n" + error + "\n"); + + this.notifyObservers(message); + } else if (!result.equals("")) { + message.setLog(result); + this.notifyObservers(message); + } else { + throw new BioSimException("Verification Failed!", "Verification could not be executed. Something went wrong."); + } + + exitValue = 0; + } else { + new File(directory + File.separator + "running").delete(); + logFile.close(); + exitValue = 0; + } + } + + if (reb2sac != null) { + exitValue = reb2sac.waitFor(); + } + + return exitValue; + } + + + *? + + + + + + + // write pctl file using the SBML constraints +/* + File file = new File(filename); + try { + FileWriter out = new FileWriter(file); + out.write("ctmc\n"); + for (String var : LPN.getVariables()) { + int i=0; + Place place; + String lastValue=""; + while ((place = LPN.getPlace(var+i))!=null) { + Transition inTrans = place.getPreset()[0]; + ExprTree assign = inTrans.getAssignTree(var); + lastValue = assign.toString(); + i++; + } + Variable variable = LPN.getVariable(var); + String initValue = variable.getInitValue(); + initValue = Long.toString((Math.round(Double.valueOf(initValue)))); + if (lastValue.equals("")) { + out.write("const int "+var+"="+initValue+";\n"); + } else { + out.write("module "+var+"_def\n"); + out.write(" "+var+" : "+"[0.."+lastValue+"] init "+initValue+";\n"); + i=0; + while ((place = LPN.getPlace(var+i))!=null) { + Transition inTrans = place.getPreset()[0]; + ExprTree assign = inTrans.getAssignTree(var); + out.write(" [] "+var+"="+assign.toString()+" -> "); + boolean first = true; + for (Transition outTrans : place.getPostset()) { + assign = outTrans.getAssignTree(var); + ExprTree delay = outTrans.getDelayTree(); + String rate = delay.toString("prism"); + rate = rate.replace("exponential", ""); + if (!first) out.write(" + "); + out.write(rate+":("+var+"'="+assign.toString()+")"); + first = false; + } + out.write(";\n"); + i++; + } + out.write("endmodule\n"); + } + } + out.close(); + for (int i = 0; i < sbml.getModel().getConstraintCount(); i++) { + file = new File(filename.replace(".prism", ".pctl")); + out = new FileWriter(file); + out.write(SBMLutilities.convertMath2PrismProperty(sbml.getModel().getConstraint(i).getMath())); + out.close(); + } + } + catch (IOException e) { + //TODO: Leandro fix Me + //message.setErrorDialog("Error Writing File", "I/O error when writing PRISM file"); + } + */ + +} + + diff --git a/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java b/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java index cc9444473..fd30e5812 100644 --- a/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java +++ b/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java @@ -13,7 +13,7 @@ *******************************************************************************/ package edu.utah.ece.async.ibiosim.dataModels.biomodel.parser; -import java.io.File; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; From 75911f593130490758176ecbd6f8c5ab05aad53e Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Fri, 24 Jun 2022 06:42:38 +0200 Subject: [PATCH 02/13] FirstDraft --- .../async/ibiosim/conversion/Converter.java | 2 +- .../async/ibiosim/conversion/SBML2PRISM.java | 139 +++++++++++++++++- 2 files changed, 138 insertions(+), 3 deletions(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java index 6be3e9a08..871707fea 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java @@ -427,7 +427,7 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) try { inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null); - SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, "First.prism"); + SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName); } catch (XMLStreamException e) { diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java index c5cad83da..a07f890bd 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -28,8 +28,10 @@ import javax.xml.stream.XMLStreamException; +import org.sbml.jsbml.Compartment; import org.sbml.jsbml.Model; import org.sbml.jsbml.ModifierSpeciesReference; +import org.sbml.jsbml.Parameter; import org.sbml.jsbml.Reaction; import org.sbml.jsbml.SBMLDocument; import org.sbml.jsbml.SBMLReader; @@ -84,8 +86,9 @@ public static void GoodJob() //throws XMLStreamException, IOException, BioSimExc public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) throws IOException { Model model = sbmlDoc.getModel(); - File file = new File(filename); + File file = new File(filename.replace(".xml", ".sm")); + /* System.err.println("Species: "); for (int i = 0; i < model.getSpeciesCount(); i++) { @@ -105,13 +108,145 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro { System.err.println(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath())); } - + for (int i = 0; i < model.getParameterCount(); i++) + { + Parameter parameter = model.getParameter(i); + System.err.println(parameter); + } + */ + + // Opening and writing preamble to the file FileWriter out = new FileWriter(file); + out.write("// File generated by SBML-to-PRISM converter\n"); + out.write("// Original file: " + filename + "\n"); + out.write("// @GeneticLogicLab\n"); + out.write("\n"); out.write("ctmc\n"); + out.write("\n"); + + + out.write("// const int MAX_AMOUNT = ADD VALUE \n"); + out.write("\n"); + + // Identify compartments and their size + out.write("// Compartment size\n"); + + for (int i = 0; i < model.getCompartmentCount(); i++) + { + Compartment compartment = model.getCompartment(i); + out.write("const double " + compartment.getId() + " = " + compartment.getSize() + ";\n"); + + } + + out.write("\n"); + + + // Identify model parameters + out.write("// Model parameters\n"); + + for (int i = 0; i < model.getParameterCount(); i++) + { + Parameter parameter = model.getParameter(i); + out.write("const double "+ parameter.getId() + " = " + parameter.getValue() +"; // " + parameter.getName() + "\n"); // if not null name + + } + + out.write("\n"); + + // Identify model species + for (int i = 0; i < model.getSpeciesCount(); i++) + { + Species species = model.getSpecies(i); + out.write("// Species " + species.getId() + "\n"); + out.write("// const int " + species.getId() + "_MAX = MAX_AMOUNT;\n"); + out.write("module "+ species.getId() + "\n"); + out.write("\n"); + out.write(" // "+ species.getId() +" : " + "[0.." + species.getId() + "_MAX] init "+ species.getInitialAmount() + ";\n"); + out.write(" "+ species.getId() + " : " + "int init " + species.getInitialAmount() + ";\n"); + out.write("\n"); + + for (int j = 0; j < model.getReactionCount(); j++) + { + Reaction reaction = model.getReaction(j); + + SpeciesReference reactant = reaction.getReactantForSpecies(species.getId()); + SpeciesReference product = reaction.getProductForSpecies(species.getId()); + + if(reactant != null) + { + out.write(" // " + reaction.getId() + "\n"); + out.write(" [" + reaction.getId() + "] " + species.getId() + " > " + (reactant.getStoichiometry() - 1) + " -> (" + species.getId() + "\'=" + species.getId() + "-" + reactant.getStoichiometry() + ");\n"); + } else if (product != null) + { + out.write(" // " + reaction.getId() + "\n"); + out.write(" [" + reaction.getId() + "] " + species.getId() + " >= " + "0 -> (" + species.getId() + "\'=" + species.getId() + "+" + product.getStoichiometry() + ");\n"); + } + + } + + out.write("\n"); + out.write("endmodule\n"); + out.write("\n"); + + } + + // math + + out.write("// Reaction rates\n"); + out.write("module reaction_rates\n"); + out.write("\n"); + + for (int i = 0; i < model.getReactionCount(); i++) + { + Reaction reaction = model.getReaction(i); + out.write(" // " + reaction.getId() + ": -> "); + for(int j = 0; j < reaction.getProductCount(); j++) + { + out.write(reaction.getProduct(j).getSpecies() + " "); + } + out.write("\n"); + + out.write(" [" + reaction.getId() + "] " + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()) + " > 0 -> " + "(" + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()) + ") : true;\n"); + out.write("\n"); + + } + out.write("endmodule\n"); + + out.write("\n"); + out.write("// Reward structures (one per species)"); + out.write("\n"); + + + // Identify model species + for (int i = 0; i < model.getSpeciesCount(); i++) + { + Species species = model.getSpecies(i); + + out.write("// Reward " + (i+1) + ": " + species.getId() + "\n"); + out.write("rewards " + "\"" + species.getId() + "\" true : " + species.getId() + "; endrewards\n"); + + } + out.close(); + // Write Properties File + File property = new File(filename.replace(".xml", ".props")); + FileWriter property_out = new FileWriter(property); + + property_out.write("// File generated by SBML-to-PRISM converter\n"); + property_out.write("// Original file: " + filename + "\n"); + property_out.write("// @GeneticLogicLab\n"); + property_out.write("\n"); + + for (int i = 0; i < model.getConstraintCount(); i++) + { + property_out.write(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath())); + } + + property_out.close(); + /*if (s.isConstant()) { // write const } else { From 5453e5031d276cfefe21f14fab127d13f3d40c19 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Thu, 14 Jul 2022 12:53:08 -0600 Subject: [PATCH 03/13] Updated Conversion --- .../async/ibiosim/conversion/SBML2PRISM.java | 304 +++++------------- 1 file changed, 77 insertions(+), 227 deletions(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java index a07f890bd..029d94fbd 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -76,47 +77,23 @@ */ public class SBML2PRISM { - - public static void GoodJob() //throws XMLStreamException, IOException, BioSimException - { - System.err.println("Good Job!"); - } - - + /* + * Convert SBML to Prism + * Input: SBMLDocument, File + * Output: void + * + * Function takes in a SBML document and writes the prism conversion of the file in the same directory. The function also translates the constraint into + * a properties file that is written in the same directory in a separate file. The original filename is used for the prism and property file. The SBMML + * file ends in .xml, the prism file in .sm, and the properties file in .props. + * + * To run the converter use the following command: + * java -jar conversion/target/iBioSim-conversion-3.1.0-SNAPSHOT-jar-with-dependencies.jar -l PRISM YOURSBMLFILE.xml + */ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) throws IOException { Model model = sbmlDoc.getModel(); File file = new File(filename.replace(".xml", ".sm")); - /* - System.err.println("Species: "); - for (int i = 0; i < model.getSpeciesCount(); i++) - { - Species species = model.getSpecies(i); - System.err.println(species); - } - - System.err.println("Reactions: "); - for (int i = 0; i < model.getReactionCount(); i++) - { - Reaction reaction = model.getReaction(i); - System.err.println(reaction); - - } - - for (int i = 0; i < model.getConstraintCount(); i++) - { - System.err.println(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath())); - } - - for (int i = 0; i < model.getParameterCount(); i++) - { - Parameter parameter = model.getParameter(i); - System.err.println(parameter); - } - - */ - // Opening and writing preamble to the file FileWriter out = new FileWriter(file); out.write("// File generated by SBML-to-PRISM converter\n"); @@ -136,7 +113,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro for (int i = 0; i < model.getCompartmentCount(); i++) { Compartment compartment = model.getCompartment(i); - out.write("const double " + compartment.getId() + " = " + compartment.getSize() + ";\n"); + out.write("const double " + checkReservedKeywordPrism(compartment.getId()) + " = " + compartment.getSize() + ";\n"); } @@ -149,7 +126,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro for (int i = 0; i < model.getParameterCount(); i++) { Parameter parameter = model.getParameter(i); - out.write("const double "+ parameter.getId() + " = " + parameter.getValue() +"; // " + parameter.getName() + "\n"); // if not null name + out.write("const double "+ checkReservedKeywordPrism(parameter.getId()) + " = " + parameter.getValue() +"; // " + parameter.getName() + "\n"); // if not null name } @@ -159,12 +136,12 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro for (int i = 0; i < model.getSpeciesCount(); i++) { Species species = model.getSpecies(i); - out.write("// Species " + species.getId() + "\n"); - out.write("// const int " + species.getId() + "_MAX = MAX_AMOUNT;\n"); - out.write("module "+ species.getId() + "\n"); + out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("// const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); + out.write("module "+ checkReservedKeywordPrism(species.getId()) + "\n"); out.write("\n"); - out.write(" // "+ species.getId() +" : " + "[0.." + species.getId() + "_MAX] init "+ species.getInitialAmount() + ";\n"); - out.write(" "+ species.getId() + " : " + "int init " + species.getInitialAmount() + ";\n"); + out.write(" // "+ checkReservedKeywordPrism(species.getId()) +" : " + "[0.." + checkReservedKeywordPrism(species.getId()) + "_MAX] init "+ (int) species.getInitialAmount() + ";\n"); + out.write(" "+ checkReservedKeywordPrism(species.getId()) + " : " + "int init " + (int) (species.getInitialAmount()) + ";\n"); out.write("\n"); for (int j = 0; j < model.getReactionCount(); j++) @@ -176,12 +153,12 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro if(reactant != null) { - out.write(" // " + reaction.getId() + "\n"); - out.write(" [" + reaction.getId() + "] " + species.getId() + " > " + (reactant.getStoichiometry() - 1) + " -> (" + species.getId() + "\'=" + species.getId() + "-" + reactant.getStoichiometry() + ");\n"); + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + checkReservedKeywordPrism(species.getId()) + " > " + (int) (reactant.getStoichiometry() - 1) + " -> (" + checkReservedKeywordPrism(species.getId()) + "\'=" + checkReservedKeywordPrism(species.getId()) + "-" + (int) reactant.getStoichiometry() + ");\n"); } else if (product != null) { - out.write(" // " + reaction.getId() + "\n"); - out.write(" [" + reaction.getId() + "] " + species.getId() + " >= " + "0 -> (" + species.getId() + "\'=" + species.getId() + "+" + product.getStoichiometry() + ");\n"); + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + checkReservedKeywordPrism(species.getId()) + " >= " + "0 -> (" + checkReservedKeywordPrism(species.getId()) + "\'=" + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() + ");\n"); } } @@ -192,7 +169,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro } - // math + // Identify reaction rates out.write("// Reaction rates\n"); out.write("module reaction_rates\n"); @@ -201,14 +178,14 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro for (int i = 0; i < model.getReactionCount(); i++) { Reaction reaction = model.getReaction(i); - out.write(" // " + reaction.getId() + ": -> "); + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + ": -> "); for(int j = 0; j < reaction.getProductCount(); j++) { - out.write(reaction.getProduct(j).getSpecies() + " "); + out.write(checkReservedKeywordPrism(reaction.getProduct(j).getSpecies()) + " "); } out.write("\n"); - out.write(" [" + reaction.getId() + "] " + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()) + " > 0 -> " + "(" + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()) + ") : true;\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + " > 0 -> " + "(" + checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + ") : true;\n"); out.write("\n"); } @@ -219,13 +196,13 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro out.write("\n"); - // Identify model species + // Identify rewards for (int i = 0; i < model.getSpeciesCount(); i++) { Species species = model.getSpecies(i); - out.write("// Reward " + (i+1) + ": " + species.getId() + "\n"); - out.write("rewards " + "\"" + species.getId() + "\" true : " + species.getId() + "; endrewards\n"); + out.write("// Reward " + (i+1) + ": " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("rewards " + "\"" + checkReservedKeywordPrism(species.getId()) + "\" true : " + checkReservedKeywordPrism(species.getId()) + "; endrewards\n"); } @@ -242,198 +219,71 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro for (int i = 0; i < model.getConstraintCount(); i++) { - property_out.write(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath())); + System.err.println(checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); + property_out.write(checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); } property_out.close(); - /*if (s.isConstant()) { - // write const - } else { - // write modules - } - */ } + private static String checkReservedKeywordPrism(String speciesname) + { + List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", "endinit", "endinvariant", "endmodule", + "endobservables", "endrewards", "endsystem", "false", "formula", "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", + "max", "mdp", "min", "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", "popta", "probabilistic", + "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", "system", "true", "U", "W"); + if (keywords.contains(speciesname)) + { + return "_" + speciesname; + }else { + return speciesname; + } + } -/* - - + private static String checkReserveKeywordMath(String math, Model model) { - private int executePrism(String filename) throws IOException, InterruptedException, XMLStreamException, BioSimException { - int exitValue = 255; - String prop = null; - String directory = properties.getDirectory() + File.separator; - String out = properties.getModelFile().replace(".xml", "").replaceAll(".lpn", "").replaceAll(".sbml", ""); - LPN lhpnFile = null; - // String root = properties.getRoot(); - - - new File(filename.replace(".gcm", "").replace(".sbml", "").replace(".xml", "") + ".lpn").delete(); - ArrayList specs = new ArrayList<>(); - ArrayList conLevel = new ArrayList<>(); - retrieveSpeciesAndConLevels(specs, conLevel); - BioModel bioModel = BioModel.createBioModel(properties.getDirectory(), this); - bioModel.load(filename); - if (bioModel.flattenModel(true) != null) { - if (properties.getVerificationProperties().getLpnProperty() != null && !properties.getVerificationProperties().getLpnProperty().equals("")) { - prop = properties.getVerificationProperties().getLpnProperty(); - } else { - prop = properties.getVerificationProperties().getConstraintProperty(); - } - MutableString mutProp = new MutableString(prop); - lhpnFile = LPN.convertToLHPN(specs, conLevel, mutProp, bioModel); - prop = mutProp.getString(); - if (lhpnFile == null) { - new File(properties.getDirectory() + File.separator + "running").delete(); - return 0; - } - message.setLog("Saving SBML file as PRISM file:\n" + filename.replace(".xml", ".prism")); - this.notifyObservers(message); - message.setLog("Saving PRISM Property file:\n" + filename.replace(".xml", ".pctl")); - this.notifyObservers(message); - // TODO: LUKAS - // bioModel.convertSBML2PRISM(logFile, filename); - LPN.convertLPN2PRISM(logFile, lhpnFile, filename.replace(".xml", ".prism"), bioModel.getSBMLDocument()); - Preferences biosimrc = Preferences.userRoot(); - String prismCmd = biosimrc.get("biosim.general.prism", ""); - if (prismCmd.contains("$prism")) { - prismCmd = prismCmd.replace("$prism", directory + out + ".prism"); - } else { - prismCmd = prismCmd + " " + directory + out + ".prism"; - } - if (prismCmd.contains("$pctl")) { - prismCmd = prismCmd.replace("$pctl", directory + out + ".pctl"); - } else { - prismCmd = prismCmd + " " + directory + out + ".pctl"; - } - message.setLog("Executing:\n" + prismCmd); - this.notifyObservers(message); - reb2sac = exec.exec(prismCmd, null, work); - String error = "", result = ""; - try { - InputStream reb = reb2sac.getInputStream(); - InputStreamReader isr = new InputStreamReader(reb); - BufferedReader br = new BufferedReader(isr); - String line; - while ((line = br.readLine()) != null) { - if (line.startsWith("Result")) { - result = line + '\n'; - } - } - InputStream reb2 = reb2sac.getErrorStream(); - int read = reb2.read(); - while (read != -1) { - error += (char) read; - read = reb2.read(); - } - br.close(); - isr.close(); - reb.close(); - reb2.close(); - } - catch (Exception e) { - // e.printStackTrace(); - } - if (reb2sac != null) { - exitValue = reb2sac.waitFor(); - } - if (!error.equals("")) { - message.setLog("Errors:\n" + error + "\n"); - - this.notifyObservers(message); - } else if (!result.equals("")) { - message.setLog(result); - this.notifyObservers(message); - } else { - throw new BioSimException("Verification Failed!", "Verification could not be executed. Something went wrong."); - } - - exitValue = 0; - } else { - new File(directory + File.separator + "running").delete(); - logFile.close(); - exitValue = 0; - } - } - - if (reb2sac != null) { - exitValue = reb2sac.waitFor(); - } - - return exitValue; - } + List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", "endinit", "endinvariant", "endmodule", + "endobservables", "endrewards", "endsystem", "false", "formula", "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", + "max", "mdp", "min", "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", "popta", "probabilistic", + "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", "system", "true", "U", "W"); + ArrayList speciesString = new ArrayList(); - *? - + for (int i = 0; i < model.getSpeciesCount(); i++) + { + Species species = model.getSpecies(i); + + if(keywords.contains(species.getId())) + { + speciesString.add(species.getId()); + } + + } + //System.err.println(speciesString); + for(int i = 0; i < keywords.size(); i++) + { + if(speciesString.contains(keywords.get(i))) + { + String Target = " " + keywords.get(i); + //System.err.println(Target); + math = math.replace(Target, "_" + keywords.get(i)); + //System.err.println(math); + String TargetProperty = "(" + keywords.get(i); + math = math.replace(TargetProperty, "(_" + keywords.get(i)); + } + } - // write pctl file using the SBML constraints -/* - File file = new File(filename); - try { - FileWriter out = new FileWriter(file); - out.write("ctmc\n"); - for (String var : LPN.getVariables()) { - int i=0; - Place place; - String lastValue=""; - while ((place = LPN.getPlace(var+i))!=null) { - Transition inTrans = place.getPreset()[0]; - ExprTree assign = inTrans.getAssignTree(var); - lastValue = assign.toString(); - i++; - } - Variable variable = LPN.getVariable(var); - String initValue = variable.getInitValue(); - initValue = Long.toString((Math.round(Double.valueOf(initValue)))); - if (lastValue.equals("")) { - out.write("const int "+var+"="+initValue+";\n"); - } else { - out.write("module "+var+"_def\n"); - out.write(" "+var+" : "+"[0.."+lastValue+"] init "+initValue+";\n"); - i=0; - while ((place = LPN.getPlace(var+i))!=null) { - Transition inTrans = place.getPreset()[0]; - ExprTree assign = inTrans.getAssignTree(var); - out.write(" [] "+var+"="+assign.toString()+" -> "); - boolean first = true; - for (Transition outTrans : place.getPostset()) { - assign = outTrans.getAssignTree(var); - ExprTree delay = outTrans.getDelayTree(); - String rate = delay.toString("prism"); - rate = rate.replace("exponential", ""); - if (!first) out.write(" + "); - out.write(rate+":("+var+"'="+assign.toString()+")"); - first = false; - } - out.write(";\n"); - i++; - } - out.write("endmodule\n"); - } - } - out.close(); - for (int i = 0; i < sbml.getModel().getConstraintCount(); i++) { - file = new File(filename.replace(".prism", ".pctl")); - out = new FileWriter(file); - out.write(SBMLutilities.convertMath2PrismProperty(sbml.getModel().getConstraint(i).getMath())); - out.close(); - } - } - catch (IOException e) { - //TODO: Leandro fix Me - //message.setErrorDialog("Error Writing File", "I/O error when writing PRISM file"); - } - */ + return math; + } } From b8cad2fe4833284d89670042ad3d3b19961800e9 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Thu, 14 Jul 2022 13:15:28 -0600 Subject: [PATCH 04/13] Added comments to SBML2PRISM --- .../async/ibiosim/conversion/SBML2PRISM.java | 49 ++++++++++++++++--- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java index 029d94fbd..b203c6b2d 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -135,6 +135,8 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro // Identify model species for (int i = 0; i < model.getSpeciesCount(); i++) { + // Write out syntax + // For function checkReservedKeywordPrism see below Species species = model.getSpecies(i); out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); out.write("// const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); @@ -144,10 +146,12 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro out.write(" "+ checkReservedKeywordPrism(species.getId()) + " : " + "int init " + (int) (species.getInitialAmount()) + ";\n"); out.write("\n"); + // Iterate over reactions for (int j = 0; j < model.getReactionCount(); j++) { Reaction reaction = model.getReaction(j); + // Identify reactants and products SpeciesReference reactant = reaction.getReactantForSpecies(species.getId()); SpeciesReference product = reaction.getProductForSpecies(species.getId()); @@ -169,8 +173,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro } - // Identify reaction rates - + // Identify reaction rate out.write("// Reaction rates\n"); out.write("module reaction_rates\n"); out.write("\n"); @@ -178,6 +181,8 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro for (int i = 0; i < model.getReactionCount(); i++) { Reaction reaction = model.getReaction(i); + + // Write state transitions out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + ": -> "); for(int j = 0; j < reaction.getProductCount(); j++) { @@ -185,6 +190,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro } out.write("\n"); + // Get the math for the reaction rate out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + " > 0 -> " + "(" + checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + ") : true;\n"); out.write("\n"); @@ -192,11 +198,12 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro out.write("endmodule\n"); out.write("\n"); + + // Identify rewards out.write("// Reward structures (one per species)"); out.write("\n"); - // Identify rewards for (int i = 0; i < model.getSpeciesCount(); i++) { Species species = model.getSpecies(i); @@ -212,6 +219,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro File property = new File(filename.replace(".xml", ".props")); FileWriter property_out = new FileWriter(property); + // Property preamble property_out.write("// File generated by SBML-to-PRISM converter\n"); property_out.write("// Original file: " + filename + "\n"); property_out.write("// @GeneticLogicLab\n"); @@ -219,7 +227,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro for (int i = 0; i < model.getConstraintCount(); i++) { - System.err.println(checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); + // Get and write translation of constraint property_out.write(checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); } @@ -227,16 +235,24 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) thro } - - + + /* + * Check for reserved keywords as species names + * Input: (String) NameOfSpecies + * Output: (String) _NameOfSpecies + * + * Function checks if the name of a species is also a reserved keyword in the prism language. If that is the case, the species name is replaced + * by the species name lead by an underscore. + */ private static String checkReservedKeywordPrism(String speciesname) { - + // List of reserved keywords in the prism language List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", "endinit", "endinvariant", "endmodule", "endobservables", "endrewards", "endsystem", "false", "formula", "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", "max", "mdp", "min", "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", "popta", "probabilistic", "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", "system", "true", "U", "W"); + // Check if species name is in the list if (keywords.contains(speciesname)) { return "_" + speciesname; @@ -244,16 +260,27 @@ private static String checkReservedKeywordPrism(String speciesname) return speciesname; } } - + + /* + * Check for reserved keywords as species names in math properties + * Input: (String) NameOfSpecies, model sbmlDoc.getModel(); + * Output: (String) _NameOfSpecies + * + * Function checks if the name of a species in a math function is also a reserved keyword in the prism language. If that is the case, the species name in the + * function is replaced by the species name lead by an underscore. + */ private static String checkReserveKeywordMath(String math, Model model) { + // List of reserved keywords in the prism language List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", "endinit", "endinvariant", "endmodule", "endobservables", "endrewards", "endsystem", "false", "formula", "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", "max", "mdp", "min", "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", "popta", "probabilistic", "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", "system", "true", "U", "W"); + // Declaration of new string list ArrayList speciesString = new ArrayList(); + // Iterating over species, if species name is a reserved keyword add it to list speciesString for (int i = 0; i < model.getSpeciesCount(); i++) { Species species = model.getSpecies(i); @@ -267,14 +294,20 @@ private static String checkReserveKeywordMath(String math, Model model) { //System.err.println(speciesString); + // Iterate over list and replace species name for(int i = 0; i < keywords.size(); i++) { if(speciesString.contains(keywords.get(i))) { + // Replace species in math equations + // In equations species names are lead by a space String Target = " " + keywords.get(i); //System.err.println(Target); math = math.replace(Target, "_" + keywords.get(i)); //System.err.println(math); + + // Replace species names in property files + // In property files species names are lead by a ( String TargetProperty = "(" + keywords.get(i); math = math.replace(TargetProperty, "(_" + keywords.get(i)); } From 927062edeba43b621f5da610065208d9234c17a5 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Wed, 20 Jul 2022 09:26:09 -0600 Subject: [PATCH 05/13] Bound/Unbound option is now available and works --- .../async/ibiosim/conversion/Converter.java | 7 +- .../async/ibiosim/conversion/SBML2PRISM.java | 571 ++++++++++++------ 2 files changed, 384 insertions(+), 194 deletions(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java index 871707fea..68c00dcdf 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java @@ -106,7 +106,6 @@ private static void usage() System.err.println("\t -env is the complete directory path of the environmental file to instantiate to your model. This only works when VPR model generator is used"); System.err.println("\t-Cello This option is for dynamic modeling of Cello parts and parametrization"); System.err.println("\t-tmID Set the ID of the top SBML model"); - System.err.println("\t-prism SBOL to PRISM converter"); System.exit(1); } @@ -140,6 +139,7 @@ public static void main(String[] args) boolean isValidation = false; //indicate if only validate SBOL files boolean topEnvir = false; // determines if there is a topEnvironment model to be instantiated boolean CelloModel = false; // determines if Cello-based modeling should be done + boolean PrismUnbound = true; // determines if the prism model should be bound or unbound String compFileResult = ""; //-cf String compareFile = ""; //-e @@ -191,6 +191,9 @@ public static void main(String[] args) case "-t": typesInURI = true; break; + case "-bound": + PrismUnbound = false; + break; case "-s": if(index+1 >= args.length || args[index+1].equals("-")) { @@ -427,7 +430,7 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) try { inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null); - SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName); + SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound); } catch (XMLStreamException e) { diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java index b203c6b2d..fea0c77a2 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -68,256 +68,443 @@ import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants; /** - * Perform conversion from SBML to PRISM. + * Perform conversion from SBML to PRISM. * * @author Lukas Buecherl * @author Chris Myers - * @author iBioSim Contributors + * @author iBioSim + * Contributors * @version %I% */ public class SBML2PRISM { - + /* - * Convert SBML to Prism - * Input: SBMLDocument, File - * Output: void + * Convert SBML to Prism Input: SBMLDocument, File Output: void * - * Function takes in a SBML document and writes the prism conversion of the file in the same directory. The function also translates the constraint into - * a properties file that is written in the same directory in a separate file. The original filename is used for the prism and property file. The SBMML - * file ends in .xml, the prism file in .sm, and the properties file in .props. + * Function takes in a SBML document and writes the prism conversion of the file + * in the same directory. The function also translates the constraint into a + * properties file that is written in the same directory in a separate file. The + * original filename is used for the prism and property file. The SBMML file + * ends in .xml, the prism file in .sm, and the properties file in .props. * - * To run the converter use the following command: - * java -jar conversion/target/iBioSim-conversion-3.1.0-SNAPSHOT-jar-with-dependencies.jar -l PRISM YOURSBMLFILE.xml + * To run the converter use the following command: java -jar + * conversion/target/iBioSim-conversion-3.1.0-SNAPSHOT-jar-with-dependencies.jar + * -l PRISM YOURSBMLFILE.xml */ - public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename) throws IOException - { + + public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename, boolean unbound) throws IOException { + + if (unbound) { + convertSBML2PRISMUnbound(sbmlDoc, filename); + } else { + convertSBML2PRISMbound(sbmlDoc, filename); + } + } + + private static void convertSBML2PRISMUnbound(SBMLDocument sbmlDoc, String filename) throws IOException { Model model = sbmlDoc.getModel(); File file = new File(filename.replace(".xml", ".sm")); - - // Opening and writing preamble to the file - FileWriter out = new FileWriter(file); - out.write("// File generated by SBML-to-PRISM converter\n"); - out.write("// Original file: " + filename + "\n"); - out.write("// @GeneticLogicLab\n"); - out.write("\n"); - out.write("ctmc\n"); + + // Opening and writing preamble to the file + FileWriter out = new FileWriter(file); + out.write("// File generated by SBML-to-PRISM converter\n"); + out.write("// Original file: " + filename + "\n"); + out.write("// @GeneticLogicLab\n"); + out.write("\n"); + out.write("ctmc\n"); + out.write("\n"); + + out.write("// const int MAX_AMOUNT = ADD VALUE \n"); + out.write("\n"); + + // Identify compartments and their size + out.write("// Compartment size\n"); + + for (int i = 0; i < model.getCompartmentCount(); i++) { + Compartment compartment = model.getCompartment(i); + out.write("const double " + checkReservedKeywordPrism(compartment.getId()) + " = " + compartment.getSize() + + ";\n"); + + } + + out.write("\n"); + + // Identify model parameters + out.write("// Model parameters\n"); + + for (int i = 0; i < model.getParameterCount(); i++) { + Parameter parameter = model.getParameter(i); + out.write("const double " + checkReservedKeywordPrism(parameter.getId()) + " = " + parameter.getValue() + + "; // " + parameter.getName() + "\n"); // if not null name + + } + + out.write("\n"); + + // Identify model species + for (int i = 0; i < model.getSpeciesCount(); i++) { + // Write out syntax + // For function checkReservedKeywordPrism see below + Species species = model.getSpecies(i); + out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("// const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); + out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); out.write("\n"); - - - out.write("// const int MAX_AMOUNT = ADD VALUE \n"); + out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." + + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() + + ";\n"); + out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " + + (int) (species.getInitialAmount()) + ";\n"); out.write("\n"); - - // Identify compartments and their size - out.write("// Compartment size\n"); - - for (int i = 0; i < model.getCompartmentCount(); i++) - { - Compartment compartment = model.getCompartment(i); - out.write("const double " + checkReservedKeywordPrism(compartment.getId()) + " = " + compartment.getSize() + ";\n"); - + + // Iterate over reactions + for (int j = 0; j < model.getReactionCount(); j++) { + Reaction reaction = model.getReaction(j); + + // Identify reactants and products + SpeciesReference reactant = reaction.getReactantForSpecies(species.getId()); + SpeciesReference product = reaction.getProductForSpecies(species.getId()); + + if (reactant != null) { + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReservedKeywordPrism(species.getId()) + " > " + + (int) (reactant.getStoichiometry() - 1) + " -> (" + + checkReservedKeywordPrism(species.getId()) + "\'=" + + checkReservedKeywordPrism(species.getId()) + "-" + (int) reactant.getStoichiometry() + + ");\n"); + } else if (product != null) { + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReservedKeywordPrism(species.getId()) + " >= " + "0 -> (" + + checkReservedKeywordPrism(species.getId()) + "\'=" + + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() + + ");\n"); + } + } - + out.write("\n"); - - - // Identify model parameters - out.write("// Model parameters\n"); - - for (int i = 0; i < model.getParameterCount(); i++) - { - Parameter parameter = model.getParameter(i); - out.write("const double "+ checkReservedKeywordPrism(parameter.getId()) + " = " + parameter.getValue() +"; // " + parameter.getName() + "\n"); // if not null name - + out.write("endmodule\n"); + out.write("\n"); + + } + + // Identify reaction rate + out.write("// Reaction rates\n"); + out.write("module reaction_rates\n"); + out.write("\n"); + + for (int i = 0; i < model.getReactionCount(); i++) { + Reaction reaction = model.getReaction(i); + + // Write state transitions + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + ": -> "); + for (int j = 0; j < reaction.getProductCount(); j++) { + out.write(checkReservedKeywordPrism(reaction.getProduct(j).getSpecies()) + " "); } - out.write("\n"); - - // Identify model species - for (int i = 0; i < model.getSpeciesCount(); i++) - { - // Write out syntax - // For function checkReservedKeywordPrism see below - Species species = model.getSpecies(i); - out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("// const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); - out.write("module "+ checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("\n"); - out.write(" // "+ checkReservedKeywordPrism(species.getId()) +" : " + "[0.." + checkReservedKeywordPrism(species.getId()) + "_MAX] init "+ (int) species.getInitialAmount() + ";\n"); - out.write(" "+ checkReservedKeywordPrism(species.getId()) + " : " + "int init " + (int) (species.getInitialAmount()) + ";\n"); - out.write("\n"); - - // Iterate over reactions - for (int j = 0; j < model.getReactionCount(); j++) - { - Reaction reaction = model.getReaction(j); - - // Identify reactants and products - SpeciesReference reactant = reaction.getReactantForSpecies(species.getId()); - SpeciesReference product = reaction.getProductForSpecies(species.getId()); - - if(reactant != null) - { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + checkReservedKeywordPrism(species.getId()) + " > " + (int) (reactant.getStoichiometry() - 1) + " -> (" + checkReservedKeywordPrism(species.getId()) + "\'=" + checkReservedKeywordPrism(species.getId()) + "-" + (int) reactant.getStoichiometry() + ");\n"); - } else if (product != null) - { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + checkReservedKeywordPrism(species.getId()) + " >= " + "0 -> (" + checkReservedKeywordPrism(species.getId()) + "\'=" + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() + ");\n"); - } - - } - - out.write("\n"); - out.write("endmodule\n"); - out.write("\n"); + // Get the math for the reaction rate + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReserveKeywordMath( + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + + " > 0 -> " + "(" + + checkReserveKeywordMath( + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + + ") : true;\n"); + out.write("\n"); + + } + out.write("endmodule\n"); + + out.write("\n"); + + // Identify rewards + out.write("// Reward structures (one per species)"); + out.write("\n"); + + for (int i = 0; i < model.getSpeciesCount(); i++) { + Species species = model.getSpecies(i); + + out.write("// Reward " + (i + 1) + ": " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("rewards " + "\"" + checkReservedKeywordPrism(species.getId()) + "\" true : " + + checkReservedKeywordPrism(species.getId()) + "; endrewards\n"); + + } + + out.close(); + + // Write Properties File + File property = new File(filename.replace(".xml", ".props")); + FileWriter property_out = new FileWriter(property); + + // Property preamble + property_out.write("// File generated by SBML-to-PRISM converter\n"); + property_out.write("// Original file: " + filename + "\n"); + property_out.write("// @GeneticLogicLab\n"); + property_out.write("\n"); + + for (int i = 0; i < model.getConstraintCount(); i++) { + // Get and write translation of constraint + property_out.write(checkReserveKeywordMath( + SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); + } + + property_out.close(); + + } + + private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename) throws IOException { + Model model = sbmlDoc.getModel(); + File file = new File(filename.replace(".xml", ".sm")); + + // Opening and writing preamble to the file + FileWriter out = new FileWriter(file); + out.write("// File generated by SBML-to-PRISM converter\n"); + out.write("// Original file: " + filename + "\n"); + out.write("// @GeneticLogicLab\n"); + out.write("\n"); + out.write("ctmc\n"); + out.write("\n"); + + double maxAmount = 0.0; + for (int i = 0; i < model.getSpeciesCount(); i++) { + Species species = model.getSpecies(i); + if (species.getInitialAmount() > maxAmount) { + maxAmount = species.getInitialAmount(); } - - // Identify reaction rate - out.write("// Reaction rates\n"); - out.write("module reaction_rates\n"); + } + + out.write(" const int MAX_AMOUNT = " + (int) maxAmount + ";\n"); + out.write("\n"); + + // Identify compartments and their size + out.write("// Compartment size\n"); + + for (int i = 0; i < model.getCompartmentCount(); i++) { + Compartment compartment = model.getCompartment(i); + out.write("const double " + checkReservedKeywordPrism(compartment.getId()) + " = " + compartment.getSize() + + ";\n"); + + } + + out.write("\n"); + + // Identify model parameters + out.write("// Model parameters\n"); + + for (int i = 0; i < model.getParameterCount(); i++) { + Parameter parameter = model.getParameter(i); + out.write("const double " + checkReservedKeywordPrism(parameter.getId()) + " = " + parameter.getValue() + + "; // " + parameter.getName() + "\n"); // if not null name + + } + + out.write("\n"); + + // Identify model species + for (int i = 0; i < model.getSpeciesCount(); i++) { + + // Write out syntax + // For function checkReservedKeywordPrism see below + Species species = model.getSpecies(i); + out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); + out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("\n"); + out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." + + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() + + ";\n"); + out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " + + (int) (species.getInitialAmount()) + ";\n"); out.write("\n"); - - for (int i = 0; i < model.getReactionCount(); i++) - { - Reaction reaction = model.getReaction(i); - - // Write state transitions - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + ": -> "); - for(int j = 0; j < reaction.getProductCount(); j++) - { - out.write(checkReservedKeywordPrism(reaction.getProduct(j).getSpecies()) + " "); + + // Iterate over reactions + for (int j = 0; j < model.getReactionCount(); j++) { + Reaction reaction = model.getReaction(j); + + // Identify reactants and products + SpeciesReference reactant = reaction.getReactantForSpecies(species.getId()); + SpeciesReference product = reaction.getProductForSpecies(species.getId()); + + if (reactant != null) { + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReservedKeywordPrism(species.getId()) + " > " + + (int) (reactant.getStoichiometry() - 1) + " -> (" + + checkReservedKeywordPrism(species.getId()) + "\'=" + + checkReservedKeywordPrism(species.getId()) + "-" + (int) reactant.getStoichiometry() + + ");\n"); + } else if (product != null) { + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReservedKeywordPrism(species.getId()) + " <= " + checkReservedKeywordPrism(species.getId()) + "_MAX-" + + (int) product.getStoichiometry() + " -> (" + + checkReservedKeywordPrism(species.getId()) + "\'=" + + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() + + ");\n"); } - out.write("\n"); - - // Get the math for the reaction rate - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + " > 0 -> " + "(" + checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + ") : true;\n"); - out.write("\n"); } - out.write("endmodule\n"); - + out.write("\n"); - - // Identify rewards - out.write("// Reward structures (one per species)"); + out.write("endmodule\n"); out.write("\n"); + } - - for (int i = 0; i < model.getSpeciesCount(); i++) - { - Species species = model.getSpecies(i); - - out.write("// Reward " + (i+1) + ": " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("rewards " + "\"" + checkReservedKeywordPrism(species.getId()) + "\" true : " + checkReservedKeywordPrism(species.getId()) + "; endrewards\n"); - - } + // Identify reaction rate + out.write("// Reaction rates\n"); + out.write("module reaction_rates\n"); + out.write("\n"); - out.close(); - - // Write Properties File - File property = new File(filename.replace(".xml", ".props")); - FileWriter property_out = new FileWriter(property); - - // Property preamble - property_out.write("// File generated by SBML-to-PRISM converter\n"); - property_out.write("// Original file: " + filename + "\n"); - property_out.write("// @GeneticLogicLab\n"); - property_out.write("\n"); - - for (int i = 0; i < model.getConstraintCount(); i++) - { - // Get and write translation of constraint - property_out.write(checkReserveKeywordMath(SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); + for (int i = 0; i < model.getReactionCount(); i++) { + Reaction reaction = model.getReaction(i); + + // Write state transitions + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + ": -> "); + for (int j = 0; j < reaction.getProductCount(); j++) { + out.write(checkReservedKeywordPrism(reaction.getProduct(j).getSpecies()) + " "); } - - property_out.close(); - + out.write("\n"); + + // Get the math for the reaction rate + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReserveKeywordMath( + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + + " > 0 -> " + "(" + + checkReserveKeywordMath( + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) + + ") : true;\n"); + out.write("\n"); + + } + out.write("endmodule\n"); + + out.write("\n"); + + // Identify rewards + out.write("// Reward structures (one per species)"); + out.write("\n"); + + for (int i = 0; i < model.getSpeciesCount(); i++) { + Species species = model.getSpecies(i); + + out.write("// Reward " + (i + 1) + ": " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("rewards " + "\"" + checkReservedKeywordPrism(species.getId()) + "\" true : " + + checkReservedKeywordPrism(species.getId()) + "; endrewards\n"); + + } + + out.close(); + + // Write Properties File + File property = new File(filename.replace(".xml", ".props")); + FileWriter property_out = new FileWriter(property); + + // Property preamble + property_out.write("// File generated by SBML-to-PRISM converter\n"); + property_out.write("// Original file: " + filename + "\n"); + property_out.write("// @GeneticLogicLab\n"); + property_out.write("\n"); + + for (int i = 0; i < model.getConstraintCount(); i++) { + // Get and write translation of constraint + property_out.write(checkReserveKeywordMath( + SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); + } + + property_out.close(); + } - - + /* - * Check for reserved keywords as species names - * Input: (String) NameOfSpecies + * Check for reserved keywords as species names Input: (String) NameOfSpecies * Output: (String) _NameOfSpecies * - * Function checks if the name of a species is also a reserved keyword in the prism language. If that is the case, the species name is replaced - * by the species name lead by an underscore. + * Function checks if the name of a species is also a reserved keyword in the + * prism language. If that is the case, the species name is replaced by the + * species name lead by an underscore. */ - private static String checkReservedKeywordPrism(String speciesname) - { - // List of reserved keywords in the prism language - List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", "endinit", "endinvariant", "endmodule", - "endobservables", "endrewards", "endsystem", "false", "formula", "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", - "max", "mdp", "min", "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", "popta", "probabilistic", - "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", "system", "true", "U", "W"); - + private static String checkReservedKeywordPrism(String speciesname) { + // List of reserved keywords in the prism language + List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", + "endinit", "endinvariant", "endmodule", "endobservables", "endrewards", "endsystem", "false", "formula", + "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", "max", "mdp", "min", + "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", + "popta", "probabilistic", "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", + "system", "true", "U", "W"); + // Check if species name is in the list - if (keywords.contains(speciesname)) - { + if (keywords.contains(speciesname)) { return "_" + speciesname; - }else { + } else { return speciesname; } } - + /* - * Check for reserved keywords as species names in math properties - * Input: (String) NameOfSpecies, model sbmlDoc.getModel(); - * Output: (String) _NameOfSpecies + * Check for reserved keywords as species names in math properties Input: + * (String) NameOfSpecies, model sbmlDoc.getModel(); Output: (String) + * _NameOfSpecies * - * Function checks if the name of a species in a math function is also a reserved keyword in the prism language. If that is the case, the species name in the - * function is replaced by the species name lead by an underscore. + * Function checks if the name of a species in a math function is also a + * reserved keyword in the prism language. If that is the case, the species name + * in the function is replaced by the species name lead by an underscore. */ private static String checkReserveKeywordMath(String math, Model model) { - - // List of reserved keywords in the prism language - List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", "endinit", "endinvariant", "endmodule", - "endobservables", "endrewards", "endsystem", "false", "formula", "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", - "max", "mdp", "min", "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", "popta", "probabilistic", - "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", "system", "true", "U", "W"); - - // Declaration of new string list + + // List of reserved keywords in the prism language + List keywords = Arrays.asList("A", "bool", "clock", "const", "ctmc", "C", "double", "dtmc", "E", + "endinit", "endinvariant", "endmodule", "endobservables", "endrewards", "endsystem", "false", "formula", + "filter", "func", "F", "global", "G", "init", "invariant", "I", "int", "label", "max", "mdp", "min", + "module", "X", "nondeterministic", "observable", "observables", "of", "Pmax", "Pmin", "P", "pomdp", + "popta", "probabilistic", "prob", "pta", "rate", "rewards", "Rmax", "Rmin", "R", "S", "stochastic", + "system", "true", "U", "W"); + + // Declaration of new string list ArrayList speciesString = new ArrayList(); - - // Iterating over species, if species name is a reserved keyword add it to list speciesString - for (int i = 0; i < model.getSpeciesCount(); i++) - { + + // Iterating over species, if species name is a reserved keyword add it to list + // speciesString + for (int i = 0; i < model.getSpeciesCount(); i++) { Species species = model.getSpecies(i); - - if(keywords.contains(species.getId())) - { + + if (keywords.contains(species.getId())) { speciesString.add(species.getId()); } - + } - - //System.err.println(speciesString); - - // Iterate over list and replace species name - for(int i = 0; i < keywords.size(); i++) - { - if(speciesString.contains(keywords.get(i))) - { + + // System.err.println(speciesString); + + // Iterate over list and replace species name + for (int i = 0; i < keywords.size(); i++) { + if (speciesString.contains(keywords.get(i))) { // Replace species in math equations // In equations species names are lead by a space String Target = " " + keywords.get(i); - //System.err.println(Target); + // System.err.println(Target); math = math.replace(Target, "_" + keywords.get(i)); - //System.err.println(math); - + // System.err.println(math); + // Replace species names in property files - // In property files species names are lead by a ( + // In property files species names are lead by a ( String TargetProperty = "(" + keywords.get(i); math = math.replace(TargetProperty, "(_" + keywords.get(i)); } - - } - - + + } + return math; } - + } +/* +BioModel bioModel = BioModel.createBioModel(properties.getDirectory(), this); +bioModel.load(filename); +if (bioModel.flattenModel(true) != null) {} +bioModel.getSBMLDocument() +*/ From 1c24b1edc523ba122db29eba5e21afb759d039be Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Thu, 21 Jul 2022 14:08:19 -0600 Subject: [PATCH 06/13] Initial work on hierarchy support --- .../ece/async/ibiosim/conversion/Converter.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java index 68c00dcdf..de907fc5c 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java @@ -33,11 +33,13 @@ import org.virtualparts.VPRException; import org.virtualparts.VPRTripleStoreException; +// import edu.utah.ece.async.ibiosim.analysis.properties.AnalysisProperties; import edu.utah.ece.async.ibiosim.dataModels.biomodel.parser.BioModel; import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.SBMLutilities; import edu.utah.ece.async.ibiosim.dataModels.sbol.SBOLUtility; import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException; import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.SBOLException; +import edu.utah.ece.async.ibiosim.dataModels.util.observe.BioObservable; import org.sbml.jsbml.ext.comp.CompModelPlugin; import org.sbml.jsbml.ext.comp.CompSBMLDocumentPlugin; @@ -427,10 +429,24 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) { SBMLDocument inputSBMLDoc; + try { inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null); + /* + File path = new File(fullInputFileName); + BioObservable p = null; + BioModel bioModel = BioModel.createBioModel(path.getParent(), p); + bioModel.load(fullInputFileName); + + if (bioModel.flattenModel(true) != null) { + SBMLDocument sbml = bioModel.flattenModel(true); + SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound); + } + */ + SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound); + } catch (XMLStreamException e) { From 8cffc3062bd9944987fe7e7f74ac218051333a89 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Mon, 25 Jul 2022 13:28:58 -0600 Subject: [PATCH 07/13] Flatten works --- .../async/ibiosim/conversion/Converter.java | 109 +++++++++++++----- .../dataModels/biomodel/parser/BioModel.java | 2 +- .../biomodel/util/SBMLutilities.java | 3 +- 3 files changed, 84 insertions(+), 30 deletions(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java index de907fc5c..04e9c51c7 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java @@ -19,9 +19,11 @@ import java.net.URI; import java.util.HashMap; import java.util.HashSet; +import java.lang.reflect.Method; import javax.xml.stream.XMLStreamException; +import org.sbml.jsbml.Model; import org.sbml.jsbml.SBMLDocument; import org.sbml.jsbml.SBMLException; import org.sbml.jsbml.SBMLWriter; @@ -110,7 +112,7 @@ private static void usage() System.err.println("\t-tmID Set the ID of the top SBML model"); System.exit(1); } - + /** * The main method. @@ -142,7 +144,7 @@ public static void main(String[] args) boolean topEnvir = false; // determines if there is a topEnvironment model to be instantiated boolean CelloModel = false; // determines if Cello-based modeling should be done boolean PrismUnbound = true; // determines if the prism model should be bound or unbound - + String compFileResult = ""; //-cf String compareFile = ""; //-e String mainFileResult = ""; //-mf @@ -156,7 +158,7 @@ public static void main(String[] args) String urlVPR = ""; //The specified synbiohub repository the user wants VPR model generator to connect to. String environment =""; String topModelId = null; - + HashSet ref_sbolInputFilePath = new HashSet(); //rsbol int index = 0; @@ -428,25 +430,76 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) if(inputIsSBML && prismOut) { SBMLDocument inputSBMLDoc; - - + + try { - inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null); /* + org.sbml.libsbml.SBMLReader reader = new org.sbml.libsbml.SBMLReader(); + org.sbml.libsbml.SBMLDocument document = reader.readSBML(fullInputFileName); + document.setPackageRequired("comp", true); + org.sbml.libsbml.CompModelPlugin sbmlCompModel = (org.sbml.libsbml.CompModelPlugin) document.getModel().getPlugin("comp"); + long numSubModels = sbmlCompModel.getNumSubmodels(); + System.err.println(numSubModels); + */ + + inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null); + //SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound); + File path = new File(fullInputFileName); - BioObservable p = null; - BioModel bioModel = BioModel.createBioModel(path.getParent(), p); + BioModel bioModel = new BioModel(path.getParent()); bioModel.load(fullInputFileName); + bioModel.createCompPlugin(); + System.err.println(bioModel.getListOfSubmodels()); + if(bioModel.getListOfSubmodels().isEmpty()) + { + SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound); + }else { + if (bioModel.flattenModel(true) != null) { + SBMLDocument sbml = bioModel.flattenModel(true); + SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound); + } + } + + /* if (bioModel.flattenModel(true) != null) { SBMLDocument sbml = bioModel.flattenModel(true); + //SBMLDocument sbml = bioModel.getSBMLDocument(); + //System.err.println(inputSBMLDoc.equals(inputSBMLDoc)); + //System.err.println(sbml.equals(sbml)); + //System.err.println(sbml.equals(sbml)); SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound); - } + } + */ - - SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound); - + + + /* + File path = new File(fullInputFileName); + // BioObservable p = null; + // BioModel bioModel = BioModel.createBioModel(path.getParent(), p); + BioModel bioModel = new BioModel(path.getParent()); + bioModel.load(fullInputFileName); + + + + + + + + + if (bioModel.flattenModel(true) != null) { + //SBMLDocument sbml = bioModel.flattenModel(true); + SBMLDocument sbml = bioModel.getSBMLDocument(); + //System.err.println(inputSBMLDoc.equals(inputSBMLDoc)); + //System.err.println(sbml.equals(sbml)); + //System.err.println(sbml.equals(sbml)); + //SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound); + } + + */ + } catch (XMLStreamException e) { @@ -461,7 +514,7 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) catch (BioSimException e) { System.err.println("ERROR: Invalid SBML file"); } - + }else if(inputIsSBML) { SBOLDocument outSBOLDoc = new SBOLDocument(); @@ -546,13 +599,13 @@ else if(inputIsSBOL) String circuit_name = file.getName(); circuit_name = circuit_name.replace(".xml", ""); String vpr_output = circuit_name + "_topModule"; - + if(!topLevelURIStr.isEmpty()) { if (doVPR) { TopLevel top = sbolDoc.getTopLevel(URI.create(topLevelURIStr)); SBOLDocument newSbolDoc = sbolDoc.createRecursiveCopy(top); - + try { newSbolDoc = VPRModelGenerator.generateModel(urlVPR, newSbolDoc, vpr_output); //newSbolDoc.write("C:\\Users\\elros\\Desktop\\TestingConverter\\VPRoutput.xml"); @@ -565,18 +618,18 @@ else if(inputIsSBOL) e.printStackTrace(); } //generateSBMLFromSBOL(newSbolDoc, outputDir); - + for (ModuleDefinition moduleDef : newSbolDoc.getRootModuleDefinitions()) { HashMap models = SBOL2SBML.generateModel(outputDir, moduleDef, newSbolDoc, CelloModel); SBMLutilities.exportSBMLModels(models, outputDir, outputFileName, noOutput, sbmlOut, singleSBMLOutput); } } - + else { - ModuleDefinition topModuleDef = sbolDoc.getModuleDefinition(URI.create(topLevelURIStr)); - HashMap models = SBOL2SBML.generateModel(outputDir, topModuleDef, sbolDoc, CelloModel); - SBMLutilities.exportSBMLModels(models, outputDir, outputFileName, noOutput, sbmlOut, singleSBMLOutput); + ModuleDefinition topModuleDef = sbolDoc.getModuleDefinition(URI.create(topLevelURIStr)); + HashMap models = SBOL2SBML.generateModel(outputDir, topModuleDef, sbolDoc, CelloModel); + SBMLutilities.exportSBMLModels(models, outputDir, outputFileName, noOutput, sbmlOut, singleSBMLOutput); } } else @@ -594,20 +647,20 @@ else if(inputIsSBOL) e.printStackTrace(); } } - + for (ModuleDefinition moduleDef : sbolDoc.getRootModuleDefinitions()) { HashMap models = SBOL2SBML.generateModel(outputDir, moduleDef, sbolDoc, CelloModel); SBMLutilities.exportSBMLModels(models, outputDir, outputFileName, noOutput, sbmlOut, singleSBMLOutput); } } - + if (topModelId != null) { SBMLDocument topModel = SBMLutilities.readSBML(vpr_output+".xml", null, null); topModel.getModel().setId(topModelId); SBMLWriter writer = new SBMLWriter(); try { - //SBMLutilities.removeUnusedNamespaces(sbml); + //SBMLutilities.removeUnusedNamespaces(sbml); writer.writeSBMLToFile(topModel, outputDir + File.separator + topModelId + ".xml"); } catch (SBMLException e) { @@ -620,26 +673,26 @@ else if(inputIsSBOL) e.printStackTrace(); } } - + if (doVPR) { if (topEnvir) { SBMLDocument topEnvironment = SBMLutilities.readSBML(environment, null, null); - - + + CompSBMLDocumentPlugin docPlugin = (CompSBMLDocumentPlugin) topEnvironment.getPlugin("comp"); ExternalModelDefinition exte = docPlugin.getExternalModelDefinition("TopModel"); exte.setId(vpr_output); exte.setSource(vpr_output + ".xml"); //exte.setId("topModule"); //exte.setSource("topModule.xml"); - + CompModelPlugin SBMLplugin = (CompModelPlugin) topEnvironment.getModel().getPlugin("comp"); Submodel top = SBMLplugin.getSubmodel("C1"); top.setModelRef(vpr_output); //top.setModelRef("topModule"); SBMLWriter writing = new SBMLWriter(); - + writing.writeSBMLToFile(topEnvironment, outputDir + File.separator + "Simulation_Environment.xml"); } } diff --git a/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java b/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java index fd30e5812..02fa4071a 100644 --- a/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java +++ b/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/parser/BioModel.java @@ -6399,7 +6399,7 @@ private void expandListOfSubmodels(org.sbml.libsbml.CompModelPlugin docCompModel } } - private ArrayList getListOfSubmodels() throws XMLStreamException, IOException, BioSimException { + public ArrayList getListOfSubmodels() throws XMLStreamException, IOException, BioSimException { // Changed private to public (Lukas) ArrayList comps = new ArrayList(); if (this.getGridEnabledFromFile(filename.replace(".gcm",".xml"))) { diff --git a/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/util/SBMLutilities.java b/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/util/SBMLutilities.java index 07434666c..42b0340ec 100644 --- a/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/util/SBMLutilities.java +++ b/dataModels/src/main/java/edu/utah/ece/async/ibiosim/dataModels/biomodel/util/SBMLutilities.java @@ -1968,7 +1968,8 @@ else if (math.getType() == ASTNode.Type.POWER) { String leftStr = convertMath2PrismProperty(math.getLeftChild()); String rightStr = convertMath2PrismProperty(math.getRightChild()); - return "(" + leftStr + " ^ " + rightStr + ")"; + //return "(" + leftStr + " ^ " + rightStr + ")"; + return "pow(" + leftStr + " , " + rightStr + ")"; } else if (math.getType() == ASTNode.Type.RATIONAL) { From a93e650de24d3db9bc5eb63aafbce9d923d19c24 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Mon, 25 Jul 2022 13:39:02 -0600 Subject: [PATCH 08/13] refactor --- .../async/ibiosim/conversion/Converter.java | 58 +++---------------- 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java index 04e9c51c7..9aa121d35 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/Converter.java @@ -434,72 +434,28 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) try { - /* - org.sbml.libsbml.SBMLReader reader = new org.sbml.libsbml.SBMLReader(); - org.sbml.libsbml.SBMLDocument document = reader.readSBML(fullInputFileName); - document.setPackageRequired("comp", true); - org.sbml.libsbml.CompModelPlugin sbmlCompModel = (org.sbml.libsbml.CompModelPlugin) document.getModel().getPlugin("comp"); - long numSubModels = sbmlCompModel.getNumSubmodels(); - System.err.println(numSubModels); - */ - + // Read in the SBML inputSBMLDoc = SBMLutilities.readSBML(fullInputFileName, null, null); - //SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound); + // Create BioModel to allow flattening File path = new File(fullInputFileName); BioModel bioModel = new BioModel(path.getParent()); bioModel.load(fullInputFileName); - bioModel.createCompPlugin(); - System.err.println(bioModel.getListOfSubmodels()); + // Check if BioModel is hierarchical by checking the number of submodels + bioModel.createCompPlugin(); if(bioModel.getListOfSubmodels().isEmpty()) { + // Not hierarchical SBML2PRISM.convertSBML2PRISM(inputSBMLDoc, fullInputFileName, PrismUnbound); }else { + // hierarchical, therefore flatten model if (bioModel.flattenModel(true) != null) { SBMLDocument sbml = bioModel.flattenModel(true); SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound); } } - /* - if (bioModel.flattenModel(true) != null) { - SBMLDocument sbml = bioModel.flattenModel(true); - //SBMLDocument sbml = bioModel.getSBMLDocument(); - //System.err.println(inputSBMLDoc.equals(inputSBMLDoc)); - //System.err.println(sbml.equals(sbml)); - //System.err.println(sbml.equals(sbml)); - SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound); - } - - */ - - - /* - File path = new File(fullInputFileName); - // BioObservable p = null; - // BioModel bioModel = BioModel.createBioModel(path.getParent(), p); - BioModel bioModel = new BioModel(path.getParent()); - bioModel.load(fullInputFileName); - - - - - - - - - if (bioModel.flattenModel(true) != null) { - //SBMLDocument sbml = bioModel.flattenModel(true); - SBMLDocument sbml = bioModel.getSBMLDocument(); - //System.err.println(inputSBMLDoc.equals(inputSBMLDoc)); - //System.err.println(sbml.equals(sbml)); - //System.err.println(sbml.equals(sbml)); - //SBML2PRISM.convertSBML2PRISM(sbml, fullInputFileName, PrismUnbound); - } - - */ - } catch (XMLStreamException e) { @@ -508,7 +464,7 @@ else if(outputFileName.isEmpty() && !noOutput && !isValidation && !isDiffFile) } catch (IOException e) { - System.err.println("ERROR: Unable to read or write file"); + System.err.println("ERROR: Unable to read or write prism file"); e.printStackTrace(); } catch (BioSimException e) { From 4bf6c6e1e667dc4d9bb03e37cfa3d9acac3a95e9 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Mon, 25 Jul 2022 14:27:39 -0600 Subject: [PATCH 09/13] Refactor code for SBML2PRISM --- .../async/ibiosim/conversion/SBML2PRISM.java | 311 +++++------------- 1 file changed, 76 insertions(+), 235 deletions(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java index fea0c77a2..d3704d084 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -14,58 +14,23 @@ package edu.utah.ece.async.ibiosim.conversion; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileWriter; -import java.io.FilenameFilter; import java.io.IOException; -import java.net.URI; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; -import java.util.LinkedList; import java.util.List; -import java.util.Set; -import javax.xml.stream.XMLStreamException; import org.sbml.jsbml.Compartment; import org.sbml.jsbml.Model; -import org.sbml.jsbml.ModifierSpeciesReference; import org.sbml.jsbml.Parameter; import org.sbml.jsbml.Reaction; import org.sbml.jsbml.SBMLDocument; -import org.sbml.jsbml.SBMLReader; import org.sbml.jsbml.Species; import org.sbml.jsbml.SpeciesReference; -import org.sbml.jsbml.ext.comp.CompModelPlugin; -import org.sbml.jsbml.ext.comp.CompSBMLDocumentPlugin; -import org.sbml.jsbml.ext.comp.CompSBasePlugin; -import org.sbml.jsbml.ext.comp.ExternalModelDefinition; -import org.sbml.jsbml.ext.comp.ReplacedBy; -import org.sbml.jsbml.ext.comp.ReplacedElement; -import org.sbolstandard.core2.AccessType; -import org.sbolstandard.core2.ComponentDefinition; -import org.sbolstandard.core2.DirectionType; -import org.sbolstandard.core2.EDAMOntology; -import org.sbolstandard.core2.FunctionalComponent; -import org.sbolstandard.core2.Interaction; -import org.sbolstandard.core2.Module; -import org.sbolstandard.core2.ModuleDefinition; -import org.sbolstandard.core2.RefinementType; -import org.sbolstandard.core2.SBOLConversionException; -import org.sbolstandard.core2.SBOLDocument; -import org.sbolstandard.core2.SBOLReader; -import org.sbolstandard.core2.SBOLValidationException; -import org.sbolstandard.core2.Sequence; -import org.sbolstandard.core2.SequenceOntology; -import org.sbolstandard.core2.SystemsBiologyOntology; -import org.sbolstandard.core2.TopLevel; - -import edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.AnnotationUtility; -import edu.utah.ece.async.ibiosim.dataModels.biomodel.parser.BioModel; + import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.SBMLutilities; -import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants; + /** * Perform conversion from SBML to PRISM. @@ -76,10 +41,11 @@ * Contributors * @version %I% */ + public class SBML2PRISM { /* - * Convert SBML to Prism Input: SBMLDocument, File Output: void + * Convert SBML to Prism. Input: SBMLDocument, File, bound. Output: void * * Function takes in a SBML document and writes the prism conversion of the file * in the same directory. The function also translates the constraint into a @@ -90,18 +56,12 @@ public class SBML2PRISM { * To run the converter use the following command: java -jar * conversion/target/iBioSim-conversion-3.1.0-SNAPSHOT-jar-with-dependencies.jar * -l PRISM YOURSBMLFILE.xml + * + * The function also allows the translation into a bound model by simply adding the flag + * -bound */ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename, boolean unbound) throws IOException { - - if (unbound) { - convertSBML2PRISMUnbound(sbmlDoc, filename); - } else { - convertSBML2PRISMbound(sbmlDoc, filename); - } - } - - private static void convertSBML2PRISMUnbound(SBMLDocument sbmlDoc, String filename) throws IOException { Model model = sbmlDoc.getModel(); File file = new File(filename.replace(".xml", ".sm")); @@ -113,172 +73,24 @@ private static void convertSBML2PRISMUnbound(SBMLDocument sbmlDoc, String filena out.write("\n"); out.write("ctmc\n"); out.write("\n"); - - out.write("// const int MAX_AMOUNT = ADD VALUE \n"); - out.write("\n"); - - // Identify compartments and their size - out.write("// Compartment size\n"); - - for (int i = 0; i < model.getCompartmentCount(); i++) { - Compartment compartment = model.getCompartment(i); - out.write("const double " + checkReservedKeywordPrism(compartment.getId()) + " = " + compartment.getSize() - + ";\n"); - - } - - out.write("\n"); - - // Identify model parameters - out.write("// Model parameters\n"); - - for (int i = 0; i < model.getParameterCount(); i++) { - Parameter parameter = model.getParameter(i); - out.write("const double " + checkReservedKeywordPrism(parameter.getId()) + " = " + parameter.getValue() - + "; // " + parameter.getName() + "\n"); // if not null name - - } - - out.write("\n"); - - // Identify model species - for (int i = 0; i < model.getSpeciesCount(); i++) { - // Write out syntax - // For function checkReservedKeywordPrism see below - Species species = model.getSpecies(i); - out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("// const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); - out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("\n"); - out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." - + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() - + ";\n"); - out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " - + (int) (species.getInitialAmount()) + ";\n"); + + // Set bound limit if bound model is selected + if (unbound) { + out.write("// const int MAX_AMOUNT = ADD VALUE \n"); out.write("\n"); - - // Iterate over reactions - for (int j = 0; j < model.getReactionCount(); j++) { - Reaction reaction = model.getReaction(j); - - // Identify reactants and products - SpeciesReference reactant = reaction.getReactantForSpecies(species.getId()); - SpeciesReference product = reaction.getProductForSpecies(species.getId()); - - if (reactant != null) { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReservedKeywordPrism(species.getId()) + " > " - + (int) (reactant.getStoichiometry() - 1) + " -> (" - + checkReservedKeywordPrism(species.getId()) + "\'=" - + checkReservedKeywordPrism(species.getId()) + "-" + (int) reactant.getStoichiometry() - + ");\n"); - } else if (product != null) { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReservedKeywordPrism(species.getId()) + " >= " + "0 -> (" - + checkReservedKeywordPrism(species.getId()) + "\'=" - + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() - + ");\n"); + } else { + double maxAmount = 0.0; + for (int i = 0; i < model.getSpeciesCount(); i++) { + Species species = model.getSpecies(i); + if (species.getInitialAmount() > maxAmount) { + maxAmount = species.getInitialAmount(); } - } - - out.write("\n"); - out.write("endmodule\n"); - out.write("\n"); - + out.write(" const int MAX_AMOUNT = " + (int) maxAmount + ";\n"); + out.write("\n"); out.write("\n"); } - // Identify reaction rate - out.write("// Reaction rates\n"); - out.write("module reaction_rates\n"); - out.write("\n"); - - for (int i = 0; i < model.getReactionCount(); i++) { - Reaction reaction = model.getReaction(i); - - // Write state transitions - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + ": -> "); - for (int j = 0; j < reaction.getProductCount(); j++) { - out.write(checkReservedKeywordPrism(reaction.getProduct(j).getSpecies()) + " "); - } - out.write("\n"); - - // Get the math for the reaction rate - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReserveKeywordMath( - SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) - + " > 0 -> " + "(" - + checkReserveKeywordMath( - SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) - + ") : true;\n"); - out.write("\n"); - - } - out.write("endmodule\n"); - - out.write("\n"); - - // Identify rewards - out.write("// Reward structures (one per species)"); - out.write("\n"); - - for (int i = 0; i < model.getSpeciesCount(); i++) { - Species species = model.getSpecies(i); - - out.write("// Reward " + (i + 1) + ": " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("rewards " + "\"" + checkReservedKeywordPrism(species.getId()) + "\" true : " - + checkReservedKeywordPrism(species.getId()) + "; endrewards\n"); - - } - - out.close(); - - // Write Properties File - File property = new File(filename.replace(".xml", ".props")); - FileWriter property_out = new FileWriter(property); - - // Property preamble - property_out.write("// File generated by SBML-to-PRISM converter\n"); - property_out.write("// Original file: " + filename + "\n"); - property_out.write("// @GeneticLogicLab\n"); - property_out.write("\n"); - - for (int i = 0; i < model.getConstraintCount(); i++) { - // Get and write translation of constraint - property_out.write(checkReserveKeywordMath( - SBMLutilities.convertMath2PrismProperty(model.getConstraint(i).getMath()), model)); - } - - property_out.close(); - - } - - private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename) throws IOException { - Model model = sbmlDoc.getModel(); - File file = new File(filename.replace(".xml", ".sm")); - - // Opening and writing preamble to the file - FileWriter out = new FileWriter(file); - out.write("// File generated by SBML-to-PRISM converter\n"); - out.write("// Original file: " + filename + "\n"); - out.write("// @GeneticLogicLab\n"); - out.write("\n"); - out.write("ctmc\n"); - out.write("\n"); - - double maxAmount = 0.0; - for (int i = 0; i < model.getSpeciesCount(); i++) { - Species species = model.getSpecies(i); - if (species.getInitialAmount() > maxAmount) { - maxAmount = species.getInitialAmount(); - } - } - - out.write(" const int MAX_AMOUNT = " + (int) maxAmount + ";\n"); - out.write("\n"); - + // Identify compartments and their size out.write("// Compartment size\n"); @@ -286,7 +98,6 @@ private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename Compartment compartment = model.getCompartment(i); out.write("const double " + checkReservedKeywordPrism(compartment.getId()) + " = " + compartment.getSize() + ";\n"); - } out.write("\n"); @@ -305,20 +116,32 @@ private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename // Identify model species for (int i = 0; i < model.getSpeciesCount(); i++) { - // Write out syntax // For function checkReservedKeywordPrism see below Species species = model.getSpecies(i); out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); - out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("\n"); - out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." - + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() - + ";\n"); - out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " - + (int) (species.getInitialAmount()) + ";\n"); - out.write("\n"); + + if (unbound) { + out.write("// const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); + out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("\n"); + out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." + + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() + + ";\n"); + out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " + + (int) (species.getInitialAmount()) + ";\n"); + out.write("\n"); + } else { + out.write("const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); + out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("\n"); + out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." + + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() + + ";\n"); + out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " + + (int) (species.getInitialAmount()) + ";\n"); + out.write("\n"); + } // Iterate over reactions for (int j = 0; j < model.getReactionCount(); j++) { @@ -337,13 +160,24 @@ private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename + checkReservedKeywordPrism(species.getId()) + "-" + (int) reactant.getStoichiometry() + ");\n"); } else if (product != null) { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReservedKeywordPrism(species.getId()) + " <= " + checkReservedKeywordPrism(species.getId()) + "_MAX-" - + (int) product.getStoichiometry() + " -> (" - + checkReservedKeywordPrism(species.getId()) + "\'=" - + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() - + ");\n"); + + if (unbound) { + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReservedKeywordPrism(species.getId()) + " >= " + "0 -> (" + + checkReservedKeywordPrism(species.getId()) + "\'=" + + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() + + ");\n"); + } else { + out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); + out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " + + checkReservedKeywordPrism(species.getId()) + " <= " + checkReservedKeywordPrism(species.getId()) + "_MAX-" + + (int) product.getStoichiometry() + " -> (" + + checkReservedKeywordPrism(species.getId()) + "\'=" + + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() + + ");\n"); + } + } } @@ -351,6 +185,7 @@ private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename out.write("\n"); out.write("endmodule\n"); out.write("\n"); + } // Identify reaction rate @@ -398,6 +233,21 @@ private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename out.close(); + writePRISMProperty(filename, model); + + } + + + /* + * Writes PRISM property Input: (String) filename, (Model) model + * Output: void + * + * Function checks the constraints of a SBML model and translates it + * into the PRISM syntax. The properties are then written into a + * .props file. + */ + private static void writePRISMProperty(String filename, Model model) throws IOException + { // Write Properties File File property = new File(filename.replace(".xml", ".props")); FileWriter property_out = new FileWriter(property); @@ -415,7 +265,6 @@ private static void convertSBML2PRISMbound(SBMLDocument sbmlDoc, String filename } property_out.close(); - } /* @@ -500,11 +349,3 @@ private static String checkReserveKeywordMath(String math, Model model) { } } - - -/* -BioModel bioModel = BioModel.createBioModel(properties.getDirectory(), this); -bioModel.load(filename); -if (bioModel.flattenModel(true) != null) {} -bioModel.getSBMLDocument() -*/ From 4944baf71bc83f69a27c88f6e43917426f6e34f0 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Wed, 21 Sep 2022 08:53:50 -0600 Subject: [PATCH 10/13] Run.java update --- .../src/main/java/edu/utah/ece/async/ibiosim/analysis/Run.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/analysis/src/main/java/edu/utah/ece/async/ibiosim/analysis/Run.java b/analysis/src/main/java/edu/utah/ece/async/ibiosim/analysis/Run.java index 26812f08e..3b4a41381 100644 --- a/analysis/src/main/java/edu/utah/ece/async/ibiosim/analysis/Run.java +++ b/analysis/src/main/java/edu/utah/ece/async/ibiosim/analysis/Run.java @@ -541,8 +541,6 @@ private int executePrism(String filename) throws IOException, InterruptedExcepti this.notifyObservers(message); message.setLog("Saving PRISM Property file:\n" + filename.replace(".xml", ".pctl")); this.notifyObservers(message); - // TODO: LUKAS - // bioModel.convertSBML2PRISM(logFile, filename); LPN.convertLPN2PRISM(logFile, lhpnFile, filename.replace(".xml", ".prism"), bioModel.getSBMLDocument()); Preferences biosimrc = Preferences.userRoot(); String prismCmd = biosimrc.get("biosim.general.prism", ""); From 2674494894f1a1d9f4b1c1142b292c07b3fb0a80 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Mon, 6 Mar 2023 12:20:29 +0000 Subject: [PATCH 11/13] Working --- .../async/ibiosim/conversion/SBML2PRISM.java | 401 +++- prismtest/Circuit0x8E/AmtRpart_module.xml | 380 +++ prismtest/Circuit0x8E/AraCsensor_module.xml | 41 + prismtest/Circuit0x8E/BetIpart_module.xml | 464 ++++ prismtest/Circuit0x8E/HlyIIRpart_module.xml | 508 ++++ prismtest/Circuit0x8E/LacIsensor_module.xml | 41 + prismtest/Circuit0x8E/PhlFpart_module.xml | 464 ++++ prismtest/Circuit0x8E/TetRsensor_module.xml | 41 + prismtest/Circuit0x8E/YFPpart_module.xml | 464 ++++ prismtest/Circuit0x8E/manifest.xml | 18 + prismtest/Circuit0x8E/results.txt | 2 + prismtest/Circuit0x8E/topModel.props | 5 + prismtest/Circuit0x8E/topModel.sm | 518 ++++ prismtest/Circuit0x8E/topModel.xml | 1489 ++++++++++++ prismtest/Circuit0x8E_010to100.xml | 2009 ++++++++++++++++ prismtest/Circuit0x8E_LHF_010to100.xml | 2103 +++++++++++++++++ prismtest/Majority_10_10.xml | 1427 +++++++++++ prismtest/SimpleChem.props | 5 + prismtest/SimpleChem.sm | 65 + prismtest/SimpleChem.xml | 222 ++ prismtest/SimpleHierchyModel/DSensor.xml | 263 +++ prismtest/SimpleHierchyModel/manifest.xml | 10 + prismtest/SimpleHierchyModel/metadata.rdf | 2 + prismtest/SimpleHierchyModel/topModel.props | 4 + prismtest/SimpleHierchyModel/topModel.sm | 97 + prismtest/SimpleHierchyModel/topModel.xml | 132 ++ prismtest/SimplerChem.xml | 139 ++ prismtest/Speed_Independent_10_10.xml | 1770 ++++++++++++++ prismtest/Toggle_10_10.props | 5 + prismtest/Toggle_10_10.sm | 320 +++ prismtest/Toggle_10_10.xml | 1478 ++++++++++++ prismtest/pro.csl | 10 + prismtest/results.txt | 2 + 33 files changed, 14789 insertions(+), 110 deletions(-) create mode 100644 prismtest/Circuit0x8E/AmtRpart_module.xml create mode 100644 prismtest/Circuit0x8E/AraCsensor_module.xml create mode 100644 prismtest/Circuit0x8E/BetIpart_module.xml create mode 100644 prismtest/Circuit0x8E/HlyIIRpart_module.xml create mode 100644 prismtest/Circuit0x8E/LacIsensor_module.xml create mode 100644 prismtest/Circuit0x8E/PhlFpart_module.xml create mode 100644 prismtest/Circuit0x8E/TetRsensor_module.xml create mode 100644 prismtest/Circuit0x8E/YFPpart_module.xml create mode 100644 prismtest/Circuit0x8E/manifest.xml create mode 100644 prismtest/Circuit0x8E/results.txt create mode 100644 prismtest/Circuit0x8E/topModel.props create mode 100644 prismtest/Circuit0x8E/topModel.sm create mode 100644 prismtest/Circuit0x8E/topModel.xml create mode 100644 prismtest/Circuit0x8E_010to100.xml create mode 100644 prismtest/Circuit0x8E_LHF_010to100.xml create mode 100644 prismtest/Majority_10_10.xml create mode 100644 prismtest/SimpleChem.props create mode 100644 prismtest/SimpleChem.sm create mode 100644 prismtest/SimpleChem.xml create mode 100644 prismtest/SimpleHierchyModel/DSensor.xml create mode 100644 prismtest/SimpleHierchyModel/manifest.xml create mode 100644 prismtest/SimpleHierchyModel/metadata.rdf create mode 100644 prismtest/SimpleHierchyModel/topModel.props create mode 100644 prismtest/SimpleHierchyModel/topModel.sm create mode 100644 prismtest/SimpleHierchyModel/topModel.xml create mode 100644 prismtest/SimplerChem.xml create mode 100644 prismtest/Speed_Independent_10_10.xml create mode 100644 prismtest/Toggle_10_10.props create mode 100644 prismtest/Toggle_10_10.sm create mode 100644 prismtest/Toggle_10_10.xml create mode 100644 prismtest/pro.csl create mode 100644 prismtest/results.txt diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java index d3704d084..234565457 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -18,10 +18,12 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; - +import java.util.Map; import org.sbml.jsbml.Compartment; +import org.sbml.jsbml.LocalParameter; import org.sbml.jsbml.Model; import org.sbml.jsbml.Parameter; import org.sbml.jsbml.Reaction; @@ -31,7 +33,6 @@ import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.SBMLutilities; - /** * Perform conversion from SBML to PRISM. * @@ -57,8 +58,8 @@ public class SBML2PRISM { * conversion/target/iBioSim-conversion-3.1.0-SNAPSHOT-jar-with-dependencies.jar * -l PRISM YOURSBMLFILE.xml * - * The function also allows the translation into a bound model by simply adding the flag - * -bound + * The function also allows the translation into a bound model by simply adding + * the flag -bound */ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename, boolean unbound) throws IOException { @@ -73,181 +74,356 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename, bool out.write("\n"); out.write("ctmc\n"); out.write("\n"); - + // Set bound limit if bound model is selected - if (unbound) { - out.write("// const int MAX_AMOUNT = ADD VALUE \n"); - out.write("\n"); - } else { - double maxAmount = 0.0; - for (int i = 0; i < model.getSpeciesCount(); i++) { - Species species = model.getSpecies(i); - if (species.getInitialAmount() > maxAmount) { - maxAmount = species.getInitialAmount(); - } - } - out.write(" const int MAX_AMOUNT = " + (int) maxAmount + ";\n"); - out.write("\n"); out.write("\n"); + if (!unbound) { + + System.err.println("Under Development"); + /* + * double maxAmount = 0.0; for (int i = 0; i < model.getSpeciesCount(); i++) { + * Species species = model.getSpecies(i); if (species.getInitialAmount() > + * maxAmount) { maxAmount = species.getInitialAmount(); } } + * out.write(" const int MAX_AMOUNT = " + (int) maxAmount + ";\n"); + */ } - - // Identify compartments and their size - out.write("// Compartment size\n"); + // Declaration of new Compartment list + ArrayList compartmentList = new ArrayList(); + // Iterating over Compartments for (int i = 0; i < model.getCompartmentCount(); i++) { Compartment compartment = model.getCompartment(i); - out.write("const double " + checkReservedKeywordPrism(compartment.getId()) + " = " + compartment.getSize() - + ";\n"); + compartmentList.add(compartment); } - out.write("\n"); + // System.err.println("Compartment List: " + compartmentList + "\n"); + + // Identify compartments and their size + if (!compartmentList.isEmpty()) { + out.write("// Compartment size\n"); + } + + for (int i = 0; i < compartmentList.size(); i++) { + String id = checkReservedKeywordPrism(compartmentList.get(i).getId()); + // System.err.println("Id: " + id); + Double size = compartmentList.get(i).getSize(); + // System.err.println("Size: " + size); + if (!Double.isNaN(size)) { + out.write("const double " + id + " = " + size + ";\n"); + } + } // Identify model parameters - out.write("// Model parameters\n"); + // Declaration of new parameter list + ArrayList parameterList = new ArrayList(); + // Iterating over Compartments for (int i = 0; i < model.getParameterCount(); i++) { Parameter parameter = model.getParameter(i); - out.write("const double " + checkReservedKeywordPrism(parameter.getId()) + " = " + parameter.getValue() - + "; // " + parameter.getName() + "\n"); // if not null name + parameterList.add(parameter); + } + + // System.err.println("Parameter List: " + parameterList + "\n"); + + if (!parameterList.isEmpty()) { + out.write("\n"); + out.write("// Model parameters\n"); + } + + for (int i = 0; i < parameterList.size(); i++) { + String id = checkReservedKeywordPrism(parameterList.get(i).getId()); + Double value = parameterList.get(i).getValue(); + String name = parameterList.get(i).getName(); + if (!Double.isNaN(value)) { + out.write("const double " + id + " = " + value + "; // " + name + "\n"); // if not null name + } } - out.write("\n"); + // Identify reactions + // Declaration of new reaction list + ArrayList reactionList = new ArrayList(); + // Iterating over reactions + for (int i = 0; i < model.getReactionCount(); i++) { + Reaction reaction = model.getReaction(i); + reactionList.add(reaction); + } + + // System.err.println("Reaction List: " + reactionList + "\n"); + + // Identify local model parameters + // Declaration of new local parameter list + ArrayList localParameterList = new ArrayList(); + // Iterating over local parameters + for (int i = 0; i < reactionList.size(); i++) { + for (int j = 0; j < reactionList.get(i).getKineticLaw().getLocalParameterCount(); j++) { + LocalParameter localparameter = reactionList.get(i).getKineticLaw().getLocalParameter(j); + localParameterList.add(localparameter); + } + } + + // while (localParameterList.remove(null)); + // System.err.println("LocalParameterList: " + localParameterList + "\n"); + + ArrayList UpdatedlocalParameterList = new ArrayList(); + for (int i = 0; i < reactionList.size(); i++) { + for (int j = 0; j < reactionList.get(i).getKineticLaw().getLocalParameterCount(); j++) { + LocalParameter localparameter = reactionList.get(i).getKineticLaw().getLocalParameter(j); + // System.err.println("localparameter: " + localparameter); + if (localparameter != null) { + if (localParameterList.contains(localparameter)) { + reactionList.get(i).getKineticLaw().getLocalParameter(j) + .setId("local_" + localparameter.getId() + "_" + i); + // System.err.println( + // "localparameter: " + reactionList.get(i).getKineticLaw().getLocalParameter(j) + // + "\n"); + UpdatedlocalParameterList.add(reactionList.get(i).getKineticLaw().getLocalParameter(j)); + } + } + } + } + + for (int i = 0; i < reactionList.size(); i++) { + for (int j = 0; j < reactionList.get(i).getKineticLaw().getLocalParameterCount(); j++) { + // System.err.println("Reaction local parameter updated: " + // + reactionList.get(i).getKineticLaw().getLocalParameter(j)); + } + } + + if (!UpdatedlocalParameterList.isEmpty()) { + out.write("\n"); + out.write("// Model local parameters\n"); + } + + for (int i = 0; i < UpdatedlocalParameterList.size(); i++) { + LocalParameter localparameter = UpdatedlocalParameterList.get(i); + String id = checkReservedKeywordPrism(localparameter.getId()); + Double value = localparameter.getValue(); + String name; + if (localparameter.getName() != null) { + name = localparameter.getName(); + } else { + name = id; + } + out.write("const double " + id + " = " + value + "; // " + name + "\n"); // if not null name } + + } + + // System.err.println("Species Count: " + model.getSpeciesCount()); + // System.err.println("Reaction Count: " + model.getReactionCount()); + + Map map = new HashMap(); + for (int i = 0; i < reactionList.size(); i++) { + Reaction reaction = model.getReaction(i); + String SumReactant = ""; + int reaStoch; + // System.err.println("Reaction: " + reaction); + // System.err.println("ReactantCount: " + reaction.getReactantCount()); + + for (int j = 0; j < reaction.getReactantCount(); j++) { + // System.err.println("Species: " + reaction.getReactant(j).getSpecies()); + reaStoch = (int) reaction.getReactant(j).getStoichiometry() - 1; + // System.err.println("Stochiometry: " + reaStoch); + if (reaStoch == 0) { + SumReactant = SumReactant.concat(reaction.getReactant(j).getSpecies() + " >= " + reaStoch); + } else { + SumReactant = SumReactant.concat(reaction.getReactant(j).getSpecies() + " > " + reaStoch); + } + + if (j < reaction.getReactantCount() - 1) { + SumReactant = SumReactant.concat(" & "); + } + + // System.err.println(SumReactant); + + } + + map.put(reaction.getId(), SumReactant); + + SumReactant = ""; + + } + + // System.err.println(map); + // System.err.println(map.get("R0")); // Identify model species for (int i = 0; i < model.getSpeciesCount(); i++) { // Write out syntax // For function checkReservedKeywordPrism see below Species species = model.getSpecies(i); - out.write("// Species " + checkReservedKeywordPrism(species.getId()) + "\n"); - + String id = checkReservedKeywordPrism(species.getId()); + int inAmount = (int) species.getInitialAmount(); + + out.write("\n"); + out.write("// Species " + id + "\n"); + if (unbound) { - out.write("// const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); - out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); + out.write("module " + id + "\n"); out.write("\n"); - out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." - + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() - + ";\n"); - out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " - + (int) (species.getInitialAmount()) + ";\n"); + out.write(" " + id + " : " + "int init " + inAmount + ";\n"); out.write("\n"); } else { - out.write("const int " + checkReservedKeywordPrism(species.getId()) + "_MAX = MAX_AMOUNT;\n"); - out.write("module " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("\n"); - out.write(" " + checkReservedKeywordPrism(species.getId()) + " : " + "[0.." - + checkReservedKeywordPrism(species.getId()) + "_MAX] init " + (int) species.getInitialAmount() - + ";\n"); - out.write(" // " + checkReservedKeywordPrism(species.getId()) + " : " + "int init " - + (int) (species.getInitialAmount()) + ";\n"); - out.write("\n"); + System.err.println("Under Development"); + /* + * out.write("const int " + id + "_MAX = MAX_AMOUNT;\n"); out.write("module " + + * id + "\n"); out.write("\n"); out.write(" " + id + " : " + "[0.." + id + + * "_MAX] init " + inAmount + ";\n"); out.write(" // " + id + " : " + + * "int init " + inAmount + ";\n"); out.write("\n"); + */ } - // Iterate over reactions - for (int j = 0; j < model.getReactionCount(); j++) { - Reaction reaction = model.getReaction(j); - + for (int j = 0; j < reactionList.size(); j++) { + Reaction reaction = reactionList.get(j); // Identify reactants and products SpeciesReference reactant = reaction.getReactantForSpecies(species.getId()); SpeciesReference product = reaction.getProductForSpecies(species.getId()); + String reactionId = checkReservedKeywordPrism(reaction.getId()); + String speciesId = checkReservedKeywordPrism(species.getId()); + int stochi; - if (reactant != null) { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReservedKeywordPrism(species.getId()) + " > " - + (int) (reactant.getStoichiometry() - 1) + " -> (" - + checkReservedKeywordPrism(species.getId()) + "\'=" - + checkReservedKeywordPrism(species.getId()) + "-" + (int) reactant.getStoichiometry() - + ");\n"); - } else if (product != null) { - - if (unbound) { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReservedKeywordPrism(species.getId()) + " >= " + "0 -> (" - + checkReservedKeywordPrism(species.getId()) + "\'=" - + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() - + ");\n"); + if (reactant != null && product != null) { + + int reaStoch = (int) reactant.getStoichiometry(); + int proStoch = (int) product.getStoichiometry(); + // System.err.println("Check 1"); + stochi = proStoch - reaStoch; + + out.write(" // " + reactionId + "\n"); + + if (stochi >= 0) { + out.write(" [" + reactionId + "] "); + if (map.get(reactionId) != null) { + out.write(map.get(reactionId)); + } + out.write(" -> (" + speciesId + "\' = " + speciesId + " + " + stochi + ");\n"); } else { - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + "\n"); - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReservedKeywordPrism(species.getId()) + " <= " + checkReservedKeywordPrism(species.getId()) + "_MAX-" - + (int) product.getStoichiometry() + " -> (" - + checkReservedKeywordPrism(species.getId()) + "\'=" - + checkReservedKeywordPrism(species.getId()) + "+" + (int) product.getStoichiometry() - + ");\n"); - } - + out.write(" [" + reactionId + "] " + speciesId + " > 0 -> (" + speciesId + "\' = " + + speciesId + " - " + Math.abs(stochi) + ");\n"); + } + + } else if (reactant == null && product != null) { + + int proStoch = (int) product.getStoichiometry(); + int reaStoch = 0; + // System.err.println("Check 2"); + stochi = proStoch - reaStoch; + + out.write(" // " + reactionId + "\n"); + out.write(" [" + reactionId + "] "); + + // System.err.println(reactionId); + // System.err.println(map.get(reactionId)); + if (map.get(reactionId) != null && !"".equals(map.get(reactionId))) { + // System.err.println(map.get(reactionId) ); + out.write(map.get(reactionId) + " -> ("); + } else if ("".equals(map.get(reactionId))) { + out.write(speciesId + " >= 0 -> ("); + } + out.write(speciesId + "\' = " + speciesId + " + " + stochi + ");\n"); + } else if (reactant != null && product == null) { + int proStoch = 0; + int reaStoch = (int) reactant.getStoichiometry(); + // System.err.println("Check 3"); + stochi = proStoch - reaStoch; + out.write(" // " + reactionId + "\n"); + out.write(" [" + reactionId + "] "); + if (map.get(reactionId) != null) { + out.write(map.get(reactionId)); + } + out.write(" -> (" + speciesId + "\' = " + speciesId + " - " + Math.abs(stochi) + ");\n"); } - } out.write("\n"); out.write("endmodule\n"); - out.write("\n"); - } // Identify reaction rate + out.write("\n"); out.write("// Reaction rates\n"); out.write("module reaction_rates\n"); out.write("\n"); - for (int i = 0; i < model.getReactionCount(); i++) { - Reaction reaction = model.getReaction(i); + for (int i = 0; i < reactionList.size(); i++) { + Reaction reaction = reactionList.get(i); + String reactionId = checkReservedKeywordPrism(reaction.getId()); // Write state transitions - out.write(" // " + checkReservedKeywordPrism(reaction.getId()) + ": -> "); + out.write(" // " + reactionId + ": "); + + for (int j = 0; j < reaction.getReactantCount(); j++) { + if ((int) reaction.getReactant(j).getStoichiometry() > 1) { + out.write((int) reaction.getReactant(j).getStoichiometry() + " "); + } + // System.err.println(checkReservedKeywordPrism(reaction.getReactant(j).getSpecies())); + out.write(checkReservedKeywordPrism(reaction.getReactant(j).getSpecies())); + if (j < reaction.getReactantCount() - 1) { + out.write(" + "); + } + } + out.write(" -> "); + for (int j = 0; j < reaction.getProductCount(); j++) { - out.write(checkReservedKeywordPrism(reaction.getProduct(j).getSpecies()) + " "); + if ((int) reaction.getProduct(j).getStoichiometry() > 1) { + out.write((int) reaction.getProduct(j).getStoichiometry() + " "); + } + out.write(checkReservedKeywordPrism(reaction.getProduct(j).getSpecies())); + if (j < reaction.getProductCount() - 1) { + out.write(" + "); + } + } + out.write("\n"); + String math = checkReserveKeywordMath( + SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model); + + // System.err.println(math); + // System.err.println(localParameterList); + + for (int l = 0; l < reaction.getKineticLaw().getLocalParameterCount(); l++) { + String locPara = reaction.getKineticLaw().getLocalParameter(l).getId(); + math = math.replace(locPara.replace("local_", "").replace("_" + i, ""), locPara); + } + + // System.err.println(math); + // Get the math for the reaction rate - out.write(" [" + checkReservedKeywordPrism(reaction.getId()) + "] " - + checkReserveKeywordMath( - SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) - + " > 0 -> " + "(" - + checkReserveKeywordMath( - SBMLutilities.convertMath2PrismProperty(reaction.getKineticLaw().getMath()), model) - + ") : true;\n"); + out.write(" [" + reactionId + "] " + math + " > 0 -> " + math + " : true;\n"); out.write("\n"); - } - out.write("endmodule\n"); - out.write("\n"); + out.write("endmodule\n"); // Identify rewards + out.write("\n"); out.write("// Reward structures (one per species)"); out.write("\n"); for (int i = 0; i < model.getSpeciesCount(); i++) { Species species = model.getSpecies(i); + String speciesId = checkReservedKeywordPrism(species.getId().replace(" ", "")); - out.write("// Reward " + (i + 1) + ": " + checkReservedKeywordPrism(species.getId()) + "\n"); - out.write("rewards " + "\"" + checkReservedKeywordPrism(species.getId()) + "\" true : " - + checkReservedKeywordPrism(species.getId()) + "; endrewards\n"); + out.write("// Reward " + (i + 1) + ": " + speciesId + "\n"); + out.write("rewards " + "\"" + speciesId + "\" true : " + speciesId + "; endrewards\n"); } out.close(); - writePRISMProperty(filename, model); + // writePRISMProperty(filename, model); } - /* - * Writes PRISM property Input: (String) filename, (Model) model - * Output: void + * Writes PRISM property Input: (String) filename, (Model) model Output: void * - * Function checks the constraints of a SBML model and translates it - * into the PRISM syntax. The properties are then written into a - * .props file. + * Function checks the constraints of a SBML model and translates it into the + * PRISM syntax. The properties are then written into a .props file. */ - private static void writePRISMProperty(String filename, Model model) throws IOException - { + private static void writePRISMProperty(String filename, Model model) throws IOException { // Write Properties File File property = new File(filename.replace(".xml", ".props")); FileWriter property_out = new FileWriter(property); @@ -332,15 +508,20 @@ private static String checkReserveKeywordMath(String math, Model model) { if (speciesString.contains(keywords.get(i))) { // Replace species in math equations // In equations species names are lead by a space - String Target = " " + keywords.get(i); - // System.err.println(Target); - math = math.replace(Target, "_" + keywords.get(i)); + // String Target = " " + keywords.get(i); + // System.err.println("Target " + Target); + // System.err.println(math); + // math = math.replace("(? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pBAD + + + + + + + kb + + + ko_f + ko_r + + + nr + + + + + + + + ka + + + kao_f + kao_r + + + nr + + + + + + + + ka_f + ka_r + + Ara_AraC_protein + + nc + + + + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kao_f + kao_r + + nr + + + + + + + + ka_f + ka_r + + Ara_AraC_protein + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pHlyIIR + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + HlyIIR_protein + + nc + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/AraCsensor_module.xml b/prismtest/Circuit0x8E/AraCsensor_module.xml new file mode 100644 index 000000000..947db0f31 --- /dev/null +++ b/prismtest/Circuit0x8E/AraCsensor_module.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/BetIpart_module.xml b/prismtest/Circuit0x8E/BetIpart_module.xml new file mode 100644 index 000000000..c17495544 --- /dev/null +++ b/prismtest/Circuit0x8E/BetIpart_module.xml @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pHlyIIR + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + HlyIIR_protein + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pTet + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + TetR_protein + + nc + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/HlyIIRpart_module.xml b/prismtest/Circuit0x8E/HlyIIRpart_module.xml new file mode 100644 index 000000000..fb3c18ffb --- /dev/null +++ b/prismtest/Circuit0x8E/HlyIIRpart_module.xml @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pTet + + + + + + + kb + + + ko_f + ko_r + + + nr + + + + + + + + ka + + + kao_f + kao_r + + + nr + + + + + + + + ka_f + ka_r + + Ara_AraC_protein + + nc + + + + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kao_f + kao_r + + nr + + + + + + + + ka_f + ka_r + + Ara_AraC_protein + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pBAD + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + TetR_protein + + nc + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/LacIsensor_module.xml b/prismtest/Circuit0x8E/LacIsensor_module.xml new file mode 100644 index 000000000..834a13b1c --- /dev/null +++ b/prismtest/Circuit0x8E/LacIsensor_module.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/PhlFpart_module.xml b/prismtest/Circuit0x8E/PhlFpart_module.xml new file mode 100644 index 000000000..8bdf95547 --- /dev/null +++ b/prismtest/Circuit0x8E/PhlFpart_module.xml @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pTac + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + LacI_protein + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pAmtR + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + AmtR_protein + + nc + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/TetRsensor_module.xml b/prismtest/Circuit0x8E/TetRsensor_module.xml new file mode 100644 index 000000000..b7828b22e --- /dev/null +++ b/prismtest/Circuit0x8E/TetRsensor_module.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/YFPpart_module.xml b/prismtest/Circuit0x8E/YFPpart_module.xml new file mode 100644 index 000000000..2f853244a --- /dev/null +++ b/prismtest/Circuit0x8E/YFPpart_module.xml @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pPhlF + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + PhlF_protein + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pBetI + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + BetI_protein + + nc + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E/manifest.xml b/prismtest/Circuit0x8E/manifest.xml new file mode 100644 index 000000000..5175ad907 --- /dev/null +++ b/prismtest/Circuit0x8E/manifest.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/prismtest/Circuit0x8E/results.txt b/prismtest/Circuit0x8E/results.txt new file mode 100644 index 000000000..1543e6ca7 --- /dev/null +++ b/prismtest/Circuit0x8E/results.txt @@ -0,0 +1,2 @@ +0.0 +0.0010947156623888129 diff --git a/prismtest/Circuit0x8E/topModel.props b/prismtest/Circuit0x8E/topModel.props new file mode 100644 index 000000000..2ead6d057 --- /dev/null +++ b/prismtest/Circuit0x8E/topModel.props @@ -0,0 +1,5 @@ +// File generated by SBML-to-PRISM converter +// Original file: Circuit0x8E/topModel.xml +// @GeneticLogicLab + +P=? [ true U[0,1000] (YFP_protein >= 30) ] diff --git a/prismtest/Circuit0x8E/topModel.sm b/prismtest/Circuit0x8E/topModel.sm new file mode 100644 index 000000000..6de0a8c1e --- /dev/null +++ b/prismtest/Circuit0x8E/topModel.sm @@ -0,0 +1,518 @@ +// File generated by SBML-to-PRISM converter +// Original file: Circuit0x8E/topModel.xml +// @GeneticLogicLab + +ctmc + + const int MAX_AMOUNT = 70; + +// Compartment size +const double Cell = 1.0; + +// Model parameters +const double kd = 0.0075; // Degradation rate +const double kc_f = 0.05; // Forward complex formation rate +const double kc_r = 1.0; // Reverse complex formation rate +const double nc = 2.0; // Stoichiometry of binding +const double topModel_AmtRpart_module_sub__kr_f = 0.5; // Forward repression binding rate +const double topModel_AmtRpart_module_sub__kr_r = 1.0; // Reverse repression binding rate +const double topModel_AmtRpart_module_sub__ka_f = 0.0033; // Forward activation binding rate +const double topModel_AmtRpart_module_sub__ka_r = 1.0; // Reverse activation binding rate +const double topModel_AmtRpart_module_sub__ko_f = 0.033; // Forward RNAP binding rate +const double topModel_AmtRpart_module_sub__ko_r = 1.0; // Reverse RNAP binding rate +const double topModel_AmtRpart_module_sub__kao_f = 1.0; // Forward activated RNAP binding rate +const double topModel_AmtRpart_module_sub__kao_r = 1.0; // Reverse activated RNAP binding rate +const double topModel_AmtRpart_module_sub__nc = 2.0; // Stoichiometry of binding +const double topModel_AmtRpart_module_sub__nr = 30.0; // Initial RNAP count +const double topModel_AmtRpart_module_sub__ko = 0.05; // Open complex production rate +const double topModel_AmtRpart_module_sub__kb = 1.0E-4; // Basal production rate +const double topModel_AmtRpart_module_sub__ng = 2.0; // Initial promoter count +const double topModel_AmtRpart_module_sub__np = 10.0; // Stoichiometry of production +const double topModel_AmtRpart_module_sub__ka = 0.25; // Activated production rate +const double topModel_YFPpart_module_sub__kr_f = 0.5; // Forward repression binding rate +const double topModel_YFPpart_module_sub__kr_r = 1.0; // Reverse repression binding rate +const double topModel_YFPpart_module_sub__ka_f = 0.0033; // Forward activation binding rate +const double topModel_YFPpart_module_sub__ka_r = 1.0; // Reverse activation binding rate +const double topModel_YFPpart_module_sub__ko_f = 0.033; // Forward RNAP binding rate +const double topModel_YFPpart_module_sub__ko_r = 1.0; // Reverse RNAP binding rate +const double topModel_YFPpart_module_sub__kao_f = 1.0; // Forward activated RNAP binding rate +const double topModel_YFPpart_module_sub__kao_r = 1.0; // Reverse activated RNAP binding rate +const double topModel_YFPpart_module_sub__nc = 2.0; // Stoichiometry of binding +const double topModel_YFPpart_module_sub__nr = 30.0; // Initial RNAP count +const double topModel_YFPpart_module_sub__ko = 0.05; // Open complex production rate +const double topModel_YFPpart_module_sub__kb = 1.0E-4; // Basal production rate +const double topModel_YFPpart_module_sub__ng = 2.0; // Initial promoter count +const double topModel_YFPpart_module_sub__np = 10.0; // Stoichiometry of production +const double topModel_YFPpart_module_sub__ka = 0.25; // Activated production rate +const double topModel_BetIpart_module_sub__kr_f = 0.5; // Forward repression binding rate +const double topModel_BetIpart_module_sub__kr_r = 1.0; // Reverse repression binding rate +const double topModel_BetIpart_module_sub__ka_f = 0.0033; // Forward activation binding rate +const double topModel_BetIpart_module_sub__ka_r = 1.0; // Reverse activation binding rate +const double topModel_BetIpart_module_sub__ko_f = 0.033; // Forward RNAP binding rate +const double topModel_BetIpart_module_sub__ko_r = 1.0; // Reverse RNAP binding rate +const double topModel_BetIpart_module_sub__kao_f = 1.0; // Forward activated RNAP binding rate +const double topModel_BetIpart_module_sub__kao_r = 1.0; // Reverse activated RNAP binding rate +const double topModel_BetIpart_module_sub__nc = 2.0; // Stoichiometry of binding +const double topModel_BetIpart_module_sub__nr = 30.0; // Initial RNAP count +const double topModel_BetIpart_module_sub__ko = 0.05; // Open complex production rate +const double topModel_BetIpart_module_sub__kb = 1.0E-4; // Basal production rate +const double topModel_BetIpart_module_sub__ng = 2.0; // Initial promoter count +const double topModel_BetIpart_module_sub__np = 10.0; // Stoichiometry of production +const double topModel_BetIpart_module_sub__ka = 0.25; // Activated production rate +const double topModel_PhlFpart_module_sub__kr_f = 0.5; // Forward repression binding rate +const double topModel_PhlFpart_module_sub__kr_r = 1.0; // Reverse repression binding rate +const double topModel_PhlFpart_module_sub__ka_f = 0.0033; // Forward activation binding rate +const double topModel_PhlFpart_module_sub__ka_r = 1.0; // Reverse activation binding rate +const double topModel_PhlFpart_module_sub__ko_f = 0.033; // Forward RNAP binding rate +const double topModel_PhlFpart_module_sub__ko_r = 1.0; // Reverse RNAP binding rate +const double topModel_PhlFpart_module_sub__kao_f = 1.0; // Forward activated RNAP binding rate +const double topModel_PhlFpart_module_sub__kao_r = 1.0; // Reverse activated RNAP binding rate +const double topModel_PhlFpart_module_sub__nc = 2.0; // Stoichiometry of binding +const double topModel_PhlFpart_module_sub__nr = 30.0; // Initial RNAP count +const double topModel_PhlFpart_module_sub__ko = 0.05; // Open complex production rate +const double topModel_PhlFpart_module_sub__kb = 1.0E-4; // Basal production rate +const double topModel_PhlFpart_module_sub__ng = 2.0; // Initial promoter count +const double topModel_PhlFpart_module_sub__np = 10.0; // Stoichiometry of production +const double topModel_PhlFpart_module_sub__ka = 0.25; // Activated production rate +const double topModel_HlyIIRpart_module_sub__kr_f = 0.5; // Forward repression binding rate +const double topModel_HlyIIRpart_module_sub__kr_r = 1.0; // Reverse repression binding rate +const double topModel_HlyIIRpart_module_sub__ka_f = 0.0033; // Forward activation binding rate +const double topModel_HlyIIRpart_module_sub__ka_r = 1.0; // Reverse activation binding rate +const double topModel_HlyIIRpart_module_sub__ko_f = 0.033; // Forward RNAP binding rate +const double topModel_HlyIIRpart_module_sub__ko_r = 1.0; // Reverse RNAP binding rate +const double topModel_HlyIIRpart_module_sub__kao_f = 1.0; // Forward activated RNAP binding rate +const double topModel_HlyIIRpart_module_sub__kao_r = 1.0; // Reverse activated RNAP binding rate +const double topModel_HlyIIRpart_module_sub__nc = 2.0; // Stoichiometry of binding +const double topModel_HlyIIRpart_module_sub__nr = 30.0; // Initial RNAP count +const double topModel_HlyIIRpart_module_sub__ko = 0.05; // Open complex production rate +const double topModel_HlyIIRpart_module_sub__kb = 1.0E-4; // Basal production rate +const double topModel_HlyIIRpart_module_sub__ng = 2.0; // Initial promoter count +const double topModel_HlyIIRpart_module_sub__np = 10.0; // Stoichiometry of production +const double topModel_HlyIIRpart_module_sub__ka = 0.25; // Activated production rate + +// Species AmtR_protein +const int AmtR_protein_MAX = MAX_AMOUNT; +module AmtR_protein + + AmtR_protein : [0..AmtR_protein_MAX] init 70; + // AmtR_protein : int init 70; + + // AmtR_degradation_interaction + [AmtR_degradation_interaction] AmtR_protein > 0 -> (AmtR_protein'=AmtR_protein-1); + // topModel_AmtRpart_module_sub__AmtR_protein_interaction_0 + [topModel_AmtRpart_module_sub__AmtR_protein_interaction_0] AmtR_protein <= AmtR_protein_MAX-10 -> (AmtR_protein'=AmtR_protein+10); + // topModel_AmtRpart_module_sub__AmtR_protein_interaction_1 + [topModel_AmtRpart_module_sub__AmtR_protein_interaction_1] AmtR_protein <= AmtR_protein_MAX-10 -> (AmtR_protein'=AmtR_protein+10); + +endmodule + +// Species IPTG +const int IPTG_MAX = MAX_AMOUNT; +module IPTG + + IPTG : [0..IPTG_MAX] init 0; + // IPTG : int init 0; + + // Complex_IPTG_LacI_protein + [Complex_IPTG_LacI_protein] IPTG > 1 -> (IPTG'=IPTG-2); + +endmodule + +// Species Ara_AraC_protein +const int Ara_AraC_protein_MAX = MAX_AMOUNT; +module Ara_AraC_protein + + Ara_AraC_protein : [0..Ara_AraC_protein_MAX] init 0; + // Ara_AraC_protein : int init 0; + + // Ara_AraC_protein_degradation_interaction + [Ara_AraC_protein_degradation_interaction] Ara_AraC_protein > 0 -> (Ara_AraC_protein'=Ara_AraC_protein-1); + // Complex_Ara_AraC_protein + [Complex_Ara_AraC_protein] Ara_AraC_protein <= Ara_AraC_protein_MAX-1 -> (Ara_AraC_protein'=Ara_AraC_protein+1); + +endmodule + +// Species TetR_protein +const int TetR_protein_MAX = MAX_AMOUNT; +module TetR_protein + + TetR_protein : [0..TetR_protein_MAX] init 0; + // TetR_protein : int init 0; + + // Complex_aTc_TetR_protein + [Complex_aTc_TetR_protein] TetR_protein > 1 -> (TetR_protein'=TetR_protein-2); + // TetR_degradation_interaction + [TetR_degradation_interaction] TetR_protein > 0 -> (TetR_protein'=TetR_protein-1); + +endmodule + +// Species LacI_protein +const int LacI_protein_MAX = MAX_AMOUNT; +module LacI_protein + + LacI_protein : [0..LacI_protein_MAX] init 0; + // LacI_protein : int init 0; + + // Complex_IPTG_LacI_protein + [Complex_IPTG_LacI_protein] LacI_protein > 1 -> (LacI_protein'=LacI_protein-2); + // LacI_degradation_interaction + [LacI_degradation_interaction] LacI_protein > 0 -> (LacI_protein'=LacI_protein-1); + +endmodule + +// Species aTc_TetR_protein +const int aTc_TetR_protein_MAX = MAX_AMOUNT; +module aTc_TetR_protein + + aTc_TetR_protein : [0..aTc_TetR_protein_MAX] init 0; + // aTc_TetR_protein : int init 0; + + // Complex_aTc_TetR_protein + [Complex_aTc_TetR_protein] aTc_TetR_protein <= aTc_TetR_protein_MAX-1 -> (aTc_TetR_protein'=aTc_TetR_protein+1); + // aTc_TetR_protein_degradation_interaction + [aTc_TetR_protein_degradation_interaction] aTc_TetR_protein > 0 -> (aTc_TetR_protein'=aTc_TetR_protein-1); + +endmodule + +// Species AraC_protein +const int AraC_protein_MAX = MAX_AMOUNT; +module AraC_protein + + AraC_protein : [0..AraC_protein_MAX] init 0; + // AraC_protein : int init 0; + + // AraC_degradation_interaction + [AraC_degradation_interaction] AraC_protein > 0 -> (AraC_protein'=AraC_protein-1); + // Complex_Ara_AraC_protein + [Complex_Ara_AraC_protein] AraC_protein > 1 -> (AraC_protein'=AraC_protein-2); + +endmodule + +// Species IPTG_LacI_protein +const int IPTG_LacI_protein_MAX = MAX_AMOUNT; +module IPTG_LacI_protein + + IPTG_LacI_protein : [0..IPTG_LacI_protein_MAX] init 0; + // IPTG_LacI_protein : int init 0; + + // IPTG_LacI_protein_degradation_interaction + [IPTG_LacI_protein_degradation_interaction] IPTG_LacI_protein > 0 -> (IPTG_LacI_protein'=IPTG_LacI_protein-1); + // Complex_IPTG_LacI_protein + [Complex_IPTG_LacI_protein] IPTG_LacI_protein <= IPTG_LacI_protein_MAX-1 -> (IPTG_LacI_protein'=IPTG_LacI_protein+1); + +endmodule + +// Species aTc +const int aTc_MAX = MAX_AMOUNT; +module aTc + + aTc : [0..aTc_MAX] init 0; + // aTc : int init 0; + + // Complex_aTc_TetR_protein + [Complex_aTc_TetR_protein] aTc > 1 -> (aTc'=aTc-2); + +endmodule + +// Species BetI_protein +const int BetI_protein_MAX = MAX_AMOUNT; +module BetI_protein + + BetI_protein : [0..BetI_protein_MAX] init 70; + // BetI_protein : int init 70; + + // BetI_degradation_interaction + [BetI_degradation_interaction] BetI_protein > 0 -> (BetI_protein'=BetI_protein-1); + // topModel_BetIpart_module_sub__BetI_protein_interaction_0 + [topModel_BetIpart_module_sub__BetI_protein_interaction_0] BetI_protein <= BetI_protein_MAX-10 -> (BetI_protein'=BetI_protein+10); + // topModel_BetIpart_module_sub__BetI_protein_interaction_1 + [topModel_BetIpart_module_sub__BetI_protein_interaction_1] BetI_protein <= BetI_protein_MAX-10 -> (BetI_protein'=BetI_protein+10); + +endmodule + +// Species HlyIIR_protein +const int HlyIIR_protein_MAX = MAX_AMOUNT; +module HlyIIR_protein + + HlyIIR_protein : [0..HlyIIR_protein_MAX] init 0; + // HlyIIR_protein : int init 0; + + // HlyIIR_degradation_interaction + [HlyIIR_degradation_interaction] HlyIIR_protein > 0 -> (HlyIIR_protein'=HlyIIR_protein-1); + // topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_0 + [topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_0] HlyIIR_protein <= HlyIIR_protein_MAX-10 -> (HlyIIR_protein'=HlyIIR_protein+10); + // topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_1 + [topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_1] HlyIIR_protein <= HlyIIR_protein_MAX-10 -> (HlyIIR_protein'=HlyIIR_protein+10); + +endmodule + +// Species PhlF_protein +const int PhlF_protein_MAX = MAX_AMOUNT; +module PhlF_protein + + PhlF_protein : [0..PhlF_protein_MAX] init 70; + // PhlF_protein : int init 70; + + // PhlF_degradation_interaction + [PhlF_degradation_interaction] PhlF_protein > 0 -> (PhlF_protein'=PhlF_protein-1); + // topModel_PhlFpart_module_sub__PhlF_protein_interaction_0 + [topModel_PhlFpart_module_sub__PhlF_protein_interaction_0] PhlF_protein <= PhlF_protein_MAX-10 -> (PhlF_protein'=PhlF_protein+10); + // topModel_PhlFpart_module_sub__PhlF_protein_interaction_1 + [topModel_PhlFpart_module_sub__PhlF_protein_interaction_1] PhlF_protein <= PhlF_protein_MAX-10 -> (PhlF_protein'=PhlF_protein+10); + +endmodule + +// Species YFP_protein +const int YFP_protein_MAX = MAX_AMOUNT; +module YFP_protein + + YFP_protein : [0..YFP_protein_MAX] init 0; + // YFP_protein : int init 0; + + // YFP_degradation_interaction + [YFP_degradation_interaction] YFP_protein > 0 -> (YFP_protein'=YFP_protein-1); + // topModel_YFPpart_module_sub__YFP_protein_interaction_0 + [topModel_YFPpart_module_sub__YFP_protein_interaction_0] YFP_protein <= YFP_protein_MAX-10 -> (YFP_protein'=YFP_protein+10); + // topModel_YFPpart_module_sub__YFP_protein_interaction_1 + [topModel_YFPpart_module_sub__YFP_protein_interaction_1] YFP_protein <= YFP_protein_MAX-10 -> (YFP_protein'=YFP_protein+10); + +endmodule + +// Species Ara +const int Ara_MAX = MAX_AMOUNT; +module Ara + + Ara : [0..Ara_MAX] init 60; + // Ara : int init 60; + + // Complex_Ara_AraC_protein + [Complex_Ara_AraC_protein] Ara > 1 -> (Ara'=Ara-2); + +endmodule + +// Species topModel_AmtRpart_module_sub__pBAD +const int topModel_AmtRpart_module_sub__pBAD_MAX = MAX_AMOUNT; +module topModel_AmtRpart_module_sub__pBAD + + topModel_AmtRpart_module_sub__pBAD : [0..topModel_AmtRpart_module_sub__pBAD_MAX] init 2; + // topModel_AmtRpart_module_sub__pBAD : int init 2; + + +endmodule + +// Species topModel_AmtRpart_module_sub__pHlyIIR +const int topModel_AmtRpart_module_sub__pHlyIIR_MAX = MAX_AMOUNT; +module topModel_AmtRpart_module_sub__pHlyIIR + + topModel_AmtRpart_module_sub__pHlyIIR : [0..topModel_AmtRpart_module_sub__pHlyIIR_MAX] init 2; + // topModel_AmtRpart_module_sub__pHlyIIR : int init 2; + + +endmodule + +// Species topModel_YFPpart_module_sub__pPhlF +const int topModel_YFPpart_module_sub__pPhlF_MAX = MAX_AMOUNT; +module topModel_YFPpart_module_sub__pPhlF + + topModel_YFPpart_module_sub__pPhlF : [0..topModel_YFPpart_module_sub__pPhlF_MAX] init 2; + // topModel_YFPpart_module_sub__pPhlF : int init 2; + + +endmodule + +// Species topModel_YFPpart_module_sub__pBetI +const int topModel_YFPpart_module_sub__pBetI_MAX = MAX_AMOUNT; +module topModel_YFPpart_module_sub__pBetI + + topModel_YFPpart_module_sub__pBetI : [0..topModel_YFPpart_module_sub__pBetI_MAX] init 2; + // topModel_YFPpart_module_sub__pBetI : int init 2; + + +endmodule + +// Species topModel_BetIpart_module_sub__pHlyIIR +const int topModel_BetIpart_module_sub__pHlyIIR_MAX = MAX_AMOUNT; +module topModel_BetIpart_module_sub__pHlyIIR + + topModel_BetIpart_module_sub__pHlyIIR : [0..topModel_BetIpart_module_sub__pHlyIIR_MAX] init 2; + // topModel_BetIpart_module_sub__pHlyIIR : int init 2; + + +endmodule + +// Species topModel_BetIpart_module_sub__pTet +const int topModel_BetIpart_module_sub__pTet_MAX = MAX_AMOUNT; +module topModel_BetIpart_module_sub__pTet + + topModel_BetIpart_module_sub__pTet : [0..topModel_BetIpart_module_sub__pTet_MAX] init 2; + // topModel_BetIpart_module_sub__pTet : int init 2; + + +endmodule + +// Species topModel_PhlFpart_module_sub__pTac +const int topModel_PhlFpart_module_sub__pTac_MAX = MAX_AMOUNT; +module topModel_PhlFpart_module_sub__pTac + + topModel_PhlFpart_module_sub__pTac : [0..topModel_PhlFpart_module_sub__pTac_MAX] init 2; + // topModel_PhlFpart_module_sub__pTac : int init 2; + + +endmodule + +// Species topModel_PhlFpart_module_sub__pAmtR +const int topModel_PhlFpart_module_sub__pAmtR_MAX = MAX_AMOUNT; +module topModel_PhlFpart_module_sub__pAmtR + + topModel_PhlFpart_module_sub__pAmtR : [0..topModel_PhlFpart_module_sub__pAmtR_MAX] init 2; + // topModel_PhlFpart_module_sub__pAmtR : int init 2; + + +endmodule + +// Species topModel_HlyIIRpart_module_sub__pTet +const int topModel_HlyIIRpart_module_sub__pTet_MAX = MAX_AMOUNT; +module topModel_HlyIIRpart_module_sub__pTet + + topModel_HlyIIRpart_module_sub__pTet : [0..topModel_HlyIIRpart_module_sub__pTet_MAX] init 2; + // topModel_HlyIIRpart_module_sub__pTet : int init 2; + + +endmodule + +// Species topModel_HlyIIRpart_module_sub__pBAD +const int topModel_HlyIIRpart_module_sub__pBAD_MAX = MAX_AMOUNT; +module topModel_HlyIIRpart_module_sub__pBAD + + topModel_HlyIIRpart_module_sub__pBAD : [0..topModel_HlyIIRpart_module_sub__pBAD_MAX] init 2; + // topModel_HlyIIRpart_module_sub__pBAD : int init 2; + + +endmodule + +// Reaction rates +module reaction_rates + + // AraC_degradation_interaction: -> + [AraC_degradation_interaction] (kd * AraC_protein) > 0 -> ((kd * AraC_protein)) : true; + + // Complex_aTc_TetR_protein: -> aTc_TetR_protein + [Complex_aTc_TetR_protein] (((kc_f * pow(TetR_protein , nc)) * pow(aTc , nc)) - (kc_r * aTc_TetR_protein)) > 0 -> ((((kc_f * pow(TetR_protein , nc)) * pow(aTc , nc)) - (kc_r * aTc_TetR_protein))) : true; + + // TetR_degradation_interaction: -> + [TetR_degradation_interaction] (kd * TetR_protein) > 0 -> ((kd * TetR_protein)) : true; + + // Ara_AraC_protein_degradation_interaction: -> + [Ara_AraC_protein_degradation_interaction] (kd * Ara_AraC_protein) > 0 -> ((kd * Ara_AraC_protein)) : true; + + // IPTG_LacI_protein_degradation_interaction: -> + [IPTG_LacI_protein_degradation_interaction] (kd * IPTG_LacI_protein) > 0 -> ((kd * IPTG_LacI_protein)) : true; + + // PhlF_degradation_interaction: -> + [PhlF_degradation_interaction] (kd * PhlF_protein) > 0 -> ((kd * PhlF_protein)) : true; + + // aTc_TetR_protein_degradation_interaction: -> + [aTc_TetR_protein_degradation_interaction] (kd * aTc_TetR_protein) > 0 -> ((kd * aTc_TetR_protein)) : true; + + // Complex_IPTG_LacI_protein: -> IPTG_LacI_protein + [Complex_IPTG_LacI_protein] (((kc_f * pow(IPTG , nc)) * pow(LacI_protein , nc)) - (kc_r * IPTG_LacI_protein)) > 0 -> ((((kc_f * pow(IPTG , nc)) * pow(LacI_protein , nc)) - (kc_r * IPTG_LacI_protein))) : true; + + // YFP_degradation_interaction: -> + [YFP_degradation_interaction] (kd * YFP_protein) > 0 -> ((kd * YFP_protein)) : true; + + // LacI_degradation_interaction: -> + [LacI_degradation_interaction] (kd * LacI_protein) > 0 -> ((kd * LacI_protein)) : true; + + // Complex_Ara_AraC_protein: -> Ara_AraC_protein + [Complex_Ara_AraC_protein] (((kc_f * pow(AraC_protein , nc)) * pow(Ara , nc)) - (kc_r * Ara_AraC_protein)) > 0 -> ((((kc_f * pow(AraC_protein , nc)) * pow(Ara , nc)) - (kc_r * Ara_AraC_protein))) : true; + + // HlyIIR_degradation_interaction: -> + [HlyIIR_degradation_interaction] (kd * HlyIIR_protein) > 0 -> ((kd * HlyIIR_protein)) : true; + + // BetI_degradation_interaction: -> + [BetI_degradation_interaction] (kd * BetI_protein) > 0 -> ((kd * BetI_protein)) : true; + + // AmtR_degradation_interaction: -> + [AmtR_degradation_interaction] (kd * AmtR_protein) > 0 -> ((kd * AmtR_protein)) : true; + + // topModel_AmtRpart_module_sub__AmtR_protein_interaction_0: -> AmtR_protein + [topModel_AmtRpart_module_sub__AmtR_protein_interaction_0] ((topModel_AmtRpart_module_sub__pBAD * ((((topModel_AmtRpart_module_sub__kb * topModel_AmtRpart_module_sub__ko_f) / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr) + ((((topModel_AmtRpart_module_sub__ka * topModel_AmtRpart_module_sub__kao_f) / topModel_AmtRpart_module_sub__kao_r) * topModel_AmtRpart_module_sub__nr) * pow(((topModel_AmtRpart_module_sub__ka_f / topModel_AmtRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_AmtRpart_module_sub__nc)))) / ((1 + ((topModel_AmtRpart_module_sub__ko_f / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr)) + (((topModel_AmtRpart_module_sub__kao_f / topModel_AmtRpart_module_sub__kao_r) * topModel_AmtRpart_module_sub__nr) * pow(((topModel_AmtRpart_module_sub__ka_f / topModel_AmtRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_AmtRpart_module_sub__nc)))) > 0 -> (((topModel_AmtRpart_module_sub__pBAD * ((((topModel_AmtRpart_module_sub__kb * topModel_AmtRpart_module_sub__ko_f) / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr) + ((((topModel_AmtRpart_module_sub__ka * topModel_AmtRpart_module_sub__kao_f) / topModel_AmtRpart_module_sub__kao_r) * topModel_AmtRpart_module_sub__nr) * pow(((topModel_AmtRpart_module_sub__ka_f / topModel_AmtRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_AmtRpart_module_sub__nc)))) / ((1 + ((topModel_AmtRpart_module_sub__ko_f / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr)) + (((topModel_AmtRpart_module_sub__kao_f / topModel_AmtRpart_module_sub__kao_r) * topModel_AmtRpart_module_sub__nr) * pow(((topModel_AmtRpart_module_sub__ka_f / topModel_AmtRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_AmtRpart_module_sub__nc))))) : true; + + // topModel_AmtRpart_module_sub__AmtR_protein_interaction_1: -> AmtR_protein + [topModel_AmtRpart_module_sub__AmtR_protein_interaction_1] (((((topModel_AmtRpart_module_sub__pHlyIIR * topModel_AmtRpart_module_sub__ko) * topModel_AmtRpart_module_sub__ko_f) / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr) / ((1 + ((topModel_AmtRpart_module_sub__ko_f / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr)) + pow(((topModel_AmtRpart_module_sub__kr_f / topModel_AmtRpart_module_sub__kr_r) * HlyIIR_protein) , topModel_AmtRpart_module_sub__nc))) > 0 -> ((((((topModel_AmtRpart_module_sub__pHlyIIR * topModel_AmtRpart_module_sub__ko) * topModel_AmtRpart_module_sub__ko_f) / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr) / ((1 + ((topModel_AmtRpart_module_sub__ko_f / topModel_AmtRpart_module_sub__ko_r) * topModel_AmtRpart_module_sub__nr)) + pow(((topModel_AmtRpart_module_sub__kr_f / topModel_AmtRpart_module_sub__kr_r) * HlyIIR_protein) , topModel_AmtRpart_module_sub__nc)))) : true; + + // topModel_YFPpart_module_sub__YFP_protein_interaction_0: -> YFP_protein + [topModel_YFPpart_module_sub__YFP_protein_interaction_0] (((((topModel_YFPpart_module_sub__pPhlF * topModel_YFPpart_module_sub__ko) * topModel_YFPpart_module_sub__ko_f) / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr) / ((1 + ((topModel_YFPpart_module_sub__ko_f / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr)) + pow(((topModel_YFPpart_module_sub__kr_f / topModel_YFPpart_module_sub__kr_r) * PhlF_protein) , topModel_YFPpart_module_sub__nc))) > 0 -> ((((((topModel_YFPpart_module_sub__pPhlF * topModel_YFPpart_module_sub__ko) * topModel_YFPpart_module_sub__ko_f) / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr) / ((1 + ((topModel_YFPpart_module_sub__ko_f / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr)) + pow(((topModel_YFPpart_module_sub__kr_f / topModel_YFPpart_module_sub__kr_r) * PhlF_protein) , topModel_YFPpart_module_sub__nc)))) : true; + + // topModel_YFPpart_module_sub__YFP_protein_interaction_1: -> YFP_protein + [topModel_YFPpart_module_sub__YFP_protein_interaction_1] (((((topModel_YFPpart_module_sub__pBetI * topModel_YFPpart_module_sub__ko) * topModel_YFPpart_module_sub__ko_f) / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr) / ((1 + ((topModel_YFPpart_module_sub__ko_f / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr)) + pow(((topModel_YFPpart_module_sub__kr_f / topModel_YFPpart_module_sub__kr_r) * BetI_protein) , topModel_YFPpart_module_sub__nc))) > 0 -> ((((((topModel_YFPpart_module_sub__pBetI * topModel_YFPpart_module_sub__ko) * topModel_YFPpart_module_sub__ko_f) / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr) / ((1 + ((topModel_YFPpart_module_sub__ko_f / topModel_YFPpart_module_sub__ko_r) * topModel_YFPpart_module_sub__nr)) + pow(((topModel_YFPpart_module_sub__kr_f / topModel_YFPpart_module_sub__kr_r) * BetI_protein) , topModel_YFPpart_module_sub__nc)))) : true; + + // topModel_BetIpart_module_sub__BetI_protein_interaction_0: -> BetI_protein + [topModel_BetIpart_module_sub__BetI_protein_interaction_0] (((((topModel_BetIpart_module_sub__pHlyIIR * topModel_BetIpart_module_sub__ko) * topModel_BetIpart_module_sub__ko_f) / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr) / ((1 + ((topModel_BetIpart_module_sub__ko_f / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr)) + pow(((topModel_BetIpart_module_sub__kr_f / topModel_BetIpart_module_sub__kr_r) * HlyIIR_protein) , topModel_BetIpart_module_sub__nc))) > 0 -> ((((((topModel_BetIpart_module_sub__pHlyIIR * topModel_BetIpart_module_sub__ko) * topModel_BetIpart_module_sub__ko_f) / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr) / ((1 + ((topModel_BetIpart_module_sub__ko_f / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr)) + pow(((topModel_BetIpart_module_sub__kr_f / topModel_BetIpart_module_sub__kr_r) * HlyIIR_protein) , topModel_BetIpart_module_sub__nc)))) : true; + + // topModel_BetIpart_module_sub__BetI_protein_interaction_1: -> BetI_protein + [topModel_BetIpart_module_sub__BetI_protein_interaction_1] (((((topModel_BetIpart_module_sub__pTet * topModel_BetIpart_module_sub__ko) * topModel_BetIpart_module_sub__ko_f) / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr) / ((1 + ((topModel_BetIpart_module_sub__ko_f / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr)) + pow(((topModel_BetIpart_module_sub__kr_f / topModel_BetIpart_module_sub__kr_r) * TetR_protein) , topModel_BetIpart_module_sub__nc))) > 0 -> ((((((topModel_BetIpart_module_sub__pTet * topModel_BetIpart_module_sub__ko) * topModel_BetIpart_module_sub__ko_f) / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr) / ((1 + ((topModel_BetIpart_module_sub__ko_f / topModel_BetIpart_module_sub__ko_r) * topModel_BetIpart_module_sub__nr)) + pow(((topModel_BetIpart_module_sub__kr_f / topModel_BetIpart_module_sub__kr_r) * TetR_protein) , topModel_BetIpart_module_sub__nc)))) : true; + + // topModel_PhlFpart_module_sub__PhlF_protein_interaction_0: -> PhlF_protein + [topModel_PhlFpart_module_sub__PhlF_protein_interaction_0] (((((topModel_PhlFpart_module_sub__pTac * topModel_PhlFpart_module_sub__ko) * topModel_PhlFpart_module_sub__ko_f) / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr) / ((1 + ((topModel_PhlFpart_module_sub__ko_f / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr)) + pow(((topModel_PhlFpart_module_sub__kr_f / topModel_PhlFpart_module_sub__kr_r) * LacI_protein) , topModel_PhlFpart_module_sub__nc))) > 0 -> ((((((topModel_PhlFpart_module_sub__pTac * topModel_PhlFpart_module_sub__ko) * topModel_PhlFpart_module_sub__ko_f) / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr) / ((1 + ((topModel_PhlFpart_module_sub__ko_f / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr)) + pow(((topModel_PhlFpart_module_sub__kr_f / topModel_PhlFpart_module_sub__kr_r) * LacI_protein) , topModel_PhlFpart_module_sub__nc)))) : true; + + // topModel_PhlFpart_module_sub__PhlF_protein_interaction_1: -> PhlF_protein + [topModel_PhlFpart_module_sub__PhlF_protein_interaction_1] (((((topModel_PhlFpart_module_sub__pAmtR * topModel_PhlFpart_module_sub__ko) * topModel_PhlFpart_module_sub__ko_f) / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr) / ((1 + ((topModel_PhlFpart_module_sub__ko_f / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr)) + pow(((topModel_PhlFpart_module_sub__kr_f / topModel_PhlFpart_module_sub__kr_r) * AmtR_protein) , topModel_PhlFpart_module_sub__nc))) > 0 -> ((((((topModel_PhlFpart_module_sub__pAmtR * topModel_PhlFpart_module_sub__ko) * topModel_PhlFpart_module_sub__ko_f) / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr) / ((1 + ((topModel_PhlFpart_module_sub__ko_f / topModel_PhlFpart_module_sub__ko_r) * topModel_PhlFpart_module_sub__nr)) + pow(((topModel_PhlFpart_module_sub__kr_f / topModel_PhlFpart_module_sub__kr_r) * AmtR_protein) , topModel_PhlFpart_module_sub__nc)))) : true; + + // topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_0: -> HlyIIR_protein + [topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_0] ((topModel_HlyIIRpart_module_sub__pTet * ((((topModel_HlyIIRpart_module_sub__kb * topModel_HlyIIRpart_module_sub__ko_f) / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr) + ((((topModel_HlyIIRpart_module_sub__ka * topModel_HlyIIRpart_module_sub__kao_f) / topModel_HlyIIRpart_module_sub__kao_r) * topModel_HlyIIRpart_module_sub__nr) * pow(((topModel_HlyIIRpart_module_sub__ka_f / topModel_HlyIIRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_HlyIIRpart_module_sub__nc)))) / ((1 + ((topModel_HlyIIRpart_module_sub__ko_f / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr)) + (((topModel_HlyIIRpart_module_sub__kao_f / topModel_HlyIIRpart_module_sub__kao_r) * topModel_HlyIIRpart_module_sub__nr) * pow(((topModel_HlyIIRpart_module_sub__ka_f / topModel_HlyIIRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_HlyIIRpart_module_sub__nc)))) > 0 -> (((topModel_HlyIIRpart_module_sub__pTet * ((((topModel_HlyIIRpart_module_sub__kb * topModel_HlyIIRpart_module_sub__ko_f) / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr) + ((((topModel_HlyIIRpart_module_sub__ka * topModel_HlyIIRpart_module_sub__kao_f) / topModel_HlyIIRpart_module_sub__kao_r) * topModel_HlyIIRpart_module_sub__nr) * pow(((topModel_HlyIIRpart_module_sub__ka_f / topModel_HlyIIRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_HlyIIRpart_module_sub__nc)))) / ((1 + ((topModel_HlyIIRpart_module_sub__ko_f / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr)) + (((topModel_HlyIIRpart_module_sub__kao_f / topModel_HlyIIRpart_module_sub__kao_r) * topModel_HlyIIRpart_module_sub__nr) * pow(((topModel_HlyIIRpart_module_sub__ka_f / topModel_HlyIIRpart_module_sub__ka_r) * Ara_AraC_protein) , topModel_HlyIIRpart_module_sub__nc))))) : true; + + // topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_1: -> HlyIIR_protein + [topModel_HlyIIRpart_module_sub__HlyIIR_protein_interaction_1] (((((topModel_HlyIIRpart_module_sub__pBAD * topModel_HlyIIRpart_module_sub__ko) * topModel_HlyIIRpart_module_sub__ko_f) / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr) / ((1 + ((topModel_HlyIIRpart_module_sub__ko_f / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr)) + pow(((topModel_HlyIIRpart_module_sub__kr_f / topModel_HlyIIRpart_module_sub__kr_r) * TetR_protein) , topModel_HlyIIRpart_module_sub__nc))) > 0 -> ((((((topModel_HlyIIRpart_module_sub__pBAD * topModel_HlyIIRpart_module_sub__ko) * topModel_HlyIIRpart_module_sub__ko_f) / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr) / ((1 + ((topModel_HlyIIRpart_module_sub__ko_f / topModel_HlyIIRpart_module_sub__ko_r) * topModel_HlyIIRpart_module_sub__nr)) + pow(((topModel_HlyIIRpart_module_sub__kr_f / topModel_HlyIIRpart_module_sub__kr_r) * TetR_protein) , topModel_HlyIIRpart_module_sub__nc)))) : true; + +endmodule + +// Reward structures (one per species) +// Reward 1: AmtR_protein +rewards "AmtR_protein" true : AmtR_protein; endrewards +// Reward 2: IPTG +rewards "IPTG" true : IPTG; endrewards +// Reward 3: Ara_AraC_protein +rewards "Ara_AraC_protein" true : Ara_AraC_protein; endrewards +// Reward 4: TetR_protein +rewards "TetR_protein" true : TetR_protein; endrewards +// Reward 5: LacI_protein +rewards "LacI_protein" true : LacI_protein; endrewards +// Reward 6: aTc_TetR_protein +rewards "aTc_TetR_protein" true : aTc_TetR_protein; endrewards +// Reward 7: AraC_protein +rewards "AraC_protein" true : AraC_protein; endrewards +// Reward 8: IPTG_LacI_protein +rewards "IPTG_LacI_protein" true : IPTG_LacI_protein; endrewards +// Reward 9: aTc +rewards "aTc" true : aTc; endrewards +// Reward 10: BetI_protein +rewards "BetI_protein" true : BetI_protein; endrewards +// Reward 11: HlyIIR_protein +rewards "HlyIIR_protein" true : HlyIIR_protein; endrewards +// Reward 12: PhlF_protein +rewards "PhlF_protein" true : PhlF_protein; endrewards +// Reward 13: YFP_protein +rewards "YFP_protein" true : YFP_protein; endrewards +// Reward 14: Ara +rewards "Ara" true : Ara; endrewards +// Reward 15: topModel_AmtRpart_module_sub__pBAD +rewards "topModel_AmtRpart_module_sub__pBAD" true : topModel_AmtRpart_module_sub__pBAD; endrewards +// Reward 16: topModel_AmtRpart_module_sub__pHlyIIR +rewards "topModel_AmtRpart_module_sub__pHlyIIR" true : topModel_AmtRpart_module_sub__pHlyIIR; endrewards +// Reward 17: topModel_YFPpart_module_sub__pPhlF +rewards "topModel_YFPpart_module_sub__pPhlF" true : topModel_YFPpart_module_sub__pPhlF; endrewards +// Reward 18: topModel_YFPpart_module_sub__pBetI +rewards "topModel_YFPpart_module_sub__pBetI" true : topModel_YFPpart_module_sub__pBetI; endrewards +// Reward 19: topModel_BetIpart_module_sub__pHlyIIR +rewards "topModel_BetIpart_module_sub__pHlyIIR" true : topModel_BetIpart_module_sub__pHlyIIR; endrewards +// Reward 20: topModel_BetIpart_module_sub__pTet +rewards "topModel_BetIpart_module_sub__pTet" true : topModel_BetIpart_module_sub__pTet; endrewards +// Reward 21: topModel_PhlFpart_module_sub__pTac +rewards "topModel_PhlFpart_module_sub__pTac" true : topModel_PhlFpart_module_sub__pTac; endrewards +// Reward 22: topModel_PhlFpart_module_sub__pAmtR +rewards "topModel_PhlFpart_module_sub__pAmtR" true : topModel_PhlFpart_module_sub__pAmtR; endrewards +// Reward 23: topModel_HlyIIRpart_module_sub__pTet +rewards "topModel_HlyIIRpart_module_sub__pTet" true : topModel_HlyIIRpart_module_sub__pTet; endrewards +// Reward 24: topModel_HlyIIRpart_module_sub__pBAD +rewards "topModel_HlyIIRpart_module_sub__pBAD" true : topModel_HlyIIRpart_module_sub__pBAD; endrewards diff --git a/prismtest/Circuit0x8E/topModel.xml b/prismtest/Circuit0x8E/topModel.xml new file mode 100644 index 000000000..8485dba83 --- /dev/null +++ b/prismtest/Circuit0x8E/topModel.xml @@ -0,0 +1,1489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + YFP_protein + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + AraC_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kc_f + + + TetR_protein + nc + + + + + aTc + nc + + + + + kc_r + aTc_TetR_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + TetR_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + Ara_AraC_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + IPTG_LacI_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + PhlF_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + aTc_TetR_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kc_f + + + IPTG + nc + + + + + LacI_protein + nc + + + + + kc_r + IPTG_LacI_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + YFP_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + LacI_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kc_f + + + AraC_protein + nc + + + + + Ara + nc + + + + + kc_r + Ara_AraC_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + HlyIIR_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + BetI_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + AmtR_protein + + + + + + + + \ No newline at end of file diff --git a/prismtest/Circuit0x8E_010to100.xml b/prismtest/Circuit0x8E_010to100.xml new file mode 100644 index 000000000..8ec591992 --- /dev/null +++ b/prismtest/Circuit0x8E_010to100.xml @@ -0,0 +1,2009 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + YFP_protein + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + PhlF_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + YFP_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + HlyIIR_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + BetI_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + AmtR_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_AmtRpart_module_sub__pBAD + + + + + + + + + topModel_AmtRpart_module_sub__kb + topModel_AmtRpart_module_sub__ko_f + + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + + + topModel_AmtRpart_module_sub__ka + topModel_AmtRpart_module_sub__kao_f + + topModel_AmtRpart_module_sub__kao_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + topModel_AmtRpart_module_sub__ka_f + topModel_AmtRpart_module_sub__ka_r + + Ara_AraC_protein + + topModel_AmtRpart_module_sub__nc + + + + + + + + + 1 + + + + + topModel_AmtRpart_module_sub__ko_f + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + + topModel_AmtRpart_module_sub__kao_f + topModel_AmtRpart_module_sub__kao_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + topModel_AmtRpart_module_sub__ka_f + topModel_AmtRpart_module_sub__ka_r + + Ara_AraC_protein + + topModel_AmtRpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_AmtRpart_module_sub__pHlyIIR + topModel_AmtRpart_module_sub__ko + + topModel_AmtRpart_module_sub__ko_f + + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + 1 + + + + + topModel_AmtRpart_module_sub__ko_f + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + + topModel_AmtRpart_module_sub__kr_f + topModel_AmtRpart_module_sub__kr_r + + HlyIIR_protein + + topModel_AmtRpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_YFPpart_module_sub__pPhlF + topModel_YFPpart_module_sub__ko + + topModel_YFPpart_module_sub__ko_f + + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + 1 + + + + + topModel_YFPpart_module_sub__ko_f + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + + + + topModel_YFPpart_module_sub__kr_f + topModel_YFPpart_module_sub__kr_r + + PhlF_protein + + topModel_YFPpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_YFPpart_module_sub__pBetI + topModel_YFPpart_module_sub__ko + + topModel_YFPpart_module_sub__ko_f + + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + 1 + + + + + topModel_YFPpart_module_sub__ko_f + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + + + + topModel_YFPpart_module_sub__kr_f + topModel_YFPpart_module_sub__kr_r + + BetI_protein + + topModel_YFPpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_BetIpart_module_sub__pHlyIIR + topModel_BetIpart_module_sub__ko + + topModel_BetIpart_module_sub__ko_f + + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + 1 + + + + + topModel_BetIpart_module_sub__ko_f + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + + + + topModel_BetIpart_module_sub__kr_f + topModel_BetIpart_module_sub__kr_r + + HlyIIR_protein + + topModel_BetIpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_BetIpart_module_sub__pTet + topModel_BetIpart_module_sub__ko + + topModel_BetIpart_module_sub__ko_f + + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + 1 + + + + + topModel_BetIpart_module_sub__ko_f + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + + + + topModel_BetIpart_module_sub__kr_f + topModel_BetIpart_module_sub__kr_r + + TetR_protein + + topModel_BetIpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_PhlFpart_module_sub__pTac + topModel_PhlFpart_module_sub__ko + + topModel_PhlFpart_module_sub__ko_f + + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + 1 + + + + + topModel_PhlFpart_module_sub__ko_f + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + + + + topModel_PhlFpart_module_sub__kr_f + topModel_PhlFpart_module_sub__kr_r + + LacI_protein + + topModel_PhlFpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_PhlFpart_module_sub__pAmtR + topModel_PhlFpart_module_sub__ko + + topModel_PhlFpart_module_sub__ko_f + + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + 1 + + + + + topModel_PhlFpart_module_sub__ko_f + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + + + + topModel_PhlFpart_module_sub__kr_f + topModel_PhlFpart_module_sub__kr_r + + AmtR_protein + + topModel_PhlFpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_HlyIIRpart_module_sub__pTet + + + + + + + + + topModel_HlyIIRpart_module_sub__kb + topModel_HlyIIRpart_module_sub__ko_f + + topModel_HlyIIRpart_module_sub__ko_r + + topModel_HlyIIRpart_module_sub__nr + + + + + + + + + + topModel_HlyIIRpart_module_sub__ka + topModel_HlyIIRpart_module_sub__kao_f + + topModel_HlyIIRpart_module_sub__kao_r + + topModel_HlyIIRpart_module_sub__nr + + + + + + + + topModel_HlyIIRpart_module_sub__ka_f + topModel_HlyIIRpart_module_sub__ka_r + + Ara_AraC_protein + + topModel_HlyIIRpart_module_sub__nc + + + + + + + + + 1 + + + + + topModel_HlyIIRpart_module_sub__ko_f + topModel_HlyIIRpart_module_sub__ko_r + + topModel_HlyIIRpart_module_sub__nr + + + + + + + + + topModel_HlyIIRpart_module_sub__kao_f + topModel_HlyIIRpart_module_sub__kao_r + + topModel_HlyIIRpart_module_sub__nr + + + + + + + + topModel_HlyIIRpart_module_sub__ka_f + topModel_HlyIIRpart_module_sub__ka_r + + Ara_AraC_protein + + topModel_HlyIIRpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_HlyIIRpart_module_sub__pBAD + topModel_HlyIIRpart_module_sub__ko + + topModel_HlyIIRpart_module_sub__ko_f + + topModel_HlyIIRpart_module_sub__ko_r + + topModel_HlyIIRpart_module_sub__nr + + + + + + 1 + + + + + topModel_HlyIIRpart_module_sub__ko_f + topModel_HlyIIRpart_module_sub__ko_r + + topModel_HlyIIRpart_module_sub__nr + + + + + + + + + topModel_HlyIIRpart_module_sub__kr_f + topModel_HlyIIRpart_module_sub__kr_r + + TetR_protein + + topModel_HlyIIRpart_module_sub__nc + + + + + + + + + diff --git a/prismtest/Circuit0x8E_LHF_010to100.xml b/prismtest/Circuit0x8E_LHF_010to100.xml new file mode 100644 index 000000000..c1e2259fe --- /dev/null +++ b/prismtest/Circuit0x8E_LHF_010to100.xml @@ -0,0 +1,2103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + YFP_protein + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + BM3R1_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + PhlF_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + YFP_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + HlyIIR_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + BetI_protein + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_BetIpart_module_sub__pTet + topModel_BetIpart_module_sub__ko + + topModel_BetIpart_module_sub__ko_f + + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + 1 + + + + + topModel_BetIpart_module_sub__ko_f + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + + + + topModel_BetIpart_module_sub__kr_f + topModel_BetIpart_module_sub__kr_r + + HlyIIR_protein + + topModel_BetIpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_BetIpart_module_sub__pHlyIIR + topModel_BetIpart_module_sub__ko + + topModel_BetIpart_module_sub__ko_f + + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + 1 + + + + + topModel_BetIpart_module_sub__ko_f + topModel_BetIpart_module_sub__ko_r + + topModel_BetIpart_module_sub__nr + + + + + + + + + topModel_BetIpart_module_sub__kr_f + topModel_BetIpart_module_sub__kr_r + + TetR_protein + + topModel_BetIpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_AmtRpart_module_sub__pBM3R1 + + + + + + + + + topModel_AmtRpart_module_sub__kb + topModel_AmtRpart_module_sub__ko_f + + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + + + topModel_AmtRpart_module_sub__ka + topModel_AmtRpart_module_sub__kao_f + + topModel_AmtRpart_module_sub__kao_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + topModel_AmtRpart_module_sub__ka_f + topModel_AmtRpart_module_sub__ka_r + + Ara_AraC_protein + + topModel_AmtRpart_module_sub__nc + + + + + + + + + 1 + + + + + topModel_AmtRpart_module_sub__ko_f + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + + topModel_AmtRpart_module_sub__kao_f + topModel_AmtRpart_module_sub__kao_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + topModel_AmtRpart_module_sub__ka_f + topModel_AmtRpart_module_sub__ka_r + + Ara_AraC_protein + + topModel_AmtRpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_AmtRpart_module_sub__pBAD + topModel_AmtRpart_module_sub__ko + + topModel_AmtRpart_module_sub__ko_f + + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + 1 + + + + + topModel_AmtRpart_module_sub__ko_f + topModel_AmtRpart_module_sub__ko_r + + topModel_AmtRpart_module_sub__nr + + + + + + + + + topModel_AmtRpart_module_sub__kr_f + topModel_AmtRpart_module_sub__kr_r + + BM3R1_protein + + topModel_AmtRpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_Inverter2_module_sub__Inverter2_fc + topModel_Inverter2_module_sub__ko + + topModel_Inverter2_module_sub__ko_f + + topModel_Inverter2_module_sub__ko_r + + topModel_Inverter2_module_sub__nr + + + + + + 1 + + + + + topModel_Inverter2_module_sub__ko_f + topModel_Inverter2_module_sub__ko_r + + topModel_Inverter2_module_sub__nr + + + + + + + + + topModel_Inverter2_module_sub__kr_f + topModel_Inverter2_module_sub__kr_r + + TetR_protein + + topModel_Inverter2_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_YFPpart_module_sub__pBetI + topModel_YFPpart_module_sub__ko + + topModel_YFPpart_module_sub__ko_f + + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + 1 + + + + + topModel_YFPpart_module_sub__ko_f + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + + + + topModel_YFPpart_module_sub__kr_f + topModel_YFPpart_module_sub__kr_r + + PhlF_protein + + topModel_YFPpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_YFPpart_module_sub__pPhlF + topModel_YFPpart_module_sub__ko + + topModel_YFPpart_module_sub__ko_f + + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + 1 + + + + + topModel_YFPpart_module_sub__ko_f + topModel_YFPpart_module_sub__ko_r + + topModel_YFPpart_module_sub__nr + + + + + + + + + topModel_YFPpart_module_sub__kr_f + topModel_YFPpart_module_sub__kr_r + + BetI_protein + + topModel_YFPpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_Inverter1_module_sub__Inverter1_fc + + + + + + + + + topModel_Inverter1_module_sub__kb + topModel_Inverter1_module_sub__ko_f + + topModel_Inverter1_module_sub__ko_r + + topModel_Inverter1_module_sub__nr + + + + + + + + + + topModel_Inverter1_module_sub__ka + topModel_Inverter1_module_sub__kao_f + + topModel_Inverter1_module_sub__kao_r + + topModel_Inverter1_module_sub__nr + + + + + + + + topModel_Inverter1_module_sub__ka_f + topModel_Inverter1_module_sub__ka_r + + Ara_AraC_protein + + topModel_Inverter1_module_sub__nc + + + + + + + + + 1 + + + + + topModel_Inverter1_module_sub__ko_f + topModel_Inverter1_module_sub__ko_r + + topModel_Inverter1_module_sub__nr + + + + + + + + + topModel_Inverter1_module_sub__kao_f + topModel_Inverter1_module_sub__kao_r + + topModel_Inverter1_module_sub__nr + + + + + + + + topModel_Inverter1_module_sub__ka_f + topModel_Inverter1_module_sub__ka_r + + Ara_AraC_protein + + topModel_Inverter1_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_PhlFpart_module_sub__pTac + topModel_PhlFpart_module_sub__ko + + topModel_PhlFpart_module_sub__ko_f + + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + 1 + + + + + topModel_PhlFpart_module_sub__ko_f + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + + + + topModel_PhlFpart_module_sub__kr_f + topModel_PhlFpart_module_sub__kr_r + + LacI_protein + + topModel_PhlFpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + topModel_PhlFpart_module_sub__pAmtR + topModel_PhlFpart_module_sub__ko + + topModel_PhlFpart_module_sub__ko_f + + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + 1 + + + + + topModel_PhlFpart_module_sub__ko_f + topModel_PhlFpart_module_sub__ko_r + + topModel_PhlFpart_module_sub__nr + + + + + + + + + topModel_PhlFpart_module_sub__kr_f + topModel_PhlFpart_module_sub__kr_r + + AmtR_protein + + topModel_PhlFpart_module_sub__nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + AmtR_protein + + + + + + + diff --git a/prismtest/Majority_10_10.xml b/prismtest/Majority_10_10.xml new file mode 100644 index 000000000..cc64d5775 --- /dev/null +++ b/prismtest/Majority_10_10.xml @@ -0,0 +1,1427 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + t + + + x + + + + + + t + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + F + + + t + 2100 + + + + + + E + 40 + + + + C + 20 + + + + + + + + + + + + + + + + kd + C + + + + + + + + + + + + + kd + D + + + + + + + + + + + + + kd + E + + + + + + + + + + + + + kd + X + + + + + + + + + + + + + kd + Y + + + + + + + + + + + + + kd + Z + + + + + + + + + + + + + + + + + + + + + + + + + + P1 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + A + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + P2 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + B + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + P3 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + D + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + P4 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + X + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + P5 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + Y + + nc + + + + + + + + + + + + + + + + + + + + + + + + + P6 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + Z + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + P7 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + D + + nc + + + + + + + + + + + + + + + + + + + + + + + + + P8 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + E + + nc + + + + + + + + + diff --git a/prismtest/SimpleChem.props b/prismtest/SimpleChem.props new file mode 100644 index 000000000..3cf2a0d0e --- /dev/null +++ b/prismtest/SimpleChem.props @@ -0,0 +1,5 @@ +// File generated by SBML-to-PRISM converter +// Original file: SimpleChem.xml +// @GeneticLogicLab + +P=? [F<=100 (S2 > 8)] \ No newline at end of file diff --git a/prismtest/SimpleChem.sm b/prismtest/SimpleChem.sm new file mode 100644 index 000000000..5b2a5960b --- /dev/null +++ b/prismtest/SimpleChem.sm @@ -0,0 +1,65 @@ +// File generated by SBML-to-PRISM converter +// Original file: SimpleChem.xml +// @GeneticLogicLab + +ctmc + +// const int MAX_AMOUNT = ADD VALUE + +// Compartment size +const double Cell = 1.0; + +// Model parameters +const double kd = 0.0075; // Degradation rate + +// Species S0 +// const int S0_MAX = MAX_AMOUNT; +module S0 + + // S0 : [0..S0_MAX] init 10; + S0 : int init 10; + + // R0 + [R0] S0 > 0 -> (S0'=S0-1); + +endmodule + +// Species S1 +// const int S1_MAX = MAX_AMOUNT; +module S1 + + // S1 : [0..S1_MAX] init 10; + S1 : int init 10; + + // R0 + [R0] S1 > 0 -> (S1'=S1-1); + +endmodule + +// Species S2 +// const int S2_MAX = MAX_AMOUNT; +module S2 + + // S2 : [0..S2_MAX] init 0; + S2 : int init 0; + + // R0 + [R0] S2 >= 0 -> (S2'=S2+1); + +endmodule + +// Reaction rates +module reaction_rates + + // R0: -> S2 + [R0] ((kf * S0) * S1) > 0 -> (((kf * S0) * S1)) : true; + +endmodule + +// Reward structures (one per species) +// Reward 1: S0 +rewards "S0" true : S0; endrewards +// Reward 2: S1 +rewards "S1" true : S1; endrewards +// Reward 3: S2 +rewards "S2" true : S2; endrewards diff --git a/prismtest/SimpleChem.xml b/prismtest/SimpleChem.xml new file mode 100644 index 000000000..5d27c5bd8 --- /dev/null +++ b/prismtest/SimpleChem.xml @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + t + + + x + + + + + + t + + + + x + + + + + + + + + + + + + + + + + + + + + + F + + + t + 100 + + + + S2 + 8 + + + + + + + + + + + + + + + + + + + + + kf + S0 + + S1 + + + + + + + + + + + \ No newline at end of file diff --git a/prismtest/SimpleHierchyModel/DSensor.xml b/prismtest/SimpleHierchyModel/DSensor.xml new file mode 100644 index 000000000..b20f60271 --- /dev/null +++ b/prismtest/SimpleHierchyModel/DSensor.xml @@ -0,0 +1,263 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + P0 + + + + + + + + + kb + ko_f + + ko_r + + nr + + + + + + + + + + ka + kao_f + + kao_r + + nr + + + + + + + + ka_f + ka_r + + D + + nc + + + + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kao_f + kao_r + + nr + + + + + + + + ka_f + ka_r + + D + + nc + + + + + + + + + + + + + + + + + kd + S1 + + + + + + + + \ No newline at end of file diff --git a/prismtest/SimpleHierchyModel/manifest.xml b/prismtest/SimpleHierchyModel/manifest.xml new file mode 100644 index 000000000..c6a6be97e --- /dev/null +++ b/prismtest/SimpleHierchyModel/manifest.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/prismtest/SimpleHierchyModel/metadata.rdf b/prismtest/SimpleHierchyModel/metadata.rdf new file mode 100644 index 000000000..218b0511f --- /dev/null +++ b/prismtest/SimpleHierchyModel/metadata.rdf @@ -0,0 +1,2 @@ + + diff --git a/prismtest/SimpleHierchyModel/topModel.props b/prismtest/SimpleHierchyModel/topModel.props new file mode 100644 index 000000000..699e82d3e --- /dev/null +++ b/prismtest/SimpleHierchyModel/topModel.props @@ -0,0 +1,4 @@ +// File generated by SBML-to-PRISM converter +// Original file: SimpleHierchyModel/topModel.xml +// @GeneticLogicLab + diff --git a/prismtest/SimpleHierchyModel/topModel.sm b/prismtest/SimpleHierchyModel/topModel.sm new file mode 100644 index 000000000..75e042b33 --- /dev/null +++ b/prismtest/SimpleHierchyModel/topModel.sm @@ -0,0 +1,97 @@ +// File generated by SBML-to-PRISM converter +// Original file: SimpleHierchyModel/topModel.xml +// @GeneticLogicLab + +ctmc + +// const int MAX_AMOUNT = ADD VALUE + +// Compartment size +const double Cell = 1.0; + +// Model parameters +const double kr_f = 0.5; // Forward repression binding rate +const double kr_r = 1.0; // Reverse repression binding rate +const double ka_f = 0.0033; // Forward activation binding rate +const double ka_r = 1.0; // Reverse activation binding rate +const double ko_f = 0.033; // Forward RNAP binding rate +const double ko_r = 1.0; // Reverse RNAP binding rate +const double kao_f = 1.0; // Forward activated RNAP binding rate +const double kao_r = 1.0; // Reverse activated RNAP binding rate +const double nc = 2.0; // Stoichiometry of binding +const double nr = 30.0; // Initial RNAP count +const double ko = 0.05; // Open complex production rate +const double kb = 1.0E-4; // Basal production rate +const double ng = 2.0; // Initial promoter count +const double np = 10.0; // Stoichiometry of production +const double ka = 0.25; // Activated production rate +const double kd = 0.0075; // Degradation rate +const double C1__kr_f = 0.5; // Forward repression binding rate +const double C1__kr_r = 1.0; // Reverse repression binding rate +const double C1__ka_f = 0.0033; // Forward activation binding rate +const double C1__ka_r = 1.0; // Reverse activation binding rate +const double C1__ko_f = 0.033; // Forward RNAP binding rate +const double C1__ko_r = 1.0; // Reverse RNAP binding rate +const double C1__kao_f = 1.0; // Forward activated RNAP binding rate +const double C1__kao_r = 1.0; // Reverse activated RNAP binding rate +const double C1__nc = 2.0; // Stoichiometry of binding +const double C1__nr = 30.0; // Initial RNAP count +const double C1__ko = 0.05; // Open complex production rate +const double C1__kb = 1.0E-4; // Basal production rate +const double C1__ng = 2.0; // Initial promoter count +const double C1__np = 10.0; // Stoichiometry of production +const double C1__ka = 0.25; // Activated production rate +const double C1__kd = 0.0075; // Degradation rate + +// Species S2 +// const int S2_MAX = MAX_AMOUNT; +module S2 + + // S2 : [0..S2_MAX] init 60; + S2 : int init 60; + + +endmodule + +// Species S3 +// const int S3_MAX = MAX_AMOUNT; +module S3 + + // S3 : [0..S3_MAX] init 0; + S3 : int init 0; + + // C1__Production_P0 + [C1__Production_P0] S3 >= 0 -> (S3'=S3+10); + // Degradation_S3 + [Degradation_S3] S3 > 0 -> (S3'=S3-1); + +endmodule + +// Species C1__P0 +// const int C1__P0_MAX = MAX_AMOUNT; +module C1__P0 + + // C1__P0 : [0..C1__P0_MAX] init 2; + C1__P0 : int init 2; + + +endmodule + +// Reaction rates +module reaction_rates + + // C1__Production_P0: -> S3 + [C1__Production_P0] ((C1__P0 * ((((C1__kb * C1__ko_f) / C1__ko_r) * C1__nr) + ((((C1__ka * C1__kao_f) / C1__kao_r) * C1__nr) * pow(((C1__ka_f / C1__ka_r) * S2) , C1__nc)))) / ((1 + ((C1__ko_f / C1__ko_r) * C1__nr)) + (((C1__kao_f / C1__kao_r) * C1__nr) * pow(((C1__ka_f / C1__ka_r) * S2) , C1__nc)))) > 0 -> (((C1__P0 * ((((C1__kb * C1__ko_f) / C1__ko_r) * C1__nr) + ((((C1__ka * C1__kao_f) / C1__kao_r) * C1__nr) * pow(((C1__ka_f / C1__ka_r) * S2) , C1__nc)))) / ((1 + ((C1__ko_f / C1__ko_r) * C1__nr)) + (((C1__kao_f / C1__kao_r) * C1__nr) * pow(((C1__ka_f / C1__ka_r) * S2) , C1__nc))))) : true; + + // Degradation_S3: -> + [Degradation_S3] (C1__kd * S3) > 0 -> ((C1__kd * S3)) : true; + +endmodule + +// Reward structures (one per species) +// Reward 1: S2 +rewards "S2" true : S2; endrewards +// Reward 2: S3 +rewards "S3" true : S3; endrewards +// Reward 3: C1__P0 +rewards "C1__P0" true : C1__P0; endrewards diff --git a/prismtest/SimpleHierchyModel/topModel.xml b/prismtest/SimpleHierchyModel/topModel.xml new file mode 100644 index 000000000..99d9008af --- /dev/null +++ b/prismtest/SimpleHierchyModel/topModel.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + kd + S3 + + + + + + + + \ No newline at end of file diff --git a/prismtest/SimplerChem.xml b/prismtest/SimplerChem.xml new file mode 100644 index 000000000..574cb3a03 --- /dev/null +++ b/prismtest/SimplerChem.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + t + + + x + + + + + + t + + + + x + + + + + + + + + + + + + + + + + + + + F + + + t + 100 + + + + S0 + 1 + + + + + + + + + + + + + + + kd + S0 + + + + + + + \ No newline at end of file diff --git a/prismtest/Speed_Independent_10_10.xml b/prismtest/Speed_Independent_10_10.xml new file mode 100644 index 000000000..7b0a500b1 --- /dev/null +++ b/prismtest/Speed_Independent_10_10.xml @@ -0,0 +1,1770 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + t + + + x + + + + + + t + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + F + + + t + 2100 + + + + + + S2 + 80 + + + + S3 + 20 + + + + + + + + + + + + + + + + kd + S4 + + + + + + + + + + + + + kd + S1 + + + + + + + + + + + + + kd + Z + + + + + + + + + + + + + kd + C + + + + + + + + + + + + + + + + + + + + + + + P10 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + S2 + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + P1 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + A + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + P2 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + B + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + P3 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + S4 + + nc + + + + + + + + + + + + + + + + + + + + + + + + + P4 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + X + + nc + + + + + + + + + + + + + + + + + + + + + + + + + P5 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + S1 + + nc + + + + + + + + + + + + + + + + + + + + + + + + + P6 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + S2 + + nc + + + + + + + + + + + + + + + + + + + + + + + + + P7 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + Y + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + P8 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + S3 + + nc + + + + + + + + + + + + + + + + + + + + + + + + + P9 + ko + + + + ko_f + ko_r + + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + Z + + nc + + + + + + + + + + + + + + + kd + X + + + + + + + + + + + + + kd + S2 + + + + + + + + + + + + + kd + S3 + + + + + + + + + + + + + kd + Y + + + + + + + diff --git a/prismtest/Toggle_10_10.props b/prismtest/Toggle_10_10.props new file mode 100644 index 000000000..4dd9df6ec --- /dev/null +++ b/prismtest/Toggle_10_10.props @@ -0,0 +1,5 @@ +// File generated by SBML-to-PRISM converter +// Original file: Toggle_10_10.xml +// @GeneticLogicLab + +P=? [F<=2100 ((Z > 80) & (Y < 40))] \ No newline at end of file diff --git a/prismtest/Toggle_10_10.sm b/prismtest/Toggle_10_10.sm new file mode 100644 index 000000000..e86b8e68c --- /dev/null +++ b/prismtest/Toggle_10_10.sm @@ -0,0 +1,320 @@ +// File generated by SBML-to-PRISM converter +// Original file: Toggle_10_10.xml +// @GeneticLogicLab + +ctmc + +// const int MAX_AMOUNT = ADD VALUE + +// Compartment size +const double Cell = 1.0; + +// Model parameters +const double kr_f = 0.5; // Forward repression binding rate +const double kr_r = 1.0; // Reverse repression binding rate +const double ka_f = 0.0033; // Forward activation binding rate +const double ka_r = 1.0; // Reverse activation binding rate +const double ko_f = 0.033; // Forward RNAP binding rate +const double ko_r = 1.0; // Reverse RNAP binding rate +const double kao_f = 1.0; // Forward activated RNAP binding rate +const double kao_r = 1.0; // Reverse activated RNAP binding rate +const double nc = 2.0; // Stoichiometry of binding +const double nr = 30.0; // Initial RNAP count +const double ko = 0.05; // Open complex production rate +const double kb = 1.0E-4; // Basal production rate +const double ng = 2.0; // Initial promoter count +const double np = 10.0; // Stoichiometry of production +const double ka = 0.25; // Activated production rate +const double kd = 7.5E-4; // Degradation rate + +// Species _A +// const int _A_MAX = MAX_AMOUNT; +module _A + + // _A : [0.._A_MAX] init 0; + _A : int init 0; + + +endmodule + +// Species D +// const int D_MAX = MAX_AMOUNT; +module D + + // D : [0..D_MAX] init 70; + D : int init 70; + + // Production_P1 + [Production_P1] D >= 0 -> (D'=D+10); + // Degradation_D + [Degradation_D] D > 9 -> (D'=D-10); + +endmodule + +// Species B +// const int B_MAX = MAX_AMOUNT; +module B + + // B : [0..B_MAX] init 120; + B : int init 120; + + +endmodule + +// Species Y +// const int Y_MAX = MAX_AMOUNT; +module Y + + // Y : [0..Y_MAX] init 70; + Y : int init 70; + + // Production_P3 + [Production_P3] Y >= 0 -> (Y'=Y+10); + // Production_P5 + [Production_P5] Y >= 0 -> (Y'=Y+10); + // Degradation_Y + [Degradation_Y] Y > 9 -> (Y'=Y-10); + +endmodule + +// Species _E +// const int _E_MAX = MAX_AMOUNT; +module _E + + // _E : [0.._E_MAX] init 0; + _E : int init 0; + + // Production_P2 + [Production_P2] _E >= 0 -> (_E'=_E+10); + // Degradation_E + [Degradation_E] _E > 9 -> (_E'=_E-10); + +endmodule + +// Species _X +// const int _X_MAX = MAX_AMOUNT; +module _X + + // _X : [0.._X_MAX] init 70; + _X : int init 70; + + // Production_P1 + [Production_P1] _X >= 0 -> (_X'=_X+10); + // Production_P2 + [Production_P2] _X >= 0 -> (_X'=_X+10); + // Degradation_X + [Degradation_X] _X > 9 -> (_X'=_X-10); + +endmodule + +// Species FF +// const int FF_MAX = MAX_AMOUNT; +module FF + + // FF : [0..FF_MAX] init 70; + FF : int init 70; + + // Production_P8 + [Production_P8] FF >= 0 -> (FF'=FF+10); + // Production_P7 + [Production_P7] FF >= 0 -> (FF'=FF+10); + // Degradation_FF + [Degradation_FF] FF > 9 -> (FF'=FF-10); + +endmodule + +// Species Z +// const int Z_MAX = MAX_AMOUNT; +module Z + + // Z : [0..Z_MAX] init 0; + Z : int init 0; + + // Production_P4 + [Production_P4] Z >= 0 -> (Z'=Z+10); + // Production_P6 + [Production_P6] Z >= 0 -> (Z'=Z+10); + // Degradation_Z + [Degradation_Z] Z > 9 -> (Z'=Z-10); + +endmodule + +// Species _C +// const int _C_MAX = MAX_AMOUNT; +module _C + + // _C : [0.._C_MAX] init 70; + _C : int init 70; + + // Production_P5 + [Production_P5] _C >= 0 -> (_C'=_C+10); + // Degradation_C + [Degradation_C] _C > 9 -> (_C'=_C-10); + +endmodule + +// Species P8 +// const int P8_MAX = MAX_AMOUNT; +module P8 + + // P8 : [0..P8_MAX] init 2; + P8 : int init 2; + + +endmodule + +// Species P1 +// const int P1_MAX = MAX_AMOUNT; +module P1 + + // P1 : [0..P1_MAX] init 2; + P1 : int init 2; + + +endmodule + +// Species P2 +// const int P2_MAX = MAX_AMOUNT; +module P2 + + // P2 : [0..P2_MAX] init 2; + P2 : int init 2; + + +endmodule + +// Species P3 +// const int P3_MAX = MAX_AMOUNT; +module P3 + + // P3 : [0..P3_MAX] init 2; + P3 : int init 2; + + +endmodule + +// Species P4 +// const int P4_MAX = MAX_AMOUNT; +module P4 + + // P4 : [0..P4_MAX] init 2; + P4 : int init 2; + + +endmodule + +// Species P5 +// const int P5_MAX = MAX_AMOUNT; +module P5 + + // P5 : [0..P5_MAX] init 2; + P5 : int init 2; + + +endmodule + +// Species P6 +// const int P6_MAX = MAX_AMOUNT; +module P6 + + // P6 : [0..P6_MAX] init 2; + P6 : int init 2; + + +endmodule + +// Species P7 +// const int P7_MAX = MAX_AMOUNT; +module P7 + + // P7 : [0..P7_MAX] init 2; + P7 : int init 2; + + +endmodule + +// Reaction rates +module reaction_rates + + // Production_P8: -> FF + [Production_P8] (((((P8 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) *_E) , nc))) > 0 -> ((((((P8 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) *_E) , nc)))) : true; + + // Production_P1: -> D _X + [Production_P1] (((((P1 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) *_A) , nc))) > 0 -> ((((((P1 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) *_A) , nc)))) : true; + + // Production_P2: -> _E _X + [Production_P2] (((((P2 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * B) , nc))) > 0 -> ((((((P2 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * B) , nc)))) : true; + + // Production_P3: -> Y + [Production_P3] (((((P3 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) *_X) , nc))) > 0 -> ((((((P3 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) *_X) , nc)))) : true; + + // Production_P4: -> Z + [Production_P4] (((((P4 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * FF) , nc))) > 0 -> ((((((P4 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * FF) , nc)))) : true; + + // Production_P5: -> _C Y + [Production_P5] (((((P5 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * Z) , nc))) > 0 -> ((((((P5 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * Z) , nc)))) : true; + + // Production_P6: -> Z + [Production_P6] (((((P6 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * Y) , nc))) > 0 -> ((((((P6 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * Y) , nc)))) : true; + + // Production_P7: -> FF + [Production_P7] (((((P7 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * D) , nc))) > 0 -> ((((((P7 * ko) * ko_f) / ko_r) * nr) / ((1 + ((ko_f / ko_r) * nr)) + pow(((kr_f / kr_r) * D) , nc)))) : true; + + // Degradation_E: -> + [Degradation_E] (kd *_E) > 0 -> ((kd *_E)) : true; + + // Degradation_C: -> + [Degradation_C] (kd *_C) > 0 -> ((kd *_C)) : true; + + // Degradation_X: -> + [Degradation_X] (kd *_X) > 0 -> ((kd *_X)) : true; + + // Degradation_D: -> + [Degradation_D] (kd * D) > 0 -> ((kd * D)) : true; + + // Degradation_FF: -> + [Degradation_FF] (kd * FF) > 0 -> ((kd * FF)) : true; + + // Degradation_Y: -> + [Degradation_Y] (kd * Y) > 0 -> ((kd * Y)) : true; + + // Degradation_Z: -> + [Degradation_Z] (kd * Z) > 0 -> ((kd * Z)) : true; + +endmodule + +// Reward structures (one per species) +// Reward 1: _A +rewards "_A" true : _A; endrewards +// Reward 2: D +rewards "D" true : D; endrewards +// Reward 3: B +rewards "B" true : B; endrewards +// Reward 4: Y +rewards "Y" true : Y; endrewards +// Reward 5: _E +rewards "_E" true : _E; endrewards +// Reward 6: _X +rewards "_X" true : _X; endrewards +// Reward 7: FF +rewards "FF" true : FF; endrewards +// Reward 8: Z +rewards "Z" true : Z; endrewards +// Reward 9: _C +rewards "_C" true : _C; endrewards +// Reward 10: P8 +rewards "P8" true : P8; endrewards +// Reward 11: P1 +rewards "P1" true : P1; endrewards +// Reward 12: P2 +rewards "P2" true : P2; endrewards +// Reward 13: P3 +rewards "P3" true : P3; endrewards +// Reward 14: P4 +rewards "P4" true : P4; endrewards +// Reward 15: P5 +rewards "P5" true : P5; endrewards +// Reward 16: P6 +rewards "P6" true : P6; endrewards +// Reward 17: P7 +rewards "P7" true : P7; endrewards diff --git a/prismtest/Toggle_10_10.xml b/prismtest/Toggle_10_10.xml new file mode 100644 index 000000000..59265dc8b --- /dev/null +++ b/prismtest/Toggle_10_10.xml @@ -0,0 +1,1478 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + t + + + x + + + + + + t + + + + x + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + F + + + t + 2100 + + + + + + Z + 80 + + + + Y + 40 + + + + + + + + + + + + + + + + + + + + + + + + + + + + P8 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + E + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + P1 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + A + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + P2 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + B + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + P3 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + X + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + P4 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + FF + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + + P5 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + Z + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + P6 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + Y + + nc + + + + + + + + + + + + + + + + + + + + + + + + + + + P7 + ko + + ko_f + + ko_r + + nr + + + + + + 1 + + + + + ko_f + ko_r + + nr + + + + + + + + + kr_f + kr_r + + D + + nc + + + + + + + + + + + + + + + kd + E + + + + + + + + + + + + + kd + C + + + + + + + + + + + + + kd + X + + + + + + + + + + + + + kd + D + + + + + + + + + + + + + kd + FF + + + + + + + + + + + + + kd + Y + + + + + + + + + + + + + kd + Z + + + + + + + diff --git a/prismtest/pro.csl b/prismtest/pro.csl new file mode 100644 index 000000000..e86fc37d7 --- /dev/null +++ b/prismtest/pro.csl @@ -0,0 +1,10 @@ + +// Hazard for transitions where YFP should remain low: the probability that YFP reaches 30 or above molecules + +P=? [ true U[0,1000] (YFP_protein >= 30) ] + +//P=? [ true U[0,1000] (YFP_protein > 30) ] + +// // For 010to111 and 100to111 +// P=? [!(true U[0,1000] (YFP_protein > 30)) ] + diff --git a/prismtest/results.txt b/prismtest/results.txt new file mode 100644 index 000000000..7ec12848e --- /dev/null +++ b/prismtest/results.txt @@ -0,0 +1,2 @@ +0.0 +0.9997151321743104 From 7e8f2e6f9fa6d8cb1abcf475ef6609e7a1a92b61 Mon Sep 17 00:00:00 2001 From: LukasBuecherl Date: Tue, 28 Mar 2023 15:11:14 +0100 Subject: [PATCH 12/13] Print props file --- .../java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java index 234565457..c53f1fc60 100644 --- a/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java +++ b/conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBML2PRISM.java @@ -413,7 +413,7 @@ public static void convertSBML2PRISM(SBMLDocument sbmlDoc, String filename, bool out.close(); - // writePRISMProperty(filename, model); + writePRISMProperty(filename, model); } From a3623c4a34fd5e94c453a13e5eeb0d2ee3d56e5d Mon Sep 17 00:00:00 2001 From: LukasBuecherl <60665186+LukasBuecherl@users.noreply.github.com> Date: Tue, 28 Mar 2023 15:15:11 +0100 Subject: [PATCH 13/13] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a9b87e12..b68bcf81d 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ biology. ##### Video Demo: [Tools Workflow](https://www.youtube.com/watch?v=g4xayzlyC2Q) ##### Contact: Chris Myers (@cjmyers) myers@ece.utah.edu -Contributor(s): Nathan Barker, Pedro Fontanarrosa, Scott Glass, Kevin Jones, Hiroyuki Kuwahara, Curtis Madsen, Nam Nguyen, Tramy Nguyen, Tyler Patterson, Nicholas Roehner, Jason Stevens, Leandro Watanabe, Michael Zhang, Zhen Zhang, and Zach Zundel. +Contributor(s): Nathan Barker, Lukas Buecherl, Pedro Fontanarrosa, Scott Glass, Kevin Jones, Hiroyuki Kuwahara, Curtis Madsen, Nam Nguyen, Tramy Nguyen, Tyler Patterson, Nicholas Roehner, Jason Stevens, Leandro Watanabe, Michael Zhang, Zhen Zhang, and Zach Zundel. -Active Developer(s): Pedro Fontanarrosa, Chris Myers, Tramy Nguyen, Leandro Watanabe. +Active Developer(s): Lukas Buecherl, Pedro Fontanarrosa, Chris Myers. ## Running iBioSim 1. Download the iBioSim tool from the release page [here](https://github.com/MyersResearchGroup/iBioSim/releases):