nrnb / GoogleSummerOfCode

Main documentation site for NRNB GSoC project ideas and resources
114 stars 38 forks source link

Implement an SBML simulator in pure Rust #160

Closed funasoul closed 3 years ago

funasoul commented 3 years ago

Background

The programming language Rust has been used in various fields for its robust memory management while boasting execution speed comparable to the C/C++ language, and is now being applied to the development of bioinformatics tools. In the future, these tools will be increasingly used via the Web, and implementation in the Rust language is expected to ensure the safety of these tools. Against this background, we would like to confirm its usefulness in the simulator development area.

Goal

Develop a library that reads SBML files and performs simulations in Rust language. Verification of execution performance and ease of development will be conducted.

Difficulty Level 2

This project does not seek to implement a simulator that covers the whole SBML specification. A relatively easy to implement solver such as the Runge-Kutta method will be used for the simulation.

Skills

Rust (essential) Numerical Simulation Algorithms, Tree Data Structure (nice to have)

Public Repository

Potential Mentors

Akito Tabira Akira Funahashi Kaito Ii Takahiro Yamada Yuta Tokuoka

Contact

Akito Tabira Akira Funahashi Kaito Ii Takahiro Yamada Yuta Tokuoka

TakahiroYamada commented 3 years ago

@khanspers

Hi, I'm Takahiro Yamada planning to be a potential mentor of this project. Could it be possible to add me as an assignees to this issue? With best regards.

Takahiro Yamada

sritasngh commented 3 years ago

Hey everyone! I am Sarita Singh, an undergraduate student at NIT Hamirpur, India. I know C/C++, Python, Data structure and algorithms. I am comfortable to code in C++. I found this idea interesting. I would like to work at this idea.

TakahiroYamada commented 3 years ago

@itssingh Dear Singh,

Hi Hello. I'm Takahiro. We are very welcome for you to this project! Great! You are very familiar with the knowledge of computational side in this project. Do you have anyway experience to implement some code in Rust, or do you have the knowledge of coding in Rust? If you don’t have it, I guess it better for you to study the basic point of Rust in the first step to start this project, using like following document,

https://doc.rust-lang.org/book/title-page.html

Do you have experience to touch on SBML and simulation technology in terms of mathematical point of view (such as ordinary differential equation, numerical integration) based on SBML? If you don’t have it, I guess it’s better for you to study SBML and the mathematical point of view using following document,

A tutorial about SBML and SBML Level 2 Version 2 https://authors.library.caltech.edu/20770/1/HUCnpre07a.pdf

Euler integration method for solving differential equations https://x-engineer.org/undergraduate-engineering/advanced-mathematics/numerical-methods/euler-integration-method-for-solving-differential-equations/

After studying and understanding these points, I suppose it’s better for you to implement very simple simulator based on SBML (or ordinary differential equation model described in the code is also good for you in the initial step) in Rust.

Best.

Takahiro

sritasngh commented 3 years ago

I have not used Rust or SBML.Yeah sure, I'll go through these documents and update my status here. Thank you!

TakahiroYamada commented 3 years ago

@itssingh

Thank you for your early response!

Maybe you know that the application to Google will be required for officially engaging in this project, so knowledge from these document let you sum up with it better and easier, I believe.

If you have question or other things to do after understanding it, feel free to ask us! Cheer up!

Takahiro

sritasngh commented 3 years ago

Yes, I am aware about application procedure :)

TakahiroYamada commented 3 years ago

@itssingh

Excellent! Have you already engaged in another project in GSoC so far?

Takahiro

sritasngh commented 3 years ago

@TakahiroYamada

I am new to open source.I have done some contributions in scancode toolkit project by @nexB/aboutcode organisation.

Sarita

TakahiroYamada commented 3 years ago

@itssingh

Great! In my sense, commiting open source project let you get great experience! The application to Google is required for high elaboration and pretty long document to show the significance of this project and feasibility of your plan, but I suppose your start is very early and you have enogh time to sum up with it!

Cheer up!

Takahiro

sritasngh commented 3 years ago

@TakahiroYamada

I am very excited to explore open source in coming days and contribute as much as I can! Also I look forward to work under your guidance and learn things.

Sarita

mythosil commented 3 years ago

@itssingh Hi, I'm Akito, potential mentor.

As we noted in Skills section, Rust skill is essential in this project. Fortunately, there's still time before the application deadline. I'd like you to try writing a small program below in Rust.

  1. Read a SBML file.
  2. Print Species IDs.
  3. Print KineticLaws' math nodes in Reverse Polish Notation.

You can find SBML files on libSBML's repository, BioModels site, and so on.

sritasngh commented 3 years ago

@mythosil Hello!

Okay, I'll try it.

sritasngh commented 3 years ago

@itssingh Hi, I'm Akito, potential mentor.

As we noted in Skills section, Rust skill is essential in this project. Fortunately, there's still time before the application deadline. I'd like you to try writing a small program below in Rust.

  1. Read a SBML file.
  2. Print Species IDs.
  3. Print KineticLaws' math nodes in Reverse Polish Notation.

You can find SBML files on libSBML's repository, BioModels site, and so on.

Hey @mythosil ! As much I have explored, In first task I can add xml-rs library, xml-rs uses Cargo, so I can add xml-rs = "0.8" in the dependency section of cargo.toml file and extern crate xml; will import xml library so I have to write code now, right?

mythosil commented 3 years ago

@itssingh Yes, you're ready to write code. xml-rs is a popular XML parser library and well documented.

sritasngh commented 3 years ago

@mythosil Yes I have done basic concepts of rust and I am working on reading a SBML file:)

sritasngh commented 3 years ago

@itssingh Yes, you're ready to write code. xml-rs is a popular XML parser library and well documented.

Yes, Thankyou:)

sritasngh commented 3 years ago

One more thing, SBML files have two extensions, .SBML and .xml. Though I have seen majority of the files with .xml and I didn't get much information or library to read an SBML file, can you help me giving some information please!

sritasngh commented 3 years ago

@mythosil @TakahiroYamada @funasoul @kaitoii11 @tokkuman Hello everyone! I have written code to read a SBML file using xml-rs parser library. This library uses event stream approach, In this case the parser looks at the XML file character by character and triggers events after certain things have been read. I have used https://github.com/sbmlteam/libsbml/blob/development/examples/sample-models/from-spec/level-3/enzymekinetics.xml file to read. https://gist.github.com/itssingh/7f0e6822390161a388ebb904cac25c5e contains the main.rs file and output. Please review:)

sritasngh commented 3 years ago

I am working on printing species ids :)

sritasngh commented 3 years ago

Hello everyone! Here's the second task, Print species IDs. https://gist.github.com/itssingh/cc0f32c654fecadf38d0ccf76797813b Thank you!

sritasngh commented 3 years ago

Working on Print KineticLaws' math nodes in Reverse Polish Notation.

sritasngh commented 3 years ago

Hello everyone! I am facing some issue in Print KineticsLaws' math nodes in Reverse Polish Notation. Can I ask here or how can I connect?

mythosil commented 3 years ago

@itssingh Could you send an email to the potential mentors? It's not good to take up space here with detailed discussions.

sritasngh commented 3 years ago

@mythosil Yeah sure!

ballaneypranav commented 3 years ago

Hi @TakahiroYamada @mythosil, I'm Pranav Ballaney from India, and I would like to work on this project for GSoC 2021. I'm a Biology and Computer Science major, and I worked as part of GSoC last year with Debian on quality assurance and continuous integration of bioinformatics applications. I have worked with tree data structures in the past and I have some experience with Euler and Runge Kutta methods. I'm also familiar with SBML, having participated in iGEM 2020.

I've gone through the resources posted here and implemented the tasks listed above here. The input files were obtained from libsbml examples and one from BioModels. Please take a look at the code (in src/) and the output and let me know what you think.

My implementation prints the right Reverse Polish output from the example files, however, since the BioModels file includes several <functionDefinition> and <parameter> tags in the XML, they need to be processed separately. Please let me know if you would like me to parse these better as an application task, along with an implementation of the Euler method.

Regards, Pranav

mythosil commented 3 years ago

@ballaneypranav I could confirm that you have basic Rust skill. You don't need to take care of functionDefinition so far. There's still time before Student Application begin (see GSoC 2021 timeline). You can spend time in learning Rust, numerical integration algorithm and SBML. Our project is to implement a safe tool, which is the tool without unexpected memory access. Rust code with RefCell may cause such unexpected result. I'd like you to try writing code without RefCell.

ballaneypranav commented 3 years ago

@mythosil Thank you. I have rewritten the code without RefCell. Please take a look at it here and let me know what you think.

khanspers commented 3 years ago

This is an active GSoC 2021 project. The issue will be closed for the duration of GSoC since it is no longer available to other students.