fastobo 
Faultless AST for Open Biomedical Ontologies.
Overview
This library provides a mostly-complete implementation of the OBO flat file format 1.4.
- Data structures -
fastoboprovides a complete owned AST for the OBO language, with constructors and covenience traits where applicable. There is a plan to provide borrowed data structures as well, to be able to build a view of an OBO document from borrowed data. - Parsing - The parser is implemented using pest,
and is reexported from the
fastobo-syntaxcrate. Most structures implement theFromPairtrait which allows to build a data structure from a stream of pest tokens. - Errors - All functions in that crate that return a
Resultwill always use theErrorstruct defined in theerrormodule. Errors reported by pest are very meaningful, and can give the exact location of a syntax error encountered by the parser. - Semantics - This library exports specific methods that can be used
to edit an OBO syntax tree with the semantics expected in the format
guide: mapping identifiers to URLs, adding default namespaces, or
expanding entity frames using
treat-xrefsmacros.
Warning: this project adheres to Semantic Versioning, but the API is likely to change a lot before the release of a stable 1.0.
Features
All the following features are enabled by default, but can be disabled and
cherry-picked using the default-features = false option in the Cargo.toml
manifest of your project:
memchr- Use thememchrlibrary to improve parser speed when searching for a particular character in a buffer.semantics- Compile additional methods to check the validity of an OBO document on the semantic level, and implementation of macros to transform OBO documents in place.
Usage
Add fastobo to the [dependencies] sections of your Cargo.toml manifest:
[]
= "0.3.0"
The OboDoc struct acts as the root of the AST. Use OboDoc::from_stream to load an OBO document
from a BufRead implementor
(use std::io::BufReader if needed):
extern crate fastobo;
extern crate ureq;
See also
fastobo-syntax: Standalonepestparser for the OBO format version 1.4.fastobo-py: Idiomatic Python bindings to this crate.fastobo-validator: Standalone CLI to validate OBO files against the specification.
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.
About
This project is currently being 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.