A PyBEL extension for interconversion with CX.
PyBEL-CX can be installed easily from PyPI with the following code in your favorite terminal:
$ python3 -m pip install pybel-cxor from the latest code on GitHub with:
$ python3 -m pip install git+https://github.com/pybel/pybel-cx.gitPyBEL-CX installs two command line utilities: bel_to_cx and cx_to_bel.
Running this script has the caveat that the CX document should conform to the schema created by PyBEL-CX.
$ cat my_network.cx | cx_to_bel > my_network.bel$ cat my_network.bel | bel_to_cx > my_network.cxSince this operation can be expensive, PyBEL caches namespace resources. The -c flag can be used to specify a
database connection string to use a high performance RDBMS instead of the default SQLite. For example, if you would
like to use MySQL, this database string will look something like
mysql+pymysql://<username>:<password>@<host>/<dbname>?charset=utf8[&<options>]. Be sure to pip install the
connector, which is pymysql in this example.
$ pip install pymysql
$ cat my_network.bel | bel_to_cx -c "mysql+pymysql://root:root@localhost/mydb?charset=utf8" > my_network.cxMore documentation on connection strings at http://pybel.readthedocs.io/en/latest/manager.html#pybel.manager.BaseManager.from_connection.