Promote all local parameters in the model to global parameters.
namespace LibSBMLCSExample
{
public class promoteParameters
{
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);
}
ConversionProperties props = new ConversionProperties();
props.addOption("promoteLocalParameters", true, "Promotes all Local Parameters to Global ones");
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);
}
}
}