Last active
January 30, 2021 06:00
-
-
Save sritasngh/cc0f32c654fecadf38d0ccf76797813b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<sbml level="3" version="1" xmlns="http://www.sbml.org/sbml/level3/version1/core"> | |
<model extentUnits="mole" timeUnits="second"> | |
<listOfUnitDefinitions> | |
<unitDefinition id="per_second"> | |
<listOfUnits> | |
<unit kind="second" exponent="-1" scale="0" multiplier="1"/> | |
</listOfUnits> | |
</unitDefinition> | |
<unitDefinition id="litre_per_mole_second"> | |
<listOfUnits> | |
<unit kind="mole" exponent="-1" scale="0" multiplier="1"/> | |
<unit kind="litre" exponent="1" scale="0" multiplier="1"/> | |
<unit kind="second" exponent="-1" scale="0" multiplier="1"/> | |
</listOfUnits> | |
</unitDefinition> | |
</listOfUnitDefinitions> | |
<listOfCompartments> | |
<compartment id="comp" size="1e-14" spatialDimensions="3" units="litre" constant="true"/> | |
</listOfCompartments> | |
<listOfSpecies> | |
<species compartment="comp" id="E" initialAmount="5e-21" boundaryCondition="false" | |
hasOnlySubstanceUnits="false" substanceUnits="mole" constant="false"/> | |
<species compartment="comp" id="S" initialAmount="1e-20" boundaryCondition="false" | |
hasOnlySubstanceUnits="false" substanceUnits="mole" constant="false"/> | |
<species compartment="comp" id="P" initialAmount="0" boundaryCondition="false" | |
hasOnlySubstanceUnits="false" substanceUnits="mole" constant="false"/> | |
<species compartment="comp" id="ES" initialAmount="0" boundaryCondition="false" | |
hasOnlySubstanceUnits="false" substanceUnits="mole" constant="false"/> | |
</listOfSpecies> | |
<listOfReactions> | |
<reaction id="veq" reversible="true" fast="false"> | |
<listOfReactants> | |
<speciesReference species="E" stoichiometry="1" constant="true"/> | |
<speciesReference species="S" stoichiometry="1" constant="true"/> | |
</listOfReactants> | |
<listOfProducts> | |
<speciesReference species="ES" stoichiometry="1" constant="true"/> | |
</listOfProducts> | |
<kineticLaw> | |
<math xmlns="http://www.w3.org/1998/Math/MathML"> | |
<apply> | |
<times/> | |
<ci>comp</ci> | |
<apply> | |
<minus/> | |
<apply> | |
<times/> | |
<ci>kon</ci> | |
<ci>E</ci> | |
<ci>S</ci> | |
</apply> | |
<apply> | |
<times/> | |
<ci>koff</ci> | |
<ci>ES</ci> | |
</apply> | |
</apply> | |
</apply> | |
</math> | |
<listOfLocalParameters> | |
<localParameter id="kon" value="1000000" units="litre_per_mole_second"/> | |
<localParameter id="koff" value="0.2" units="per_second"/> | |
</listOfLocalParameters> | |
</kineticLaw> | |
</reaction> | |
<reaction id="vcat" reversible="false" fast="false"> | |
<listOfReactants> | |
<speciesReference species="ES" stoichiometry="1" constant="true"/> | |
</listOfReactants> | |
<listOfProducts> | |
<speciesReference species="E" stoichiometry="1" constant="true"/> | |
<speciesReference species="P" stoichiometry="1" constant="true"/> | |
</listOfProducts> | |
<kineticLaw> | |
<math xmlns="http://www.w3.org/1998/Math/MathML"> | |
<apply> | |
<times/> | |
<ci>comp</ci> | |
<ci>kcat</ci> | |
<ci>ES</ci> | |
</apply> | |
</math> | |
<listOfLocalParameters> | |
<localParameter id="kcat" value="0.1" units="per_second"/> | |
</listOfLocalParameters> | |
</kineticLaw> | |
</reaction> | |
</listOfReactions> | |
</model> | |
</sbml> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
species id = E | |
species id = S | |
species id = P | |
species id = ES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate xml; | |
use std::fs::File; | |
use std::io::BufReader; | |
use xml::reader::{EventReader, XmlEvent}; | |
fn parse_fn(filename: &str) { | |
let file = File::open(filename).unwrap(); | |
let file = BufReader::new(file); | |
let parser = EventReader::new(file); | |
for e in parser { | |
match e { | |
Ok(XmlEvent::StartElement { name, attributes, .. }) => { | |
if name.local_name == "species" { | |
for attr in attributes { | |
if attr.name.local_name == "id" { | |
println!("species id = {}", attr.value); | |
} | |
} | |
} | |
} | |
Err(e) => { | |
println!("Error: {}", e); | |
break; | |
} | |
_ => {} | |
} | |
} | |
} | |
fn main() { | |
parse_fn("src/input.xml"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment