Skip to main content

A Python package for appling Structural Sensitivity Analysis to reaction networks.

Project description

ibuffpy

This package applies structural sensitivity analysis to chemical reaction networks to discover buffering structures within them.

Installation

To install ibuffpy, run the following command:

pip install ibuffpy

The pygraphviz package is required to visualize the hierarchy graph of buffering structures. See https://pygraphviz.github.io/documentation/stable/install.html for the installation of pygraphviz.

Usage

Once you have installed ibuffpy, you can import ReactionNetwork module from the ibuffpy package

from ibuffpy import ReactionNetwork

In ibuffpy, reaction networks are treated as instances of the ReactionNetwork.ReactionNetwork which contains information about reaction names, metabolites, and stoichiometric matrices. To read a network from a csv file, use ReactionNetwork.from_csv(" PATH_TO_CSV") where the csv file must contain reaction formulas such as "reaction_idx, substrate1 substrate2, product1 product2" (an example can be found in demo_network1.csv). If the reaction equation contains more than one metabolite, separate them with a space. If the coefficient of a metabolite is $n$, it will appear n times on one side. Outflow reactions or inflow reactions are represented as ['inflow_name',['metabolite_name'],['out']] or ['outflow_name',['out'],['metabolite_name']]. The metabolite name 'out' is reserved for the node corresponding to outside of the network, which does not appear in the stoichiometric matrix.

network = ReactionNetwork.from_csv("PATH_TO_CSV")
network.info()
# list of reactions in the network
print(network.reaction_list)
# list of metabolites in the network except for 'out' node
print(network.cpd_list_nooout)

Structural sensitivity analysis computes the network sensitivity to parameter perturbation from the A-matrix, which reflects network structure. ReactionNetwork.compute_amat(network) returns an A-matrix with random real values in nonzero entries of $\partial \boldsymbol r / \partial \boldsymbol x$, a basis of $\ker \nu$, and a basis of $\ker \nu^\top$. ReactionNetwork class uses scipy.linalg.null_space to obtain bases by default, but you can also use ker_basis='rref' option. ker_bais or coker_basis accepts ndarray or list to provide a self-made bases.

# numpy is used to calculate a basis by default.
network = ReactionNetwork.from_csv(path_to_csv, ker_basis='svd', coker_basis='rref')

# augumented matrix
amat = network.compute_amat()

# sensitivity matrix
smat = np.linalg.inv(amat)

You can find buffering structures by

bs_list = ReactionNetwork.compute_bs(network)

and visualise them by

graph = ReactionNetwork.make_hiergraph(bs_list)
graph.draw(PATH_SAVE)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibuffpy-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ibuffpy-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file ibuffpy-0.1.0.tar.gz.

File metadata

  • Download URL: ibuffpy-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.17

File hashes

Hashes for ibuffpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b478ebf604433e8d0fb7bd86ef00b0ecffb297abf25599f59f843c9d59009cb4
MD5 2ef6c162a49ef1dd0d159771cfde7a83
BLAKE2b-256 0255213d7317e27fdf699723e59bf3df8216c51c5f0d08e16532a2092d18547e

See more details on using hashes here.

File details

Details for the file ibuffpy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ibuffpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.17

File hashes

Hashes for ibuffpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78a02ba5eba629fd420992ba5441f97cf019dbe662b5ed0ebca4e50c1f50f9d2
MD5 0eaed61e706446dbb03b946aa209ce82
BLAKE2b-256 77b65e99eb10f4e19042650e3a2e81f4dbc2bf7cc00c5202ece868b0e83f0a34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page