bionetgen package

Subpackages

Submodules

bionetgen.main module

class bionetgen.main.BNGBase(*args, **kw)[source]

Bases: ArgparseController

Base cement controller for BioNetGen CLI

Used to set meta attributes like program name (label) as well as command line arguments. Each method is a subcommand in the command line with its own command line arguments.

Subcommands

run

runs a model given by -i in folder given by -o

notebook

generates and opens a notebook for a model given by -i, optional

plot

plots a gdat/cdat/scan file given by -i into file supplied by -o

info

provides version and path information about the BNG installation and dependencies

visualize

provides various visualization options for BNG models

class Meta[source]

Bases: object

arguments = [(['-v', '--version'], {'action': 'version', 'version': 'BioNetGen simple command line interface 0.8.1\nBioNetGen version: BioNetGen-2.9.0\nCement Framework 3.0.8\nPython 3.7.9\nPlatform Linux-5.15.0-1004-aws-x86_64-with-debian-buster-sid\n        '}), (['-req', '--require'], {'action': <class 'bionetgen.main.requireAction'>, 'type': <class 'str'>, 'default': None}), (['-ll', '--log-level'], {'help': 'This option allows you to select a logging level, from quietest to loudest options are: "CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG". Default is set to INFO', 'default': None, 'type': <class 'str'>})]
description = 'A simple CLI to bionetgen <https://bionetgen.org>. Note that you need Perl installed.'
help = 'bionetgen'
label = 'bionetgen'
atomize()[source]
graphdiff()[source]
info()[source]

Information subcommand to provide installation versions and paths.

Currently provides version information for BioNetGen, the BNG CLI, Perl, numpy, pandas, and libroadrunner. Also provides BNG2.pl and pyBNG paths.

notebook()[source]

Notebook subcommand that boots up a Jupyter notebook using the nbopen library. It uses a BNGNotebook class defined in core/notebook.

The default template can be found under assets and in the future will likely be replaced by a standard templating tool (e.g. Jinja).

The default base template is agnostic to the model and if -i is given the template then will be adjusted to load in the model supplied.

plot()[source]

Plotting subcommand for very basic plotting using a convenience function defined in core/main.

Currently we support gdat/cdat/scan file plotting, in a very basic manner. This command expects a space separated file where each column is a series. The first column is used for the x-axis and the rest is used as y-axis and every series is plotted.

See bionetgen plot -h for all the allowed options.

run()[source]

This is the main run functionality of the CLI.

It uses a convenience function defined in core/main to run BNG2.pl using subprocess, given the set of arguments in the command line and the configuraions set by the defaults as well as the end-user.

visualize()[source]

Subcommand to generate visualizations. Currently only supports visualize action from BioNetGen.

Types of visualizations and their options - Rule pattern visualization: Visualization of each rule as a bipartite graph - Rule operation visualization: Visualization of each rule showing explicit graph operations - Contact map: Visualize the contact map of the model - Regulatory graph: Visualize the regulatory graph of the model, also called atom rule graph

class bionetgen.main.BioNetGen(label=None, **kw)[source]

Bases: App

Cement app for BioNetGen CLI

Used to set configuration options like config default, exiting on close and setting log handler. Currently set attributes are below.

Attributes

labelstr

name of the application

config_defaultsstr

the default set of configuration options, set in BNGDefaults object

config_handler: str

the name of the config handler, determines the syntax of the config files

config_file_suffix: str

the suffix to be used for config files

config_files: list of str

additional list of config files to enable

exit_on_closeboolean

determine if the app should exit when the key function is ran

extensionslist of str

extensions to be used with cement framework

log_handler: str

name of the log handler

handlers: list of obj

list of objects derived from cement.Controller that handles the actual CLI

class Meta[source]

Bases: object

config_defaults = {'bionetgen': {'bngpath': '/home/docs/checkouts/readthedocs.org/user_builds/pybionetgen/checkouts/latest/bionetgen/bng-linux', 'cvode_include': None, 'cvode_lib': None, 'notebook': {'name': 'bng-notebook.ipynb', 'path': '/home/docs/checkouts/readthedocs.org/user_builds/pybionetgen/checkouts/latest/bionetgen/assets/bionetgen.ipynb', 'template': '/home/docs/checkouts/readthedocs.org/user_builds/pybionetgen/checkouts/latest/bionetgen/assets/bionetgen-temp.ipynb'}, 'stderr': 'STDOUT', 'stdout': 'PIPE'}}
config_file_suffix = '.conf'
config_files = ['./.bionetgen.conf']
config_handler = 'configparser'
exit_on_close = True
extensions = ['colorlog']
handlers = [<class 'bionetgen.main.BNGBase'>]
label = 'bionetgen'
log_handler = 'colorlog'
class bionetgen.main.BioNetGenTest(label=None, **kw)[source]

Bases: TestApp, BioNetGen

A sub-class of BioNetGen CLI application for testing purposes. See tests/test_bionetgen.py for examples.

class Meta[source]

Bases: object

label = 'bionetgen'
bionetgen.main.main()[source]
class bionetgen.main.requireAction(option_strings, dest, nargs=None, **kwargs)[source]

Bases: Action

Module contents