#obo #graphs #ontology #serde #parser

fastobo-graphs

OBO Graphs data model, decoder and encoder in Rust

8 unstable releases (3 breaking)

0.4.2 Nov 17, 2020
0.4.1 Aug 30, 2020
0.4.0 Jul 27, 2020
0.3.0 Jun 14, 2020
0.1.2 Aug 27, 2019

#224 in Parser implementations

Download history 121/week @ 2020-08-11 54/week @ 2020-08-18 69/week @ 2020-08-25 105/week @ 2020-09-01 47/week @ 2020-09-08 28/week @ 2020-09-15 27/week @ 2020-09-22 62/week @ 2020-09-29 17/week @ 2020-10-06 35/week @ 2020-10-13 70/week @ 2020-10-20 18/week @ 2020-10-27 37/week @ 2020-11-03 9/week @ 2020-11-10 45/week @ 2020-11-17 52/week @ 2020-11-24

195 downloads per month

MIT license

68KB
1.5K SLoC

fastobo-graphs Star me

OBO Graphs decoder and encoder in Rust.

TravisCI Codecov License Source Crate Documentation Changelog GitHub issues DOI

Overview

This library provides an implementation of the OBO Graphs schema specified by the Gene Ontology to provide developers with a data format easier to use than plain ontology files in OBO or OWL format.

  • Data structures - the complete OBO Graphs schema is reproduced into Rust data structures with public fields for direct access to the graphs nodes. See fastobo_graphs::model to see the comprehensive list of data structures.
  • I/O - structures use serde to implement serialization and deserialization from both YAML and JSON.
  • Errors - fallible operations can return an Error with informative messages as well as an std::error::Error implementation.
  • Conversion traits - OBO Graphs can be (partially) converted to and from plain OBO documents, using the FromGraph and IntoGraph traits.

Usage

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

[dependencies]
fastobo-graphs = "0.4"

Then use one of the top-level functions in fastobo_graphs to load a JSON or YAML serialized OBO Graph:

extern crate fastobo_graphs;
extern crate ureq;

fn main() {
    let response = ureq::get("http://purl.obolibrary.org/obo/zeco.json").call();
    let doc = ;

    match fastobo_graphs::from_reader(response.into_reader()) {
        Ok(doc) => println!("Number of ZECO nodes: {}", doc.graphs[0].nodes.len()),
        Err(e) => panic!("Could not parse ZECO OBO Graph: {}", e),
    }
}

Features

The following feature is enabled by default, but can be disabled if needed:

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 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)

Dependencies

~1.3–2.4MB
~54K SLoC