Skip to content

SynBioDex/pySBOL2

Repository files navigation

pySBOL2

Build Status Documentation Status

pySBOL2 is a pure Python implementation of the SBOL 2.3.0 standard Synthetic Biology Open Language (SBOL) - an open standard for the representation of in silico biological designs. It draws from libSBOL and pySBOL.

This native Python library is intended to eventually supplant the original pySBOL based on C++ wrappers.

For developers, please see CONTRIBUTING.md.

INSTALLATION

Use pip to install pySBOL2:

pip install sbol2

If you get a permission error, try using the --user flag:

pip install --user sbol2

Java dependency for offline validation/conversion

By default, pySBOL2 executes its validation and conversion with the online validator/converter. These can also be done offline using the Java JAR file packaged with the library.

Java requirements are: openjdk8 or later

Java location defaults to /usr/bin/java, and can be adjusted by setting the JAVA_LOCATION config option:

Config.setOption(ConfigOptions.JAVA_LOCATION, '/my/java/path')

CODE EXAMPLE

This short example creates a Document, adds a ComponentDefinition to the Document, and then writes the resulting Document to an SBOL file. Other examples are in the examples directory.

import sbol2

doc = sbol2.Document()
cd = sbol2.ComponentDefinition('cd1')
doc.add(cd)
doc.write('my-sbol.xml')

UNIT TESTS

The unit tests are not included when installing via pip. The unit tests are included in the source distribution. To access and run the unit tests without checking out from git, download the source distribution, unpack it, and run the unit tests.

pip download --no-binary sbol2 sbol2
tar zxf sbol2-VERSION.tar.gz
cd sbol2-VERSION
python3 -m unittest discover test

DOCUMENTATION

Full documentation for pySBOL2 is available here.

ACKNOWLEDGEMENTS

Development of this library has been supported by the DARPA Synergistic Discovery and Design (SD2) program and Raytheon BBN Technologies.