1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! *Faultless AST for Open Biomedical Ontologies.*
//!
//! [](https://travis-ci.org/fastobo/fastobo/branches)
//! [](https://codecov.io/gh/fastobo/fastobo)
//! [](https://choosealicense.com/licenses/mit/)
//! [](https://github.com/fastobo/fastobo)
//! [](https://crates.io/crates/obofoundry)
//! [](https://docs.rs/fastobo)
//! [](https://github.com/fastobo/fastobo/blob/master/README.md)
//! [](https://github.com/fastobo/fastobo/issues)
//!
//! ## Overview
//!
//! This library provides a mostly-complete implementation of the
//! [OBO flat file format 1.4](http://owlcollab.github.io/oboformat/doc/obo-syntax.html).
//!
//! * **Data structures** - `fastobo` provides 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](http://pest.rs/),
//! and is reexported from the [`fastobo-syntax`](https://crates.io/crates/fastobo-syntax)
//! crate. Most structures implement the [`FromPair`](./parser/trait.FromPair.html)
//! trait which allows to build a data structure from a stream of pest tokens.
//! * **Errors** - All functions in that crate that return a `Result` will
//! always use the `Error` struct defined in the `error` module. 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 traits 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-xrefs` macros.
//!
//! *Warning: this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html),
//! but the API is likely to change a lot before the release of a stable 1.0.*
//!
//!
//! ## Usage
//!
//! Add `fastobo` to the `[dependencies]` sections of your `Cargo.toml` manifest:
//! ```toml
//! [dependencies]
//! fastobo = "0.1.0"
//! ```
//!
//! The [`OboDoc`](./ast/struct.OboDoc.html) struct acts as the root of the AST.
//! Use [`OboDoc::from_stream`](ast/struct.OboDoc.html#method.from_stream) to load
//! an OBO document from a [`BufRead`](https://doc.rust-lang.org/std/io/trait.BufRead.html)
//! implementor (use [`std::io::BufReader`](https://doc.rust-lang.org/std/io/struct.BufReader.html)
//! if needed to adapt from a raw stream):
//!
//! ```rust
//! extern crate fastobo;
//! extern crate ureq;
//!
//! fn main() {
//! let response = ureq::get("http://purl.obolibrary.org/obo/ms.obo").call();
//! let mut reader = std::io::BufReader::new(response.into_reader());
//!
//! match fastobo::ast::OboDoc::from_stream(&mut reader) {
//! Ok(doc) => println!("Number of MS entities: {}", doc.entities().len()),
//! Err(e) => panic!("Could not parse the Mass-Spec Ontology: {}", e),
//! }
//! }
//! ```
//!
//!
//! ## See also
//!
//! * [`fastobo-py`](https://pypi.org/project/fastobo/): Idiomatic Python bindings to this crate.
//!
//!
//! ## Feedback
//!
//! Found a bug ? Have an enhancement request ? Head over to the
//! [GitHub issue tracker](https://github.com/fastobo/fastobo/issues) 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](https://github.com/althonos)
//! as part of a Master's Degree internship in the [BBOP team](http://berkeleybop.org/) of the
//! [Lawrence Berkeley National Laboratory](https://www.lbl.gov/), under the supervision of
//! [Chris Mungall](http://biosciences.lbl.gov/profiles/chris-mungall/).
extern crate failure;
extern crate opaque_typedef_macros;
extern crate fastobo_syntax;
extern crate memchr;
extern crate opaque_typedef;
extern crate pest;
extern crate url;
extern crate textwrap;