#obo #ontology #syntax #ast #parser

fastobo

Faultless AST for Open Biomedical Ontologies

4 releases

✓ Uses Rust 2018 edition

new 0.2.1 May 25, 2019
0.2.0 May 15, 2019
0.1.1 May 10, 2019
0.1.0 May 9, 2019

#61 in Parser implementations

41 downloads per month
Used in 1 crate

MIT license

275KB
7K SLoC

fastobo Star me

Faultless AST for Open Biomedical Ontologies.

TravisCI Codecov License Source Crate Documentation Changelog GitHub issues

Overview

This library provides an abstract syntax tree for the OBO flat file format 1.4.

Usage

Add fastobo to the [dependencies] sections of your Cargo.toml manifest:

[dependencies]
fastobo = "0.1.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 reqwest;

fn main() {
    let response = reqwest::get("http://purl.obolibrary.org/obo/go.obo").unwrap();
    let mut reader = std::io::BufReader::new(response);

    match fastobo::ast::OboDoc::from_stream(&mut reader) {
        Ok(doc) => println!("Number of GO entities: {}", doc.entities.len()),
        Err(e) => panic!("Could not parse the Gene Ontology: {}", e),
    }
}

Missing features

  • Support for comment blocks between frames
  • Support for comments in property_value clauses in headers.
  • More std traits implementation.

See also

  • fastobo-syntax: Standalone pest parser for the OBO format version 1.4.
  • fastobo-py: Idiomatic Python bindings to this crate.

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.

Dependencies

~4MB
~76K SLoC