Skip to main content

A simple CLI and library for BioNetGen modelling language

Project description

A simple CLI for BioNetGen

BNG CLI build status

This is a simple CLI and a library for BioNetGen modelling language. PyBioNetGen also includes a heavily updated version of Atomizer which allows for conversion of models written in Systems Biology Markup Language (SBML) into BioNetGen language (BNGL) format.

Please see the documentation to learn how to use PyBioNetGen.

Installation

You will need both python (3.7 and above) and perl installed. Once both are available you can use the following pip command to install the package

$ pip install bionetgen

Features

PyBioNetGen comes with a command line interface (CLI), based on cement framework, as well as a functional library that can be imported. The CLI can be used to run BNGL models, generate Jupyter notebooks and do rudimentary plotting.

The library side provides a simple BNGL model runner as well as a model object that can be manipulated and used to get libRoadRunner simulators for the model.

PyBioNetGen also includes a heavily updated version of Atomizer which allows for conversion of SBML models into BNGL format. Atomizer can also be used to automatically try to infer the internal structure of SBML species during the conversion, see here for more information. Please note that this version of Atomizer is the main supported version and the version distributed with BioNetGen will eventually be deprecated.

The model object requires a system call to BioNetGen so the initialization can be relatively costly, in case you would like to use it for parallel applications, use the libRoadRunner simulator instead, unless you are doing NFSim simulations.

Usage

Sample CLI usage

$ bionetgen -h # help on every subcommand
$ bionetgen run -h # help on run subcommand
$ bionetgen run -i mymodel.bngl -o output_folder # this runs the model in output_folder

Sample library usage

import bionetgen 

ret = bionetgen.run("/path/to/mymodel.bngl", out="/path/to/output/folder")
# out keyword is optional, if not given, 
# generated files will be deleted after running
res = ret.results['mymodel']
# res will be a numpy record array of your gdat results

model = bionetgen.bngmodel("/path/to/mymodel.bngl")
# model will be a python object that contains all model information
print(model.parameters) # this will print only the parameter block in BNGL format
print(model) # this will print the entire BNGL
model.parameters.k = 1 # setting parameter k to 1
with open("new_model.bngl", "w") as f:
    f.write(str(model)) # writes the changed model to new_model file

# this will give you a libRoadRunner instance of the model
librr_sim = model.setup_simulator()

You can find more tutorials here.

Environment Setup

The following demonstrates setting up and working with a development environment:

### create a virtualenv for development

$ make virtualenv

$ source env/bin/activate


### run bionetgen cli application

$ bionetgen --help


### run pytest / coverage

$ make test

Docker

Included is a basic Dockerfile for building and distributing BioNetGen CLI, and can be built with the included make helper:

$ make docker

$ docker run -it bionetgen --help

Publishing to PyPI

You can use make dist command to make the distribution and push to PyPI with

python -m twine upload dist/*

You'll need to have a PyPI API token created, see here for more information.

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

bionetgen-0.7.0.tar.gz (9.8 MB view details)

Uploaded Source

Built Distribution

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

bionetgen-0.7.0-py3-none-any.whl (9.9 MB view details)

Uploaded Python 3

File details

Details for the file bionetgen-0.7.0.tar.gz.

File metadata

  • Download URL: bionetgen-0.7.0.tar.gz
  • Upload date:
  • Size: 9.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for bionetgen-0.7.0.tar.gz
Algorithm Hash digest
SHA256 570329c7261d4a7d2f2aeffe28cf4ee3ed94a574c00abb9c8f2a759c912a11ea
MD5 e43149a7a85ef3cd4b38eb58bff203e1
BLAKE2b-256 c1728d3b7365a54791c3e141066c6c627788a5426ad8716f19071dcc02a4b576

See more details on using hashes here.

File details

Details for the file bionetgen-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: bionetgen-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for bionetgen-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5e9c103caaac6930ecad7903999be7e6d086fca478d8d3ac934d5a9a89a09ed
MD5 95d1cb0a0a67949930f7027f1d69b0b4
BLAKE2b-256 1496c88b0ee82fe35836ed6bde1bd400476e44fb01927e4326d5231326bb8460

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