Skip to content

fastobo/fastobo-py

Repository files navigation

fastobo-py Star me

Faultless AST for Open Biomedical Ontologies in Python.

Actions Codecov License Source PyPI Wheel Bioconda Python Versions PyPI - Implementation Changelog Documentation GitHub issues DOI Downloads

Overview

fastobo is a Rust library implementing a reliable parser for the OBO file format 1.4. This extension module exports idiomatic Python bindings that can be used to load, edit and serialize ontologies in the OBO format.

Installation

If your platform has no pre-built binaries available, you will need to have the Rust compiler installed. See the documentation on rust-lang.org to learn how to install Rust on your machine.

Installation is then supported through pip:

$ pip install fastobo --user

Usage

An OboDoc instance can be instantiated from a path or from a binary file handle using the fastobo.load function, or from a string using the fastobo.loads function.

import fastobo
obodoc = fastobo.load("../data/ms.obo")

Loading from a gzip file is supported:

import fastobo
import gzip
gzdoc = fastobo.load(gzip.open("../data/cl.obo.gz"))

Comments can be parsed but neither edited nor serialized, because of a limitation with pyo3 (the library used to generate the Python bindings). They are supported in the Rust version of fastobo.

Feedback

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker of the project if you need to report or ask something. If you are filling in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.

The following people have contributed to this project:

About

This project was developed by Martin Larralde as part of a Master's Degree internship in the BBOP team of the Lawrence Berkeley National Laboratory, under the supervision of Chris Mungall. Cite this project as:

Larralde M. Developing Python and Rust libraries to improve the ontology ecosystem [version 1; not peer reviewed]. F1000Research 2019, 8(ISCB Comm J):1500 (poster) (https://doi.org/10.7490/f1000research.1117405.1)