public static int Main(string[] args) { if (args.Length != 1) { Console.Write(Environment.NewLine + "Usage: printMath filename" + Environment.NewLine + Environment.NewLine); return(1); } string filename = args[0]; SBMLDocument document = libsbml.readSBML(filename); if (document.getNumErrors() > 0) { Console.Error.Write("Encountered the following SBML errors:" + Environment.NewLine); document.printErrors(new OStream(OStream.CERR)); return(1); } Model model = document.getModel(); if (model == null) { Console.Write("No model present." + Environment.NewLine); return(1); } printMath(model); Console.WriteLine(); return(0); }
public static void Main(string[] args) { if (args.Length != 2) { string myname = Path.GetFileName(Environment.GetCommandLineArgs()[0]); Console.WriteLine("Usage: {0} input-filename output-filename", myname); Environment.Exit(1); } string inputFile = args[0]; string outputFile = args[1]; if (!File.Exists(inputFile)) { Console.WriteLine("[Error] {0} : No such file.", inputFile); Environment.Exit(1); } SBMLReader reader = new SBMLReader(); SBMLWriter writer = new SBMLWriter(); SBMLDocument sbmlDoc = reader.readSBML(inputFile); if (sbmlDoc.getNumErrors() > 0) { sbmlDoc.printErrors(); Console.WriteLine("[Error] Cannot read {0}", inputFile); Environment.Exit(1); } writer.writeSBML(sbmlDoc, outputFile); Console.WriteLine("[OK] Echoed {0} to {1}", inputFile, outputFile); }
public static int Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Usage: inlineInitialAssignments filename outFile"); return(1); } string filename = args[0]; string outFile = args[1]; long current = DateTime.Now.Ticks; SBMLDocument document = libsbml.readSBML(filename); if (document.getNumErrors(libsbml.LIBSBML_SEV_ERROR) > 0) { Console.WriteLine("The models contains errors, please correct them before continuing."); document.printErrors(); return(1); } var model = document.getModel(); SBMLTransforms.expandInitialAssignments(model); libsbml.writeSBML(document, outFile); return(0); }
public static int Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: readSBML filename"); return(1); } string filename = args[0]; long current = DateTime.Now.Ticks; SBMLDocument document = libsbml.readSBML(filename); int errors = (int)document.getNumErrors(); Console.WriteLine(); Console.WriteLine(" filename: " + filename); Console.WriteLine(" file size: " + new FileInfo(filename).Length); Console.WriteLine(" read time (ms): " + (DateTime.Now.Ticks - current)); Console.WriteLine(" validation error(s): " + errors); Console.WriteLine(); document.printErrors(); return(errors); }
public static int Main(string[] args) { if (args.Length != 4) { Console.WriteLine("Usage: replaceOneFD filename functionDefinitionId reactionId outfile"); return(1); } string filename = args[0]; string outFile = args[3]; string functionDefinitionId = args[1]; string reactionId = args[2]; long current = DateTime.Now.Ticks; SBMLDocument document = libsbml.readSBML(filename); if (document.getNumErrors(libsbml.LIBSBML_SEV_ERROR) > 0) { Console.WriteLine("The models contains errors, please correct them before continuing."); document.printErrors(); return(1); } var model = document.getModel(); var functionDefinition = model.getFunctionDefinition(functionDefinitionId); if (functionDefinition == null) { Console.WriteLine(); Console.WriteLine("No functiondefinition with the given id can be found."); return(1); } var reaction = model.getReaction(reactionId); if (reaction == null) { Console.WriteLine(); Console.WriteLine("No reaction with the given id can be found."); return(1); } if (!reaction.isSetKineticLaw() || !reaction.getKineticLaw().isSetMath()) { Console.WriteLine(); Console.WriteLine("The reaction has no math set. "); return(1); } // Until here it was all setup, all we needed was an ASTNode, in which we wanted to // replace calls to a function definition, with the function definitions content. // SBMLTransforms.replaceFD(reaction.getKineticLaw().getMath(), functionDefinition); // finally write to file libsbml.writeSBML(document, outFile); return(0); }
public static int Main(string[] args) { if (args.Length != 1) { Console.Write(Environment.NewLine + "Usage: printSBML filename" + Environment.NewLine + Environment.NewLine); return(1); } string filename = args[0]; SBMLDocument document = libsbml.readSBML(filename); if (document.getNumErrors() > 0) { Console.WriteLine("Encountered the following SBML errors:" + Environment.NewLine); document.printErrors(); return(1); } int level = (int)document.getLevel(); int version = (int)document.getVersion(); Console.Write(Environment.NewLine + "File: " + filename + " (Level " + level + ", version " + version + ")" + Environment.NewLine); Model model = document.getModel(); if (model == null) { Console.Write("No model present." + Environment.NewLine); return(1); } Console.Write(" " + (level == 1 ? "name: " : " id: ") + (model.isSetId() ? model.getId() : "(empty)") + Environment.NewLine); if (model.isSetSBOTerm()) { Console.Write(" model sboTerm: " + model.getSBOTerm() + Environment.NewLine); } Console.Write("functionDefinitions: " + model.getNumFunctionDefinitions() + Environment.NewLine); Console.Write(" unitDefinitions: " + model.getNumUnitDefinitions() + Environment.NewLine); Console.Write(" compartmentTypes: " + model.getNumCompartmentTypes() + Environment.NewLine); Console.Write(" specieTypes: " + model.getNumSpeciesTypes() + Environment.NewLine); Console.Write(" compartments: " + model.getNumCompartments() + Environment.NewLine); Console.Write(" species: " + model.getNumSpecies() + Environment.NewLine); Console.Write(" parameters: " + model.getNumParameters() + Environment.NewLine); Console.Write(" initialAssignments: " + model.getNumInitialAssignments() + Environment.NewLine); Console.Write(" rules: " + model.getNumRules() + Environment.NewLine); Console.Write(" constraints: " + model.getNumConstraints() + Environment.NewLine); Console.Write(" reactions: " + model.getNumReactions() + Environment.NewLine); Console.Write(" events: " + model.getNumEvents() + Environment.NewLine); Console.Write(Environment.NewLine); return(0); }
/// <summary> /// The program is to be invoked with two arguments, the input and output file. /// </summary> /// <param name="args">command line arguments</param> /// <returns>0 in case of no errors</returns> public static int Main(string[] args) { if (args.Length != 2) { Console.WriteLine("{0}Usage: setIdFromNames filename output{0}{0}", Environment.NewLine); return(1); } string filename = args[0]; string output = args[1]; // read the document long start = DateTime.Now.Ticks; SBMLDocument document = libsbml.readSBMLFromFile(filename); long stop = DateTime.Now.Ticks; Console.WriteLine(); Console.WriteLine(" filename: {0}", filename); Console.WriteLine(" read time (ms): {0}", TimeSpan.FromTicks(stop - start).TotalMilliseconds); // stop in case of serious errors long errors = document.getNumErrors(libsbml.LIBSBML_SEV_ERROR); if (errors > 0) { Console.WriteLine(" error(s): {0}", errors); document.printErrors(); return((int)errors); } // get a list of all elements, as we will need to know all identifiers // so that we don't create duplicates. SBaseList allElements = document.getListOfAllElements(); // get a list of all ids var allIds = getAllIds(allElements); // create the transformer with the ids var trans = new SetIdFromNames(allIds); // rename the identifiers (using the elements we already gathered before) start = DateTime.Now.Ticks; document.getModel().renameIDs(allElements, trans); stop = DateTime.Now.Ticks; Console.WriteLine(" rename time (ms): {0}", TimeSpan.FromTicks(stop - start).TotalMilliseconds); // write to file start = DateTime.Now.Ticks; libsbml.writeSBMLToFile(document, output); stop = DateTime.Now.Ticks; Console.WriteLine(" write time (ms): {0}", TimeSpan.FromTicks(stop - start).TotalMilliseconds); Console.WriteLine(); // if we got here all went well ... return(0); }
public static void Main(string[] args) { if (args.Length != 2) { string myname = Path.GetFileName(Environment.GetCommandLineArgs()[0]); Console.WriteLine("Usage: {0} input-filename output-filename", myname); Environment.Exit(1); } string inputFile = args[0]; string outputFile = args[1]; if (!File.Exists(inputFile)) { Console.WriteLine("[Error] {0} : No such file.", inputFile); Environment.Exit(1); } var now = DateTime.Now.Ticks; SBMLReader reader = new SBMLReader(); SBMLWriter writer = new SBMLWriter(); SBMLDocument sbmlDoc = reader.readSBML(inputFile); if (sbmlDoc.getErrorLog().getNumFailsWithSeverity(libsbml.LIBSBML_SEV_ERROR) > 0) { sbmlDoc.printErrors(); Console.WriteLine("[Error] Cannot read {0}", inputFile); Environment.Exit(1); } Console.WriteLine("Read {0} in {1}", inputFile, new TimeSpan(DateTime.Now.Ticks - now).TotalMilliseconds); /* create a new conversion properties structure */ ConversionProperties props = new ConversionProperties(); /* add an option that we want to convert a model with * L3 FBC to L2 with COBRA annotation */ props.addOption("convert fbc to cobra", true, "Convert FBC model to Cobra model"); now = DateTime.Now.Ticks; /* perform the conversion */ int result = sbmlDoc.convert(props); if (result != libsbml.LIBSBML_OPERATION_SUCCESS) { Console.WriteLine("conversion failed ... "); Environment.Exit(3); } writer.writeSBML(sbmlDoc, outputFile); Console.WriteLine("[OK] converted to FBC from {0} and wrote to {1} (in {2} msec)", inputFile, outputFile, new TimeSpan(DateTime.Now.Ticks - now).TotalMilliseconds); }
public static void Main(string[] args) { if (args.Length != 3) { string myname = Path.GetFileName(Environment.GetCommandLineArgs()[0]); Console.WriteLine("Usage: {0} input-filename package-to-strip output-filename", myname); Environment.Exit(1); } string inputFile = args[0]; string packageToStrip = args[1]; string outputFile = args[2]; if (!File.Exists(inputFile)) { Console.WriteLine("[Error] {0} : No such file.", inputFile); Environment.Exit(1); } SBMLReader reader = new SBMLReader(); SBMLWriter writer = new SBMLWriter(); SBMLDocument sbmlDoc = reader.readSBML(inputFile); if (sbmlDoc.getErrorLog().getNumFailsWithSeverity(libsbml.LIBSBML_SEV_ERROR) > 0) { sbmlDoc.printErrors(); Console.WriteLine("[Error] Cannot read {0}", inputFile); Environment.Exit(1); } /* create a new conversion properties structure */ ConversionProperties props = new ConversionProperties(); /* add an option that we want to strip a given package */ props.addOption("stripPackage", true, "Strip SBML Level 3 package constructs from the model"); /* add an option with the package we want to remove */ props.addOption("package", packageToStrip, "Name of the SBML Level 3 package to be stripped"); /* perform the conversion */ if (sbmlDoc.convert(props) != libsbml.LIBSBML_OPERATION_SUCCESS) { Console.WriteLine("conversion failed ... "); Environment.Exit(3); } writer.writeSBML(sbmlDoc, outputFile); Console.WriteLine("[OK] Stripped package '{0}' from {1} and wrote to {2}", packageToStrip, inputFile, outputFile); }
/// <summary> /// The program is to be invoked with one argument, the input file. /// </summary> /// <param name="args">command line arguments</param> /// <returns>0 in case of no errors</returns> public static int Main(string[] args) { if (args.Length != 1) { Console.WriteLine("{0}Usage: getAllElementsWithNotes filename{0}{0}", Environment.NewLine); return(1); } string filename = args[0]; // read the document long start = DateTime.Now.Ticks; SBMLDocument document = libsbml.readSBMLFromFile(filename); long stop = DateTime.Now.Ticks; Console.WriteLine(); Console.WriteLine(" filename: {0}", filename); Console.WriteLine(" read time (ms): {0}", TimeSpan.FromTicks(stop - start).TotalMilliseconds); // stop in case of serious errors long errors = document.getNumErrors(libsbml.LIBSBML_SEV_ERROR); if (errors > 0) { Console.WriteLine(" error(s): {0}", errors); document.printErrors(); return((int)errors); } // create the filter we want to use var filter = new NotesFilter(); // get a list of all elements with notes start = DateTime.Now.Ticks; Console.WriteLine(" searching ......:"); SBaseList allElements = document.getListOfAllElements(filter); stop = DateTime.Now.Ticks; Console.WriteLine(" search time (ms): {0}", TimeSpan.FromTicks(stop - start).TotalMilliseconds); Console.WriteLine(); Console.WriteLine(" elements with notes: {0}", allElements.getSize()); Console.WriteLine(); // if we got here all went well ... return(0); }
public static int Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: evaluateCustomMath formula [model containing values]"); return(1); } string formula = args[0]; string filename = args.Length == 2 ? args[1] : null; var math = libsbml.parseFormula(formula); if (math == null) { Console.WriteLine("Invalid formula, aborting."); return(1); } SBMLDocument doc = null; if (filename != null) { doc = libsbml.readSBML(filename); if (doc.getNumErrors(libsbml.LIBSBML_SEV_ERROR) > 0) { Console.WriteLine("The models contains errors, please correct them before continuing."); doc.printErrors(); return(1); } // the following maps a list of ids to their corresponding model values // this makes it possible to evaluate expressions involving SIds. SBMLTransforms.mapComponentValues(doc.getModel()); } else { // create dummy document doc = new SBMLDocument(3, 1); } var result = SBMLTransforms.evaluateASTNode(math, doc.getModel()); Console.WriteLine("{0} = {1}", formula, result); return(0); }
public static void Main(string[] args) { if (args.Length != 2) { string myname = Path.GetFileName(Environment.GetCommandLineArgs()[0]); Console.WriteLine("Usage: {0} input-filenameoutput-filename", myname); Environment.Exit(1); } string inputFile = args[0]; string outputFile = args[1]; if (!File.Exists(inputFile)) { Console.WriteLine("[Error] {0} : No such file.", inputFile); Environment.Exit(1); } SBMLReader reader = new SBMLReader(); SBMLWriter writer = new SBMLWriter(); SBMLDocument sbmlDoc = reader.readSBML(inputFile); if (sbmlDoc.getErrorLog().getNumFailsWithSeverity(libsbml.LIBSBML_SEV_ERROR) > 0) { sbmlDoc.printErrors(); Console.WriteLine("[Error] Cannot read {0}", inputFile); Environment.Exit(1); } /* create a new conversion properties structure */ ConversionProperties props = new ConversionProperties(); /* add an option that we want to promote parameters */ props.addOption("promoteLocalParameters", true, "Promotes all Local Parameters to Global ones"); /* perform the conversion */ if (sbmlDoc.convert(props) != libsbml.LIBSBML_OPERATION_SUCCESS) { Console.WriteLine("conversion failed ... "); Environment.Exit(3); } writer.writeSBML(sbmlDoc, outputFile); Console.WriteLine("[OK] promoted paramters from {0} and wrote to {1}", inputFile, outputFile); }
static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("usage: printMulti sbml-file"); return; } SBMLDocument document = libsbml.readSBMLFromFile(args[0]); if (document.getNumErrors(libsbml.LIBSBML_SEV_ERROR) > 0) { document.printErrors(); return; } Model model = document.getModel(); // print multi model information printModelInfo(model); // print multi compartment information for (int i = 0; i < model.getNumCompartments(); ++i) { printCompartmentInfo(model.getCompartment(i)); } // print multi species information for (int i = 0; i < model.getNumSpecies(); ++i) { printSpeciesInfo(model.getSpecies(i)); } // print multi reaction information for (int i = 0; i < model.getNumReactions(); ++i) { printReactionInfo(model.getReaction(i)); } }
public static int Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: addCustomValidator filename");; return(1); } // read the file name SBMLDocument document = libsbml.readSBML(args[0]); // add a custom validator document.addValidator(new MyCustomValidator()); // check consistency like before int numErrors = (int)document.checkConsistency(); // print errors and warnings document.printErrors(); // return number of errors return(numErrors); }
public static int Main(string[] args) { int retval = 0; SBMLNamespaces sbmlns = new SBMLNamespaces(3, 1, "comp", 1); // create the document SBMLDocument document = new SBMLDocument(sbmlns); // create the Model Model model = document.createModel(); // create a replacement parameter Parameter parameter = model.createParameter(); parameter.setId("x"); parameter.setConstant(true); // create a parameter to be a conversion factor Parameter param2 = model.createParameter(); param2.setId("x_conv"); param2.setMetaId("_110013"); param2.setConstant(true); // create a parameter to be a conversion factor Parameter param3 = model.createParameter(); param3.setId("lcf"); param3.setConstant(true); // Convert parameter to the plugin version so we can add the new attributes and replacements to it. CompSBasePlugin splugin = (CompSBasePlugin)(parameter.getPlugin("comp")); // Add a replaced element. ReplacedElement rep1 = splugin.createReplacedElement(); int rv = rep1.setSubmodelRef("submod1"); rv = rep1.setConversionFactor("x_conv"); rv = rep1.setIdRef("param1"); // Add a second replaced element in a different way. ReplacedElement rep2 = new ReplacedElement(); rv = rep2.setSubmodelRef("submod2"); rv = rep2.setDeletion("del1"); rv = splugin.addReplacedElement(rep2); //Now create a replaced element that points into a submodel. rep2.unsetDeletion(); rep2.setIdRef("submod2"); SBaseRef sbr5 = rep2.createSBaseRef(); sbr5.setIdRef("submodelG"); SBaseRef sbr6 = sbr5.createSBaseRef(); sbr6.setIdRef("buriedElement"); splugin.addReplacedElement(rep2); // Create a submodel CompModelPlugin mplugin = (CompModelPlugin)(model.getPlugin("comp")); CompSBMLDocumentPlugin compdoc = (CompSBMLDocumentPlugin)(document.getPlugin("comp")); compdoc.setRequired(true); ModelDefinition moddef1 = compdoc.createModelDefinition(); moddef1.setId("Mod1"); Parameter m1param1 = moddef1.createParameter(); m1param1.setId("param1"); m1param1.setConstant(true); Parameter m1param2 = moddef1.createParameter(); m1param2.setId("param2"); m1param2.setConstant(false); m1param2.setValue(3.2); ModelDefinition moddef2 = new ModelDefinition(); moddef2.setId("Mod2"); Parameter subparam2 = moddef2.createParameter(); subparam2.setId("subparam2"); subparam2.setConstant(false); compdoc.addModelDefinition(moddef2); ExternalModelDefinition extmod1 = compdoc.createExternalModelDefinition(); extmod1.setId("ExtMod1"); extmod1.setSource("urn:miriam:biomodels.db:BIOMD0000000127"); ExternalModelDefinition extmod2 = new ExternalModelDefinition(); extmod2.setId("ExtMod2"); extmod2.setSource("otherfile.xml"); extmod2.setModelRef("modelnamethere"); extmod2.setMd5("406022s908ge74sklj"); compdoc.addExternalModelDefinition(extmod2); Submodel submod1 = mplugin.createSubmodel(); submod1.setId("submod1"); submod1.setModelRef("Mod1"); Deletion del1 = submod1.createDeletion(); del1.setId("deletionA"); del1.setIdRef("param2"); Submodel submod2 = new Submodel(); submod2.setId("submod2"); submod2.setModelRef("ExtMod1"); submod2.setSubstanceConversionFactor("subcf"); submod2.setTimeConversionFactor("tcf"); submod2.setExtentConversionFactor("xtf"); Deletion del2 = new Deletion(); del2.setId("deletionB"); del2.setMetaIdRef("_0010110"); rv = submod2.addDeletion(del2); del2.setId("deletionC"); del2.unsetMetaIdRef(); del2.setPortRef("port2"); rv = submod2.addDeletion(del2); del2.unsetId(); del2.unsetPortRef(); del2.setUnitRef("mph"); rv = submod2.addDeletion(del2); del2.unsetUnitRef(); del2.setIdRef("submodG"); SBaseRef sbr = del2.createSBaseRef(); sbr.setIdRef("element5"); rv = submod2.addDeletion(del2); Deletion del3 = new Deletion(); del3.setIdRef("submodG"); SBaseRef sbr2 = new SBaseRef(); sbr2.setIdRef("subsubmodQ"); SBaseRef subsbr = sbr2.createSBaseRef(); subsbr.setPortRef("toBdel"); del3.setSBaseRef(sbr2); submod2.addDeletion(del3); mplugin.addSubmodel(submod2); Port port1 = mplugin.createPort(); port1.setId("port1"); port1.setMetaIdRef("_110013"); Port port2 = new Port(); port2.setId("port2"); port2.setIdRef("x"); mplugin.addPort(port2); port2.setId("port3"); port2.setIdRef("submod2"); port2.setSBaseRef(sbr2); mplugin.addPort(port2); libsbml.writeSBMLToFile(document, "comp_example1.xml"); document = libsbml.readSBMLFromFile("comp_example1.xml"); if (document == null) { Console.WriteLine("Error reading back in file."); retval = -1; } else { document.setConsistencyChecks(libsbml.LIBSBML_CAT_UNITS_CONSISTENCY, false); document.checkConsistency(); if (document.getErrorLog().getNumFailsWithSeverity(2) > 0 || document.getErrorLog().getNumFailsWithSeverity(3) > 0) { OStringStream stream = new OStringStream(); document.printErrors(stream); Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" + stream.str()); retval = -1; } libsbml.writeSBMLToFile(document, "comp_example1_rt.xml"); } return(retval); }
public static int Main(string[] args) { if (args.Length != 2) { Console.WriteLine(" Usage: addRenderInformation <input file> <output file> \n" + " Adds a render information object to the input file"); return(1); } string inputFile = args[0]; string outputFile = args[1]; SBMLDocument doc = libsbml.readSBMLFromFile(inputFile); long numErrors = doc.getNumErrors(libsbml.LIBSBML_SEV_ERROR); if (numErrors > 0) { Console.WriteLine("Encountered errors while reading the file. "); Console.WriteLine("Please correct the following errors and try again."); doc.printErrors(); return(2); } Model model = doc.getModel(); LayoutModelPlugin plugin = (LayoutModelPlugin)model.getPlugin("layout"); if (plugin == null || plugin.getNumLayouts() == 0) { Console.WriteLine("The loaded model contains no layout information, please add these first."); return(3); } RenderListOfLayoutsPlugin lolPlugin = (RenderListOfLayoutsPlugin)plugin.getListOfLayouts().getPlugin("render"); if (lolPlugin != null && lolPlugin.getNumGlobalRenderInformationObjects() > 0) { Console.WriteLine("The loaded model contains global Render information. "); } // add render information to the first layout Layout layout = plugin.getLayout(0); RenderLayoutPlugin rPlugin = (RenderLayoutPlugin)layout.getPlugin("render"); if (rPlugin != null && rPlugin.getNumLocalRenderInformationObjects() > 0) { Console.WriteLine("The loaded model contains local Render information. "); } else { string uri = doc.getLevel() == 2 ? RenderExtension.getXmlnsL2() : RenderExtension.getXmlnsL3V1V1(); // enable render package doc.enablePackage(uri, "render", true); doc.setPackageRequired("render", false); rPlugin = (RenderLayoutPlugin)layout.getPlugin("render"); addRenderInformation(rPlugin); libsbml.writeSBMLToFile(doc, outputFile); } return(0); }
private static int Main(string[] args) { var retval = 0; var sbmlns = new SBMLNamespaces(3, 1, "comp", 1); // create the document var document = new SBMLDocument(sbmlns); //Define the external model definition var compdoc = (CompSBMLDocumentPlugin)(document.getPlugin("comp")); compdoc.setRequired(true); var extmod = compdoc.createExternalModelDefinition(); extmod.setId("ExtMod1"); extmod.setSource("enzyme_model.xml"); extmod.setModelRef("enzyme"); //Define the 'simple' model var mod1 = compdoc.createModelDefinition(); mod1.setId("simple"); var comp = mod1.createCompartment(); comp.setSpatialDimensions(3); comp.setConstant(true); comp.setId("comp"); comp.setSize(1L); var spec = new Species(sbmlns); //We have to construct it this way because we get the comp plugin from it later. spec.setCompartment("comp"); spec.setHasOnlySubstanceUnits(false); spec.setConstant(false); spec.setBoundaryCondition(false); spec.setId("S"); spec.setInitialConcentration(5); mod1.addSpecies(spec); spec.setId("D"); spec.setInitialConcentration(10); mod1.addSpecies(spec); var rxn = new Reaction(3, 1); rxn.setReversible(true); rxn.setFast(false); rxn.setId("J0"); var sr = new SpeciesReference(3, 1); sr.setConstant(true); sr.setStoichiometry(1); sr.setSpecies("S"); rxn.addReactant(sr); sr.setSpecies("D"); rxn.addProduct(sr); mod1.addReaction(rxn); var mod1plug = (CompModelPlugin)(mod1.getPlugin("comp")); var port = new Port(); port.setId("S_port"); port.setIdRef("S"); mod1plug.addPort(port); var port2 = mod1plug.createPort(); port2.setId("D_port"); port2.setIdRef("D"); port.setId("comp_port"); port.setIdRef("comp"); mod1plug.addPort(port); port.setId("J0_port"); port.setIdRef("J0"); mod1plug.addPort(port); // create the Model var model = document.createModel(); model.setId("complexified"); // Set the submodels var mplugin = (CompModelPlugin)(model.getPlugin("comp")); var submod1 = mplugin.createSubmodel(); submod1.setId("A"); submod1.setModelRef("ExtMod1"); var submod2 = mplugin.createSubmodel(); submod2.setId("B"); submod2.setModelRef("simple"); var del = submod2.createDeletion(); del.setPortRef("J0_port"); // Synchronize the compartments var mcomp = model.createCompartment(); mcomp.setSpatialDimensions(3); mcomp.setConstant(true); mcomp.setId("comp"); mcomp.setSize(1L); var compartplug = (CompSBasePlugin)(mcomp.getPlugin("comp")); var re = new ReplacedElement(); re.setIdRef("comp"); re.setSubmodelRef("A"); compartplug.addReplacedElement(re); re.setSubmodelRef("B"); re.unsetIdRef(); re.setPortRef("comp_port"); compartplug.addReplacedElement(re); //Synchronize the species spec.setId("S"); spec.setInitialConcentration(5); var specplug = (CompSBasePlugin)(spec.getPlugin("comp")); var sre = specplug.createReplacedElement(); sre.setSubmodelRef("A"); sre.setIdRef("S"); var sre2 = specplug.createReplacedElement(); sre2.setSubmodelRef("B"); sre2.setPortRef("S_port"); model.addSpecies(spec); spec.setId("D"); spec.setInitialConcentration(10); sre.setIdRef("D"); sre2.setPortRef("D_port"); model.addSpecies(spec); libsbml.writeSBMLToFile(document, "spec_example3.xml"); document = libsbml.readSBMLFromFile("spec_example3.xml"); if (document == null) { Console.WriteLine("Error reading back in file."); retval = -1; } else { document.setConsistencyChecks(libsbml.LIBSBML_CAT_UNITS_CONSISTENCY, false); document.checkConsistency(); if (document.getErrorLog().getNumFailsWithSeverity(2) > 0 || document.getErrorLog().getNumFailsWithSeverity(3) > 0) { var stream = new OStringStream(); document.printErrors(stream); Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" + stream.str()); retval = -1; } libsbml.writeSBMLToFile(document, "spec_example3_rt.xml"); } return(retval); }
public static int Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: printUnits filename"); return(1); } string filename = args[0]; SBMLDocument document = libsbml.readSBML(filename); if (document.getNumErrors() > 0) { Console.Error.WriteLine("Encountered the following SBML errors:"); document.printErrors(); return(1); } Model model = document.getModel(); if (model == null) { Console.WriteLine("No model present."); return(1); } int i, j; for (i = 0; i < model.getNumSpecies(); i++) { Species s = model.getSpecies(i); Console.WriteLine("Species " + i + ": " + UnitDefinition.printUnits(s.getDerivedUnitDefinition())); } for (i = 0; i < model.getNumCompartments(); i++) { Compartment c = model.getCompartment(i); Console.WriteLine("Compartment " + i + ": " + UnitDefinition.printUnits(c.getDerivedUnitDefinition())) ; } for (i = 0; i < model.getNumParameters(); i++) { Parameter p = model.getParameter(i); Console.WriteLine("Parameter " + i + ": " + UnitDefinition.printUnits(p.getDerivedUnitDefinition())) ; } for (i = 0; i < model.getNumInitialAssignments(); i++) { InitialAssignment ia = model.getInitialAssignment(i); Console.WriteLine("InitialAssignment " + i + ": " + UnitDefinition.printUnits(ia.getDerivedUnitDefinition())); Console.WriteLine(" undeclared units: "); Console.WriteLine((ia.containsUndeclaredUnits() ? "yes\n" : "no\n")); } for (i = 0; i < model.getNumEvents(); i++) { Event e = model.getEvent(i); Console.WriteLine("Event " + i + ": "); if (e.isSetDelay()) { Console.WriteLine("Delay: " + UnitDefinition.printUnits(e.getDelay().getDerivedUnitDefinition())); Console.WriteLine(" undeclared units: "); Console.WriteLine((e.getDelay().containsUndeclaredUnits() ? "yes\n" : "no\n")); } for (j = 0; j < e.getNumEventAssignments(); j++) { EventAssignment ea = e.getEventAssignment(j); Console.WriteLine("EventAssignment " + j + ": " + UnitDefinition.printUnits(ea.getDerivedUnitDefinition())); Console.WriteLine(" undeclared units: "); Console.WriteLine((ea.containsUndeclaredUnits() ? "yes\n" : "no\n")); } } for (i = 0; i < model.getNumReactions(); i++) { Reaction r = model.getReaction(i); Console.WriteLine("Reaction " + i + ": "); if (r.isSetKineticLaw()) { Console.WriteLine("Kinetic Law: " + UnitDefinition.printUnits(r.getKineticLaw().getDerivedUnitDefinition())); Console.WriteLine(" undeclared units: "); Console.WriteLine((r.getKineticLaw().containsUndeclaredUnits() ? "yes\n" : "no\n")); } for (j = 0; j < r.getNumReactants(); j++) { SpeciesReference sr = r.getReactant(j); if (sr.isSetStoichiometryMath()) { Console.WriteLine("Reactant stoichiometryMath" + j + ": " + UnitDefinition.printUnits(sr.getStoichiometryMath().getDerivedUnitDefinition())); Console.WriteLine(" undeclared units: "); Console.WriteLine((sr.getStoichiometryMath().containsUndeclaredUnits() ? "yes\n" : "no\n")); } } for (j = 0; j < r.getNumProducts(); j++) { SpeciesReference sr = r.getProduct(j); if (sr.isSetStoichiometryMath()) { Console.WriteLine("Product stoichiometryMath" + j + ": " + UnitDefinition.printUnits(sr.getStoichiometryMath().getDerivedUnitDefinition())); Console.WriteLine(" undeclared units: "); Console.WriteLine((sr.getStoichiometryMath().containsUndeclaredUnits() ? "yes\n" : "no\n")); } } } for (i = 0; i < model.getNumRules(); i++) { Rule r = model.getRule(i); Console.WriteLine("Rule " + i + ": " + UnitDefinition.printUnits(r.getDerivedUnitDefinition())); Console.WriteLine(" undeclared units: "); Console.WriteLine((r.containsUndeclaredUnits() ? "yes\n" : "no\n")); } return(0); }
public static int Main(string[] args) { if (args.Length != 1) { Console.WriteLine(" Usage: printRenderInformation <input file> \n" + " prints a summary of the render information object."); return(1); } string inputFile = args[0]; SBMLDocument doc = libsbml.readSBMLFromFile(inputFile); Console.WriteLine("Using libSBML: {0} supporting packages for:", libsbml.getLibSBMLDottedVersion()); for (int i = 0; i < SBMLExtensionRegistry.getNumRegisteredPackages(); ++i) { Console.WriteLine("\t {0}", SBMLExtensionRegistry.getRegisteredPackageName(i)); } Console.WriteLine("\nThe document is: level {0}, version {1}", doc.getLevel(), doc.getVersion()); for (int i = 0; i < doc.getNumPlugins(); ++i) { Console.WriteLine(" doc uses package: {0}", doc.getPlugin(i).getElementNamespace()); } Console.WriteLine("\n"); long numErrors = doc.getNumErrors(libsbml.LIBSBML_SEV_ERROR); if (numErrors > 0) { Console.WriteLine("Encountered errors while reading the file. "); Console.WriteLine("Please correct the following errors and try again."); doc.printErrors(); return(2); } Model model = doc.getModel(); LayoutModelPlugin plugin = (LayoutModelPlugin)model.getPlugin("layout"); if (plugin == null || plugin.getNumLayouts() == 0) { Console.WriteLine("The loaded model contains no layout information, please add these first."); return(3); } RenderListOfLayoutsPlugin lolPlugin = (RenderListOfLayoutsPlugin)plugin.getListOfLayouts().getPlugin("render"); if (lolPlugin != null && lolPlugin.getNumGlobalRenderInformationObjects() > 0) { Console.WriteLine("The loaded model contains global Render information: "); for (int i = 0; i < lolPlugin.getNumGlobalRenderInformationObjects(); ++i) { GlobalRenderInformation info = lolPlugin.getRenderInformation(i); print_render_info(info); } } Layout layout = plugin.getLayout(0); RenderLayoutPlugin rPlugin = (RenderLayoutPlugin)layout.getPlugin("render"); if (rPlugin != null && rPlugin.getNumLocalRenderInformationObjects() > 0) { Console.WriteLine("The loaded model contains local Render information. "); // here we would do the same as above for the local render information ... for (int i = 0; i < rPlugin.getNumLocalRenderInformationObjects(); ++i) { LocalRenderInformation info = rPlugin.getRenderInformation(i); print_render_info(info); } } return(0); }
public static int Main(string[] args) { if (args.Length < 3) { Console.WriteLine("Usage: callExternalValidator filename externalValidator [ tempSBMLFile outputFile [ ADDITIONAL-ARGS] ]"); return(1); } string filename = args[0]; // read additional args string externalValidator = args[1]; string tempSBMLFileName = filename + "_temp.xml"; if (args.Length > 2) { tempSBMLFileName = args[2]; } string outputFile = filename + "_out.xml"; if (args.Length > 3) { outputFile = args[3]; } List <string> additionalArgs = new List <string>(); for (int i = 4; i < args.Length; i++) { additionalArgs.Add(args[i]); } // add the output file as additional arg additionalArgs.Add(outputFile); // read the file name SBMLDocument document = libsbml.readSBML(filename); // create a new external validator that will write the model to // tempFile, then call teh externalValidator with the given number of arguments // to produce the output file. This output file will then be parsed and its // errors will be added to the error log. SBMLExternalValidator validator = new SBMLExternalValidator(); validator.setProgram(externalValidator); validator.setSBMLFileName(tempSBMLFileName); validator.setOutputFileName(outputFile); foreach (string item in additionalArgs) { validator.addArgument(item); } // this means that the external program will be called with the following arguments // // externalValidator tempSBMLFileName additionalArgs // // (where additionalargs contains the output file as last argument) // // The output file that is generated should be an XML document following the // Validator XML format as described here: http://sbml.org/validator/api/#xml // // disable all regular checks document.setApplicableValidators(0); // add a custom validator document.addValidator(validator); // check consistency like before int numErrors = (int)document.checkConsistency(); // print errors and warnings document.printErrors(); // return number of errors return(numErrors); }
public static int Main(string[] args) { if (args.Length != 2) { Console.WriteLine(" usage: addingEvidenceCodes_2 <input-filename> <output-filename>"); Console.WriteLine(" Adds controlled vocabulary term to a species"); Console.WriteLine(); return(2); } SBMLDocument d = libsbml.readSBML(args[0]); long errors = d.getNumErrors(); if (errors > 0) { Console.WriteLine("Read Error(s):"); d.printErrors(); Console.WriteLine("Correct the above and re-run."); } else { long n = d.getModel().getNumSpecies(); if (n <= 0) { Console.WriteLine("Model has no species.\n Cannot add CV terms\n"); } else { Species s = d.getModel().getSpecies(0); /* check that the species has a metaid * no CVTerms will be added if there is no metaid to reference */ if (!s.isSetMetaId()) { s.setMetaId("metaid_0000052"); } CVTerm cv1 = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER); cv1.setBiologicalQualifierType(libsbml.BQB_OCCURS_IN); cv1.addResource("urn:miriam:obo.go:GO%3A0005764"); s.addCVTerm(cv1); // now create the additional annotation //<rdf:Statement> // <rdf:subject rdf:resource="#metaid_0000052"/> // <rdf:predicate rdf:resource="http://biomodels.net/biology-qualifiers/occursIn"/> // <rdf:object rdf:resource="urn:miriam:obo.go:GO%3A0005764"/> // <bqbiol:isDescribedBy> // <rdf:Bag> // <rdf:li rdf:resource="urn:miriam:obo.eco:ECO%3A0000004"/> // <rdf:li rdf:resource="urn:miriam:pubmed:7017716"/> // </rdf:Bag> // </bqbiol:isDescribedBy> //</rdf:Statement> /* attributes */ XMLAttributes blank_att = new XMLAttributes(); XMLAttributes resource_att = new XMLAttributes(); /* create the outer statement node */ XMLTriple statement_triple = new XMLTriple("Statement", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); XMLToken statement_token = new XMLToken(statement_triple, blank_att); XMLNode statement = new XMLNode(statement_token); /*create the subject node */ XMLTriple subject_triple = new XMLTriple("subject", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); resource_att.clear(); resource_att.add("rdf:resource", "#" + s.getMetaId()); XMLToken subject_token = new XMLToken(subject_triple, resource_att); XMLNode subject = new XMLNode(subject_token); /*create the predicate node */ XMLTriple predicate_triple = new XMLTriple("predicate", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); resource_att.clear(); resource_att.add("rdf:resource", "http://biomodels.net/biology-qualifiers/occursIn"); XMLToken predicate_token = new XMLToken(predicate_triple, resource_att); XMLNode predicate = new XMLNode(predicate_token); /*create the object node */ XMLTriple object_triple = new XMLTriple("object", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); resource_att.clear(); resource_att.add("rdf:resource", "urn:miriam:obo.go:GO%3A0005764"); XMLToken object_token = new XMLToken(object_triple, resource_att); XMLNode object_ = new XMLNode(object_token); /* create the bqbiol node */ XMLTriple bqbiol_triple = new XMLTriple("isDescribedBy", "http://biomodels.net/biology-qualifiers/", "bqbiol"); XMLToken bqbiol_token = new XMLToken(bqbiol_triple, blank_att); XMLNode bqbiol = new XMLNode(bqbiol_token); /* create the bag node */ XMLTriple bag_triple = new XMLTriple("Bag", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); XMLToken bag_token = new XMLToken(bag_triple, blank_att); XMLNode bag = new XMLNode(bag_token); /* create each li node and add to the bag */ XMLTriple li_triple = new XMLTriple("li", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); resource_att.clear(); resource_att.add("rdf:resource", "urn:miriam:obo.eco:ECO%3A0000004"); XMLToken li_token = new XMLToken(li_triple, resource_att); li_token.setEnd(); XMLNode li = new XMLNode(li_token); bag.addChild(li); resource_att.clear(); resource_att.add("rdf:resource", "urn:miriam:pubmed:7017716"); li_token = new XMLToken(li_triple, resource_att); li_token.setEnd(); li = new XMLNode(li_token); bag.addChild(li); /* add the bag to bqbiol */ bqbiol.addChild(bag); /* add subject, predicate, object and bqbiol to statement */ statement.addChild(subject); statement.addChild(predicate); statement.addChild(object_); statement.addChild(bqbiol); /* create a top-level RDF element * this will ensure correct merging */ XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add("http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); xmlns.add("http://purl.org/dc/elements/1.1/", "dc"); xmlns.add("http://purl.org/dc/terms/", "dcterms"); xmlns.add("http://www.w3.org/2001/vcard-rdf/3.0#", "vCard"); xmlns.add("http://biomodels.net/biology-qualifiers/", "bqbiol"); xmlns.add("http://biomodels.net/model-qualifiers/", "bqmodel"); XMLTriple RDF_triple = new XMLTriple("RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdf"); XMLToken RDF_token = new XMLToken(RDF_triple, blank_att, xmlns); XMLNode annotation = new XMLNode(RDF_token); /* add the staement node to the RDF node */ annotation.addChild(statement); s.appendAnnotation(annotation); libsbml.writeSBML(d, args[1]); } } return((int)errors); }
public static int Main(string[] args) { int latestLevel = (int)SBMLDocument.getDefaultLevel(); int latestVersion = (int)SBMLDocument.getDefaultVersion(); if (args.Length != 2) { Console.Write("Usage: convertSBML input-filename output-filename" + Environment.NewLine + "This program will attempt to convert a model either to" + Environment.NewLine + "SBML Level " + latestLevel + " Version " + latestVersion + " (if the model is not already) or, if " + Environment.NewLine + "the model is already expressed in Level " + latestLevel + " Version " + latestVersion + ", this" + Environment.NewLine + "program will attempt to convert the model to Level 1 Version 2." + Environment.NewLine); return(1); } string inputFile = args[0]; string outputFile = args[1]; SBMLDocument document = libsbml.readSBML(inputFile); long errors = document.getNumErrors(); if (errors > 0) { Console.Error.Write("Encountered the following SBML errors:" + Environment.NewLine); document.printErrors(); Console.Error.Write("Conversion skipped. Please correct the problems above first." + Environment.NewLine); return((int)errors); } /** * If the given model is not already L2v4, assume that the user wants to * convert it to the latest release of SBML (which is L2v4 currently). * If the model is already L2v4, assume that the user wants to attempt to * convert it down to Level 1 (specifically L1v2). */ int olevel = (int)document.getLevel(); int oversion = (int)document.getVersion(); bool success; if (olevel < latestLevel || oversion < latestVersion) { Console.Write("Attempting to convert Level " + olevel + " Version " + oversion + " model to Level " + latestLevel + " Version " + latestVersion + "." + Environment.NewLine); success = document.setLevelAndVersion(latestLevel, latestVersion); } else { Console.Write("Attempting to convert Level " + olevel + " Version " + oversion + " model to Level 1 Version 2." + Environment.NewLine); success = document.setLevelAndVersion(1, 2); } errors = document.getNumErrors(); if (!success) { Console.Error.Write("Unable to perform conversion due to the following:" + Environment.NewLine); document.printErrors(); Console.Write(Environment.NewLine); Console.Write("Conversion skipped. Either libSBML does not (yet)" + Environment.NewLine + "have the ability to convert this model or (automatic)" + Environment.NewLine + "conversion is not possible in this case." + Environment.NewLine); return((int)errors); } else if (errors > 0) { Console.Write("Information may have been lost in conversion; but a valid model "); Console.Write("was produced by the conversion.\nThe following information "); Console.Write("was provided:\n"); document.printErrors(); libsbml.writeSBML(document, outputFile); } else { Console.Write("Conversion completed." + Environment.NewLine); libsbml.writeSBML(document, outputFile); } return(0); }
private static int Main(string[] args) { var sbmlns = new SBMLNamespaces(3, 1, "comp", 1); // create the document var document = new SBMLDocument(sbmlns); //Define the external model definitions var compdoc = (CompSBMLDocumentPlugin)(document.getPlugin("comp")); compdoc.setRequired(true); var extmod = compdoc.createExternalModelDefinition(); extmod.setId("ExtMod1"); extmod.setSource("enzyme_model.xml"); extmod.setModelRef("enzyme"); // create the main Model var model = document.createModel(); // Set the submodels var mplugin = (CompModelPlugin)(model.getPlugin("comp")); var submod1 = mplugin.createSubmodel(); submod1.setId("A"); submod1.setModelRef("ExtMod1"); var submod2 = mplugin.createSubmodel(); submod2.setId("B"); submod2.setModelRef("ExtMod1"); // create a replacement compartment var comp = model.createCompartment(); comp.setSpatialDimensions(3); comp.setConstant(true); comp.setId("comp"); comp.setSize(1L); //Tell the model that this compartment replaces both of the inside ones. var compartplug = (CompSBasePlugin)(comp.getPlugin("comp")); var re = new ReplacedElement(); re.setIdRef("comp"); re.setSubmodelRef("A"); compartplug.addReplacedElement(re); re.setSubmodelRef("B"); compartplug.addReplacedElement(re); // create a replacement species var spec = model.createSpecies(); spec.setCompartment("comp"); spec.setHasOnlySubstanceUnits(false); spec.setConstant(false); spec.setBoundaryCondition(false); spec.setId("S"); //Tell the model that this species replaces both of the inside ones. var spp = (CompSBasePlugin)(spec.getPlugin("comp")); re.setIdRef("S"); re.setSubmodelRef("A"); spp.addReplacedElement(re); re.setSubmodelRef("B"); spp.addReplacedElement(re); libsbml.writeSBMLToFile(document, "spec_example2.xml"); document = libsbml.readSBMLFromFile("spec_example2.xml"); if (document == null) { Console.WriteLine("Error reading back in file."); return(-1); } else { document.setConsistencyChecks(libsbml.LIBSBML_CAT_UNITS_CONSISTENCY, false); document.checkConsistency(); if (document.getErrorLog().getNumFailsWithSeverity(2) > 0 || document.getErrorLog().getNumFailsWithSeverity(3) > 0) { var stream = new OStringStream(); document.printErrors(stream); Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" + stream.str()); return(-1); } libsbml.writeSBMLToFile(document, "spec_example2_rt.xml"); } return(0); }
private static int Main(string[] args) { var retval = 0; var sbmlns = new SBMLNamespaces(3, 1, "comp", 1); // create the document var document = new SBMLDocument(sbmlns); //Create our submodel var compdoc = (CompSBMLDocumentPlugin)(document.getPlugin("comp")); compdoc.setRequired(true); var mod1 = compdoc.createModelDefinition(); mod1.setId("enzyme"); mod1.setName("enzyme"); var comp = mod1.createCompartment(); comp.setSpatialDimensions(3); comp.setConstant(true); comp.setId("comp"); comp.setSize(1L); var spec = new Species(3, 1); spec.setCompartment("comp"); spec.setHasOnlySubstanceUnits(false); spec.setConstant(false); spec.setBoundaryCondition(false); spec.setId("S"); mod1.addSpecies(spec); spec.setId("E"); mod1.addSpecies(spec); spec.setId("D"); mod1.addSpecies(spec); spec.setId("ES"); mod1.addSpecies(spec); var rxn = new Reaction(3, 1); rxn.setReversible(true); rxn.setFast(false); var rxn2 = new Reaction(rxn); rxn.setId("J0"); rxn2.setId("J1"); var sr = new SpeciesReference(3, 1); sr.setConstant(true); sr.setStoichiometry(1); sr.setSpecies("S"); rxn.addReactant(sr); sr.setSpecies("E"); rxn.addReactant(sr); rxn2.addProduct(sr); sr.setSpecies("ES"); rxn.addProduct(sr); rxn2.addReactant(sr); sr.setSpecies("D"); rxn2.addProduct(sr); mod1.addReaction(rxn); mod1.addReaction(rxn2); // create the Model var model = document.createModel(); model.setId("aggregate"); // Create a submodel var mplugin = (CompModelPlugin)(model.getPlugin("comp")); var submod1 = mplugin.createSubmodel(); submod1.setId("submod1"); submod1.setModelRef("enzyme"); var submod2 = new Submodel(); submod2.setId("submod2"); submod2.setModelRef("enzyme"); mplugin.addSubmodel(submod2); libsbml.writeSBMLToFile(document, "enzyme_model.xml"); document = libsbml.readSBMLFromFile("enzyme_model.xml"); if (document == null) { Console.WriteLine("Error reading back in file."); retval = -1; } else { document.setConsistencyChecks(libsbml.LIBSBML_CAT_UNITS_CONSISTENCY, false); document.checkConsistency(); if (document.getErrorLog().getNumFailsWithSeverity(2) > 0 || document.getErrorLog().getNumFailsWithSeverity(3) > 0) { var stream = new OStringStream(); document.printErrors(stream); Console.WriteLine("Errors encoutered when round-tripping SBML file: \n" + stream.str()); retval = -1; } libsbml.writeSBMLToFile(document, "enzyme_model_rt.xml"); } return(retval); }