Giter VIP home page Giter VIP logo

r-costa / sbml2hyb Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 2.0 32.46 MB

sbml2hyb is a tool for SBML compatible hybrid modelling of biological systems

Home Page: https://doi.org/10.6084/m9.figshare.21803316.v1

License: GNU General Public License v3.0

Python 99.57% Jupyter Notebook 0.43%
converter hybrid-model python sbml-model systems-biology interface gui keras-tensorflow neural-network bioprocess

sbml2hyb's Introduction

SBML2HYB

Overview

Hybrid modelling combine parametric functions (derived from knowledge) and nonparametric functions (derived from data) in the same model structure. The sbml2hyb tool is a stand-alone executable application for SBML compatible hybrid modelling. The tool is written in Python and is intended as an interface to convert existing SBML models into a hybrid model (combines mechanistic equations and ML techniques).

The new internal hybrid model format HMOD (intermediate format — enables communication between the essential components of the mechanistic and hybrid models) can be translated to SBML and vice-versa in sbml2hyb. See HMOD file example.

DOI Code style: black Documentation Status License: GPL v3 PyPI version

Quick start guide

Installation

  • Users have two options to install sbml2hyb:

(i) As a typical stand-alone executable Windows application; download the files. After saving the Windows folder where you prefer on your computer, double-click the executable (sbml2hyb_exe.exe) file to open the tool. It works also on macOS system.

(ii) As a Python package (pip installer); run the following command via pip: pip install sbml2hyb

  • sbml2hyb is written in Python (requires version 3.8 or higher).
  • Alternatively, you can clone this GitHub repository to a location on your computer's file system and then run sbml2hyb.py from the command-line.

After installing the package the user can simply import the library and call it. This is an example on how to use:

  from sbml2hyb import sbml2hyb

Package Dependencies

  • tkinter 3.10.7
  • Pillow 9.0
  • libsbml 5.19.6
  • Python 3.8.2
  • Tensorflow 2.10.0

Getting Started

► How to use SBML2HYB

The users can use sbml2hyb either via the command line interface or via a graphical user interface (GUI) that allows to convert SBML files into HMOD files and vice versa. Once the simple Graphical User Interface (GUI) window opens, click the "Translate SBML file" or "Translate HMOD file" button, to find the SBML or HMOD mechanistic model file you want to convert on the tool, respectively. After few seconds, the user get the final output in the main panel of the GUI. Here, the user can save (click "Save file" button) the standard model file (.xml or .hmod).

The user can then add the information of the neural network component (Click "Add ML" button) into the HMOD/SBML model format (note that first the user needs to load a mechanistic HMOD/SBML model file). Once the user do this, they need select the "inputs" and "outputs" options of the neural network, and the Keras H5 file (i.e., add the ML component information). Click the "Confirm" button. Finally, the resulting hybrid model in HMOD (or SBML) format can then be reconverted in SBML (or HMOD), respectively. Click "Translate HMOD file" or "Translate SBML file" button.

NOTE: To generate an Keras H5 file that serves as a blueprint of the machine learning segment of a hybrid model, the Keras library from Tensorflow should be used (see instructions and an example as notebook).

Visit also the documentation of the tool hosted on Read the Docs.

► Creating a hybrid SBML model

Example: Park&Ramirez model

You can view the mechanistic model SBML file input for this example in a separate file. The screenshot below (Figure 1) illustrates the output of the Park&Ramirez mechanistic HMOD model after the SBML conversion. The user select then the model "inputs" (S) and "outputs" (miu, vPM, VPT) options of the neural network, and the Keras H5 file (Figure 2) to convert directly to the hybrid model. You can view the resulting final hybrid HMOD file from the tool here and printscreens below (Figure 3). The hybrid model in HMOD format is then reconverted in the hybrid SBML model.

Figure 1.

alt text

Figure 2.

alt text

Figure 3.

alt text

☼ Citation

Please cite our paper if you use SBML2HYB:

José Pinto*, Rafael S. Costa*†, L. Alexandre, J. Ramos, Rui Oliveira, SBML2HYB: a Python interface for SBML compatible hybrid modelling. Bioinformatics (2023) | DOI: https://doi.org/10.1093/bioinformatics/btad044, PMID: 36661327

⸎ Developed at

  • NOVA School of Science and Technology, Universidade NOVA de Lisboa

alt text

⁇ Help

If you have any trouble using the tool or suggestions, please contact: rs [dot] costa [at] fct [dot] unl [dot] pt OR open an issue.

License

This work is licensed under a GNU Public License (version 3.0).

sbml2hyb's People

Contributors

r-costa avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cthoyt walterneek

sbml2hyb's Issues

Review [Round 2]: missing package metadata

This package is missing important metadata in its setup.py. You can use the following commands to iteratively add the things that are missing:

git clone https://github.com/r-costa/sbml2hyb
cd sbml2hyb
pip install pyroma
pyroma --min=10 .

Review: deploy code to PyPI

After packing the code in #1, it would be paramount to deploy the code to the Python Package Index (PyPI) such that users can effortlessly install with pip

Code review for "SBML2HYB: a Python interface for SBML compatible hybrid modelling"

Dear @r-costa,

I have been invited to review your application note entitled "SBML2HYB: a Python interface for SBML compatible hybrid modelling" submitted to Oxford Bioinformatics. As an application note is an advertizement for some interesting code, it's paramount that the code is good and useful. Therefore, I've provided a first round of code review that points out some standard practices for packaging, documentation, testing, code quality assurance, and automation that should be completed before the next round of review.

Greetings from Bonn, Germany. Have a nice day.
-Charlie Hoyt

Here's a table of contents of the issues I've raised:

Review [Round 2]: remove extraneous files

Several files seem to be committed to the repository that make navigating it confusing. Please delete the following directories and add them to a .gitignore file so they don't get accidentally committed again. You can make a base .gitignore file with https://www.toptal.com/developers/gitignore/. Here's a good starting point: https://www.toptal.com/developers/gitignore/api/python,intellij,pycharm,jupyternotebooks,windows,macos,vim

  • the dist/ directory should be deleted (in general, build artifacts get sent to places like PyPI, not kept in version control)
  • same for src/sbml2hyb.egg-info
  • src/__init__.py is not necessary. You only need this inside src/sbml2hyb/ and sub-modules
  • There appear to be duplicate python files inside windows_exe/ of the packaged files.

Review: testing and automation

There aren't any tests for the code in this repository. Among other things, this doesn't inspire confidence in a potential user that the code really does what it says it should. Further, without tests, it's hard to be confident that improvements don't break other features.

  1. Put unit tests in a tests/ directory
  2. Document how to run tests in a reproducible way on the README
  3. Use tox and GitHub Actions to automate running tests on all changes

Review: Make archive of repository

Zenodo offers to make up a persistent backup of the repository. This is important in case GitHub goes down, if you decided to delete the repository, or any other situation. You can connect your github account to zenodo then make a release on this repo to create a DOI. Then you can add the DOI to the README and your paper.

Review: deploy documentation to ReadTheDocs

As a follow-up to #4, the documentation should be deployed to ReadTheDocs. This has the advantage that users don't have to build the documentation themselves, and that it automatically stays up-to-date with changes in the code.

Review: add documentation

This code currently does not contain any documentation. There are a few ways to go about doing that to make it useful for potential users:

  1. Add a "getting started" example to the README
  2. Use sphinx to auto-generate documentation based on docstrings and weave them together with tutorials

See https://www.youtube.com/watch?v=azf6yzuJt54 for motivation on better documentation - there should be several parts to documentation:

  1. Technical documentation (i.e., all functions are self-explanatory what they do based on their docstrings)
  2. High-level documentation (i.e., tutorials for the thing 99% of users will want to do with your package after reading your paper)

Review: how to use if not on windows?

It's not a common choice to package code in a windows-only executable. Most scientists are using Mac or Linux, so this makes it difficult for those users to use your code. Further, there are pretty big security concerns for downloading some exe off of the internet and running it, so I would say this is not the way you should be distributing your code. See #1 and #2 for a better alternative.

Review: improve code quality

The code in this repository doesn't appear to have consistent styling. This can be easily addressed with black, which reformats code in a deterministic way. It's not perfect in how it looks, but at least it makes it more standard for others to read.

Further, you should use tools like flake8 and pylint to find other common mistakes/pitfalls in the way the code is written. Keep in mind that your code is effectively the methods section of your manuscript, and that it should be meant to be read by all users.

Review: package code and make pip-installable

This package contains python code that is unpackaged, this means that it is problematic for others to get and install it on their own systems. There are several ways to package code these days, usually using an appropriate setup.cfg or pyproject.toml file such that it can be cloned and subsequently installed with pip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.