Coder Social home page Coder Social logo

simplesbml's People

Contributors

0u812 avatar carolc24 avatar hsauro avatar penavon avatar violasox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplesbml's Issues

Flattening SBML

If an SBML uses to composition packages, call the flattening method in libsbml first.

Unit warning when using default compartment

Hello,

I am using simplesbml to create a rather large reaction network (hundreds of species and reactions). In principle this works fine. However I always get warnings about unexpected units for my reactions. Here is a minimum example to reproduce:

import simplesbml
m = simplesbml.sbmlModel()
m.addSpecies('S1', 1)
m.addSpecies('S2', 0)
m.addParameter('k', 0.1)
m.addReaction(['S1'], ['S2'], 'k * S1')
sbml = m.toSBML()

This would be some simple reaction in the form: S1 -> S2 with rate constant k
The snippet will lead to the following warning:

Warning : The units of the 'math' formula in a definition are expected to be the equivalent of substance per time.
Reference: L3V1 Sections 4.11.7, 4.2.4 AND 4.9.4
In level 3 the expected units are extent_per_time. Expected units are mole (exponent = 1, multiplier = 1, scale = 0), second (exponent = -1, multiplier = 1, scale = 0) but the units returned by the expression in the (from the with id 'v1') are second (exponent = -1, multiplier = 1, scale = 0), mole (exponent = 1, multiplier = 1, scale = 0), litre (exponent = -1, multiplier = 1, scale = 0).

This seems to happen to happen because SBML expects the overall unit to be mole/sec but the model has mole/(sec*litre). The litre now actually comes from the default compartment.
These warnings are very annoying for me because they appear hundreds of times and will bury any possible useful warnings.

Now I have a few questions:

  • Are these warnings actually a problem?
  • If not can I specifically suppress them?
  • Or is there an approach to prevent them from happening altogether? I.E. not defining a compartment is something I could think of.
    What also works is the following:
m.getCompartment('c1').setUnits('dimensionless')

But I am not sure whether I am "allowed" to do that or if it could hurt my model.

Add help on how to intall

Add some installation help to the github page. Explain to a user how to install simplesbml. Indicate to users that they must first install libSBML python, provide a link to the libSBML page.

Python 3.7 compatibility ('tesbml' dependency in setup.py)

It looks like the package python-libsbml works as replacement for tesbml, which is listed as a requirement.
python-libsbml can be installed via pip on python 3.7 while tesbml is unavailable. Would it make sense to swap python-libsbml for tesbml in the setup.py / requirements.txt ? Thanks.

SBML validation

When loading an SBML file make sure you check first whether it is a valid sbml or not. Issue error is file is not a valid sbml file.

pip install puts in old version

Hello,
Pip install gives me version 1.2.2 on Ubuntu 18.04. The very helpful docs refer to version 2.0.0.
pip install "simplesbml==2.0.0" does not find the recent version, either.
Thank you,
Upi Bhalla

Problem with adding reactions

Current implementation of adding reaction does not produce a valid SBML file. Will push an updated version that solve this issue temporarily.

Unknown writeCodeFromString()

Hello,

I have a fresh install, using python 3.8, tellurium and simplesbml (installed with pip), and tried to use your examples but I have the following error:

Traceback (most recent call last):

  File ~/.miniconda3/envs/new/lib/python3.8/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File ~/untitled0.py:20
    code = simplesbml.writeCodeFromString(model.toSBML())

AttributeError: module 'simplesbml' has no attribute 'writeCodeFromString'

Thanks.

Add 'sbml' tag

Just wanted to suggest the addition of the 'sbml' topic tag for this GitHub repository.

Explain how users can get hold of libSBML

readme.md says that libSBML is a dependency. However many people may now know what that means, what is libSBML how do they install libSBML on their system? Add these details to the readme.md file.

Warnings should not use print()

The following code causes warnings to be emitted by the print (statment I think) inside the simplesbml model. These warnings should be emitted by the Python warnings module.

import roadrunner

import simplesbml
model = simplesbml.sbmlModel();
model.addSpecies('X', 3.0);
model.addSpecies('Y', 3);
model.addSpecies('$A', 0.5);
model.addSpecies('$B', 3.0);
model.addSpecies('$E', 3.0);

model.addParameter ('k1', 1.12298)
model.addParameter ('k2', 0.633134)
model.addParameter ('k3', 0.767529)
model.addParameter ('k4', 1.02339)

model.addReaction(['A'], ['X'], 'k1*A', rxn_id='J1');
model.addReaction(['2 X', 'Y'], ['3 X'], 'k2*X^2*Y', rxn_id='J2');
model.addReaction(['X', 'B'], ['Y'], 'k3*X*B', rxn_id='J3');
model.addReaction(['X'], ['E'], 'k4*X', rxn_id='J4');

print(model)

Validate sbml before calling toSBML etc

Just before you write out the SBML or writeCode, call the libSBML validator to confirm that the generated SBML is valid. If it is not valid, write any error or warning messages to the IPython Console in Tellurium.

Add a setLevelAndVersion (n, m)

Add a method to allow users to set the level and version for SBML export.. Import should automatically recognize what level the sbml is.

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.