Example #1
0
<?php

include "libSBML.php";
if ($argc < 3) {
    echo "Usage: echoSBML input-filename output-filename";
    exit(1);
}
$reader = new SBMLReader();
$doc = $reader->readSBMLFromFile($argv[1]);
if ($doc->getErrorLog()->getNumFailsWithSeverity(LIBSBML_SEV_ERROR) > 0) {
    $doc->printErrors();
} else {
    $writer = new SBMLWriter();
    $writer->writeSBML($doc, $argv[2]);
}
?>

                           </apply>
                         </math>';
    $astMath = libsbml::readMathMLFromString($mathXMLString);
    $kl->setMath($astMath);
    //---------------------------------------------------------------------------
    // Creates local Parameter objects inside the KineticLaw object.
    //---------------------------------------------------------------------------
    // Creates a Parameter ("kcat")
    $para = $kl->createParameter();
    $para->setId("kcat");
    $para->setValue(0.1);
    $para->setUnits("per_second");
    // Returns the created SBMLDocument object.
    // The returned object must be explicitly deleted by the caller,
    // otherwise a memory leak will happen.
    return $sbmlDoc;
}
// create example model
$sbmlDoc = createExampleEnzymaticReaction();
// check consistency
$sbmlDoc->checkConsistency();
if ($sbmlDoc->getErrorLog()->getNumFailsWithSeverity(LIBSBML_SEV_ERROR) > 0) {
    echo "file is not valid!";
    $sbmlDoc->printErrors();
}
// write file
$writer = new SBMLWriter();
$writer->writeSBML($sbmlDoc, "enzymaticreaction.xml");
?>