Skip to main content

Posts

Showing posts from June, 2021

Week 3

Progress this Week This week I extended the parsers to more SBML and MathML constructs and started working on the simulator. The SBML parser now supports Function Definitions and the MathML parser supports lambda functions and variable bindings.  The mathml package can also be used to evaluate an abstract syntax tree now, in the following way:           let model = sbml_rs :: parse (& filename ). expect ( "Couldn't parse model." ); // Supply values for variables let mut hm : HashMap < String , f64 > = HashMap :: new (); hm . insert ( "compartment" . into (), 5.0 ); hm . insert ( "k1" . into (), 5.0 ); hm . insert ( "S1" . into (), 6.0 ); // Evaluate math nodes for tag in & model { if let Tag :: MathTag ( math_tag ) = tag { println! ( " { } " , evaluate_node (& math_tag . nodes , 0 , & hm ). unwrap ()); } } If the AST has any constant...

Week 2

This week mostly involved developing the SBML and MathML parsers.  I've added support for the following components to the SBML parser: List of Unit Definitions, Unit Definition List of Units, Unit List of Compartments, Compartment List of Parameters, Parameter List of Species, Species List of Reactions, Reaction List of Reactants, List of Products Species Reference Kinetic Law Math To the MathML parser, I've added support for the following components: Ci Cn (only with integers) Apply Mathematical Operators These constructs cover the first 24 test cases in the Core Semantic SBML test suite. This week, I'm planning to extend the SBML parser to support Function Definitions and the MathML parser to support Cn with reals, doubles and exponentials and Lambda functions. After this, I'll write some getter functions that will be helpful for crates that use these parsers, so they can call functions on the model object to get lists of species, reactions, etc. That's all for th...

Week 1

The first task of the project was to implement a parser for SBML and MathML.  There are some existing crates that do this so my initial attempt was to make  them work together. The SBML parser rust_sbml  supports  serializing and deserializing various components of the SBML specification  through the serde library. However, it doesn't  support MathML.  The MathML parser, mathml supports parsing  several constructs of the MathML specification, but due to the recursive nature  of MathML, the Deserialize trait from serde was not implemented for the   MathNode enum.  When trying to deserialize into a recursive enum through serde, it results in a  stack overflow.  mathml originally depends on roxmltree   so after several failed attempts to get it to work with serde, I tried changing  the XML parser to xml-rs and then to  quick-xml , but all to no avail. I also posted the error on Stack Overflow  here...

Community Bonding Period

The first phase of the Google Summer of Code program is the Community Bonding Period, where students get to know their mentors, the codebase and the larger community. As we reach the end of this phase and move into the Coding Period, in this blog post, I summarize my progress in the project over the last three weeks and write a little bit about the plan for the coming weeks. Community Bonding Period I spent most of the Community Bonding Period (CBP) reading about the ecosystem I'm going to work in over the summer - this involved reading about SBML, learning numerical integration algorithms and learning the Rust programming language. SBML The project I'm working on deals with SBML models, so it was essential to gain familiarity with the SBML format. For this, I went through the SBML Specification [1].   Next, I read about the systems biology simulation algorithm [2], which helped to develop an understanding of how various SBML components ...