SBbadger


NameSBbadger JSON
Version 1.4.5 PyPI version JSON
download
home_pagehttps://github.com/sys-bio/SBbadger
SummarySynthetic biochemical reaction networks with definable degree distributions.
upload_time2023-04-06 22:14:44
maintainer
docs_urlNone
authorMichael Kochen
requires_python
licenseApache
keywords systems biology benchmark models
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SBbadger
**SBbadger** is a Python library for the generation of synthetic, directed, reaction networks that conform to 
user-defined degree distributions. 

# Documentation

 https://SBbadger.readthedocs.io
 
Quick Start
===========

Installation
------------

Supported versions of Python are 3.7, 3.8, and 3.9. Python dependencies include numpy, scipy, antimony, matplotlib,
and pydot. An additional dependency for pydot is either a system installation of Graphviz or pydot installation
via conda.

SBbadger can be installed using pip:

```
$ pip install SBbadger
```

Simple Example
--------------

In the simplest possible case SBbadger can generate a single, 10 species, 
random network using the following commands in the python interpreter:

```
>>> from SBbadger import generate
>>> generate.models()
```

Note to Windows users. Currently the above won't work on windows in a script file. To use the package on windows in a script file you must use:

```
from SBbadger import generate

if __name__ == "__main__":
   generate.models()
```

This will be fixed in a future version.

In this case, SBbadger will randomly select reactions from 4 possible reaction types
and randomly select the reactants and products for those reactions from the 10 species.
The possible reaction types are:

| Reaction Type | Default Probabilities | Examples       |
|---------------|:----------------------|:---------------|
| UNI-UNI       | 0.35                  | A -> B         |
| BI-UNI        | 0.3                   | A + B -> C     | 
| UNI-BI        | 0.3                   | A -> B + C     | 
| BI-BI         | 0.05                  | A + B -> C + D |

The default reaction probabilities are adjustable. Also note that the same species can be
chosen more than once in a reaction, for example A + A -> B is a valid reaction. Reactions 
will continue to be added to the network until all 10 species have included. Below is the 
depiction of a sample network and an Antimony string describing the associated model:

![](https://raw.githubusercontent.com/sys-bio/SBbadger/main/docs/source/test.png)

```
var S0, S1, S9
ext S2, S3, S4, S5, S6, S7, S8

J0: S8 -> S0; kc0*S8
J1: S6 -> S5 + S0; kc1*S6
J2: S2 + S1 -> S9; kc2*S2*S1
J3: S7 -> S1 + S5; kc3*S7
J4: S9 + S0 -> S1 + S4; kc4*S9*S0
J5: S6 -> S3; kc5*S6

kc0 = 0.10285116762815472
kc1 = 65.21087405102236
kc2 = 34.220083386257116
kc3 = 11.526991028714853
kc4 = 0.15553486234310213
kc5 = 4.977089372937806

S2 = 4.759074353180305
S3 = 1.666194306431944
S4 = 7.110932299198714
S5 = 6.803821600602985
S6 = 9.329699040726386
S7 = 7.7760175494627735
S8 = 9.74931761300573

S0 = 3.431293190721635
S1 = 5.5106455586766545
S9 = 7.631625970757748
```
	
``var`` and ``ext`` denote floating and boundary species respectively. The default 
rate law is mass action with all parameters randomly selected from a log-uniform 
distribution with a range from 0.001 to 100. Initial conditions are randomly selected
from a uniform distribution with a range from 0 to 10. By default, the reactions are 
irreversible.

Expanded Example
----------------

Now suppose we want to create many models, and with more defined properties. The following python
script will do just that.

    from SBbadger import generate
    from scipy.stats import zipf

    def in_dist(k):
        return k ** (-2)

    def out_dist(k):
        return zipf.pmf(k, 3)

    if __name__ == "__main__":

        generate.models(
			group_name="extended_example",
			n_models=10,
			n_species=100,
			in_dist=in_dist,
			out_dist=out_dist,
			min_freq=1.0,
			n_cpus=4
			)
			
Two distribution functions are defined, ``in_dist`` and ``out_dist``, for the in-edge and out-edge distributions respectively where ``k`` is the degree. Both are power law functions. SBbadger will discretize, truncate, and renormalize these functions.
Note that ``in_dist`` is defined explicitly but ``out_dist`` is a wrapper around the Scipy function ``zipf``. A short description of the other parameters follows:

* ``group_name``: prepended to all files and the name of the directory where those files will be deposited. 
* ``n_models``: The number of models to be produced.
* ``n_species``: The number of nodes/species per model.
* ``min_freq``: The minimum expected frequency of nodes in every bin. This parameter, along with the number of species, is used to determine where to truncate the distribution.
* ``n_cpus``: The number of cores to run in parallel. Note that ``if __name__ == "__main__":`` is necessary to use multiprocessing on Windows.

In the above example 10 models will be produced, each with 100 species; the in-edge and out-edge distributions will both follow a power law but with different exponents; the distributions will be truncated such that every degree bin will have a minimum expected node count of 1; and the models will be split into 4 groups to be processed in parallel. Below are examples of the resulting distributions and a network.

![](https://raw.githubusercontent.com/sys-bio/SBbadger/main/docs/source/dist_fig_0.png)

![](https://raw.githubusercontent.com/sys-bio/SBbadger/main/docs/source/net_fig_0.png)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sys-bio/SBbadger",
    "name": "SBbadger",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Systems biology,Benchmark Models",
    "author": "Michael Kochen",
    "author_email": "kochenma@uw.edu",
    "download_url": "https://files.pythonhosted.org/packages/59/70/d09e83b63e24a40e3e1b485037022d113e4bad5d316006ac9607868870e5/SBbadger-1.4.5.tar.gz",
    "platform": null,
    "description": "# SBbadger\n**SBbadger** is a Python library for the generation of synthetic, directed, reaction networks that conform to \nuser-defined degree distributions. \n\n# Documentation\n\n https://SBbadger.readthedocs.io\n \nQuick Start\n===========\n\nInstallation\n------------\n\nSupported versions of Python are 3.7, 3.8, and 3.9. Python dependencies include numpy, scipy, antimony, matplotlib,\nand pydot. An additional dependency for pydot is either a system installation of Graphviz or pydot installation\nvia conda.\n\nSBbadger can be installed using pip:\n\n```\n$ pip install SBbadger\n```\n\nSimple Example\n--------------\n\nIn the simplest possible case SBbadger can generate a single, 10 species, \nrandom network using the following commands in the python interpreter:\n\n```\n>>> from SBbadger import generate\n>>> generate.models()\n```\n\nNote to Windows users. Currently the above won't work on windows in a script file. To use the package on windows in a script file you must use:\n\n```\nfrom SBbadger import generate\n\nif __name__ == \"__main__\":\n   generate.models()\n```\n\nThis will be fixed in a future version.\n\nIn this case, SBbadger will randomly select reactions from 4 possible reaction types\nand randomly select the reactants and products for those reactions from the 10 species.\nThe possible reaction types are:\n\n| Reaction Type | Default Probabilities | Examples       |\n|---------------|:----------------------|:---------------|\n| UNI-UNI       | 0.35                  | A -> B         |\n| BI-UNI        | 0.3                   | A + B -> C     | \n| UNI-BI        | 0.3                   | A -> B + C     | \n| BI-BI         | 0.05                  | A + B -> C + D |\n\nThe default reaction probabilities are adjustable. Also note that the same species can be\nchosen more than once in a reaction, for example A + A -> B is a valid reaction. Reactions \nwill continue to be added to the network until all 10 species have included. Below is the \ndepiction of a sample network and an Antimony string describing the associated model:\n\n![](https://raw.githubusercontent.com/sys-bio/SBbadger/main/docs/source/test.png)\n\n```\nvar S0, S1, S9\next S2, S3, S4, S5, S6, S7, S8\n\nJ0: S8 -> S0; kc0*S8\nJ1: S6 -> S5 + S0; kc1*S6\nJ2: S2 + S1 -> S9; kc2*S2*S1\nJ3: S7 -> S1 + S5; kc3*S7\nJ4: S9 + S0 -> S1 + S4; kc4*S9*S0\nJ5: S6 -> S3; kc5*S6\n\nkc0 = 0.10285116762815472\nkc1 = 65.21087405102236\nkc2 = 34.220083386257116\nkc3 = 11.526991028714853\nkc4 = 0.15553486234310213\nkc5 = 4.977089372937806\n\nS2 = 4.759074353180305\nS3 = 1.666194306431944\nS4 = 7.110932299198714\nS5 = 6.803821600602985\nS6 = 9.329699040726386\nS7 = 7.7760175494627735\nS8 = 9.74931761300573\n\nS0 = 3.431293190721635\nS1 = 5.5106455586766545\nS9 = 7.631625970757748\n```\n\t\n``var`` and ``ext`` denote floating and boundary species respectively. The default \nrate law is mass action with all parameters randomly selected from a log-uniform \ndistribution with a range from 0.001 to 100. Initial conditions are randomly selected\nfrom a uniform distribution with a range from 0 to 10. By default, the reactions are \nirreversible.\n\nExpanded Example\n----------------\n\nNow suppose we want to create many models, and with more defined properties. The following python\nscript will do just that.\n\n    from SBbadger import generate\n    from scipy.stats import zipf\n\n    def in_dist(k):\n        return k ** (-2)\n\n    def out_dist(k):\n        return zipf.pmf(k, 3)\n\n    if __name__ == \"__main__\":\n\n        generate.models(\n\t\t\tgroup_name=\"extended_example\",\n\t\t\tn_models=10,\n\t\t\tn_species=100,\n\t\t\tin_dist=in_dist,\n\t\t\tout_dist=out_dist,\n\t\t\tmin_freq=1.0,\n\t\t\tn_cpus=4\n\t\t\t)\n\t\t\t\nTwo distribution functions are defined, ``in_dist`` and ``out_dist``, for the in-edge and out-edge distributions respectively where ``k`` is the degree. Both are power law functions. SBbadger will discretize, truncate, and renormalize these functions.\nNote that ``in_dist`` is defined explicitly but ``out_dist`` is a wrapper around the Scipy function ``zipf``. A short description of the other parameters follows:\n\n* ``group_name``: prepended to all files and the name of the directory where those files will be deposited. \n* ``n_models``: The number of models to be produced.\n* ``n_species``: The number of nodes/species per model.\n* ``min_freq``: The minimum expected frequency of nodes in every bin. This parameter, along with the number of species, is used to determine where to truncate the distribution.\n* ``n_cpus``: The number of cores to run in parallel. Note that ``if __name__ == \"__main__\":`` is necessary to use multiprocessing on Windows.\n\nIn the above example 10 models will be produced, each with 100 species; the in-edge and out-edge distributions will both follow a power law but with different exponents; the distributions will be truncated such that every degree bin will have a minimum expected node count of 1; and the models will be split into 4 groups to be processed in parallel. Below are examples of the resulting distributions and a network.\n\n![](https://raw.githubusercontent.com/sys-bio/SBbadger/main/docs/source/dist_fig_0.png)\n\n![](https://raw.githubusercontent.com/sys-bio/SBbadger/main/docs/source/net_fig_0.png)\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "Synthetic biochemical reaction networks with definable degree distributions.",
    "version": "1.4.5",
    "split_keywords": [
        "systems biology",
        "benchmark models"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5970d09e83b63e24a40e3e1b485037022d113e4bad5d316006ac9607868870e5",
                "md5": "c7b7649914f9d2ff5ce7c436aece8b6a",
                "sha256": "022dc3b3335e4d58e72daa3ca0b6528037b8f7132ea502db449c71ea78a630ea"
            },
            "downloads": -1,
            "filename": "SBbadger-1.4.5.tar.gz",
            "has_sig": false,
            "md5_digest": "c7b7649914f9d2ff5ce7c436aece8b6a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 54145,
            "upload_time": "2023-04-06T22:14:44",
            "upload_time_iso_8601": "2023-04-06T22:14:44.532220Z",
            "url": "https://files.pythonhosted.org/packages/59/70/d09e83b63e24a40e3e1b485037022d113e4bad5d316006ac9607868870e5/SBbadger-1.4.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-06 22:14:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "sys-bio",
    "github_project": "SBbadger",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "sbbadger"
}
        
Elapsed time: 0.98756s