[−][src]Crate fastobo_graphs
fastobo-graphs
OBO Graphs decoder and encoder in Rust.
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 anstd::error::Error
implementation. - Conversion traits - OBO Graphs can be (partially) converted to and from
plain OBO documents, using the
FromGraph
andIntoGraph
traits.
Usage
Add fastobo_graphs
to the [dependencies]
sections of your Cargo.toml
manifest:
[dependencies]
fastobo_graphs = "0.1"
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:
- obo - compile
FromGraph
andIntoGraph
traits that can be used to convert between aGraphDocument
and anOboDoc
.
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.
Modules
constants | Constant datatype IRIs and base URIs used literally during translation. |
error | Standard error implementation for this crate. |
model | The OBO Graphs data model and serde implementation. |
Traits
FromGraph | feature="obo" Trait to convert an OBO graph element into an OBO syntax node. |
IntoGraph | feature="obo" Trait to convert an OBO document into a complete OBO graph document. |
Functions
from_file | Read an OBO graph from a file on the local filesystem. |
from_reader | Read an OBO graph from a |
from_str | Read an OBO graph from a string containing a JSON or YAML serialization. |
to_file | Write an OBO graph to a file on the local filesystem. |
to_string | Write an OBO graph to a string. |
to_writer | Write an OBO graph to a |