GithubHelp home page GithubHelp logo

aspirincode / crnpy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from etonello/crnpy

0.0 1.0 0.0 5.13 MB

A python library for the analysis of chemical reaction networks.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

crnpy's Introduction

crnpy

image

crnpy is a python library for the manipulation and analysis of chemical reaction networks.

Install

crnpy can be installed from source. After downloading the repository, run

$ python setup.py install --user

crnpy requires libSBML, SciPy, NumPy and SymPy. To generate the network invariants, pycddlib is also required.

Some example scripts require NetworkX or PuLP.

Getting Started

We can create a network from an SBML file

>>> from crnpy.crn import CRN, from_sbml, from_react_strings, from_react_file
>>> crn = from_sbml("examples/data/sbml/enzyme.xml")

from a file containing a list of reactions in human-readable format

>>> crn = from_react_file("examples/data/reactions/biomodels/biomd0000000026")

or directly from a list of reaction strings:

>>> crn = from_react_strings(["A <-> B", "2A + C <-> D", "D -> E", "E -> 2A + C"])

Now we can explore some properties of the network. For example, we can look at the stoichiometric matrix

>>> crn.print_stoich_matrix()
    r0  r0_rev  r1  r1_rev  r2  r3
A | -1       1  -2       2   0   2 |
B |  1      -1   0       0   0   0 |
C |  0       0  -1       1   0   1 |
D |  0       0   1      -1  -1   0 |
E |  0       0   0       0   1  -1 |

at the derivatives of the species concentrations and the conservation laws:

>>> crn.stoich_matrix * crn.rates
Matrix([
[-2*A**2*C*k_r1 - A*k_r0 + B*k_r0_rev + 2*D*k_r1_rev + 2*E*k_r3],
[                                           A*k_r0 - B*k_r0_rev],
[                            -A**2*C*k_r1 + D*k_r1_rev + E*k_r3],
[                             A**2*C*k_r1 - D*k_r1_rev - D*k_r2],
[                                               D*k_r2 - E*k_r3]])
>>> crn.cons_laws
(A + B + 2*D + 2*E, C + D + E)

We can check whether the conditions of the deficiency zero theorem are satisfied:

>>> crn.is_ma
True
>>> crn.deficiency
0
>>> crn.is_weakly_rev
True

For more information, a tutorial is available as well as some example scripts.

Citation

If you use crnpy for your work, please cite

Elisa Tonello, CrnPy: a python library for the analysis of chemical reaction networks, 2016.

crnpy's People

Contributors

etonello avatar eitanlees avatar

Watchers

James Cloos avatar

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.