- Notifications
You must be signed in to change notification settings - Fork3
Faultless AST for Open Biomedical Ontologies.
License
fastobo/fastobo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Faultless AST for Open Biomedical Ontologies.
This library provides a mostly-complete implementation of theOBO flat file format 1.4.
- Data structures -
fastobo
provides a complete owned AST for theOBO language, with constructors and covenience traits where applicable.There is a plan to provide borrowed data structures as well, to be ableto build a view of an OBO document from borrowed data. - Parsing - The parser is implemented usingpest,and is reexported from the
fastobo-syntax
crate. Most structures implement theFromPair
trait which allows to build a data structure from a stream of pest tokens. - Errors - All functions in that crate that return a
Result
willalways use theError
struct defined in theerror
module. Errorsreported by pest are very meaningful, and can give the exact locationof a syntax error encountered by the parser. - Semantics - This library exports specific methods that can be usedto edit an OBO syntax tree with the semantics expected in the formatguide: mapping identifiers to URLs, adding default namespaces, orexpanding entity frames using
treat-xrefs
macros.
Warning: this project adheres toSemantic Versioning,but the API is likely to change a lot before the release of a stable 1.0.
All the following features are enabled by default, but can be disabled andcherry-picked using thedefault-features = false
option in theCargo.toml
manifest of your project:
memchr
- Use thememchr
library to improveparser speed when searching for a particular character in a buffer.threading
- Use a multi-threaded parser (additionally depending oncrossbeam-channel
), which can greatlyimprove the parser speed if parsing is CPU-bound.smartstring
- Use thesmartstring
library to reduce heap allocation for identifiers and string data.
Addfastobo
to the[dependencies]
sections of yourCargo.toml
manifest:
[dependencies]fastobo ="0.15.2"
The top-levelfastobo
module provides several functions to parse anOboDoc
.Usefastobo::from_reader
to load an OBO document from aBufRead
implementor(usestd::io::BufReader
if needed):
externcrate fastobo;externcrate ureq;fnmain(){letmut response = ureq::get("http://purl.obolibrary.org/obo/ms.obo").call().unwrap();letmut reader = std::io::BufReader::new(response.body_mut().as_reader());match fastobo::from_reader(&mut reader){Ok(doc) =>println!("Number of MS entities: {}", doc.entities().len()),Err(e) =>panic!("Could not parse the Mass-Spec Ontology: {}", e),}}
fastobo-syntax
: Standalonepest
parserfor the OBO format version 1.4.fastobo-graphs
: Data model andserde
implementation of the OBO graphs specification, with conversion traits from and to OBO.fastobo-py
: Idiomatic Python bindings tothis crate.fastobo-validator
: Standalone CLIto validate OBO files against the specification.horned-functional
: Parser forOWL2 Functional Syntax (can be used to parseowl-axioms
clauses).
Found a bug ? Have an enhancement request ? Head over to theGitHub issue tracker of the project ifyou need to report or ask something. If you are filling in on a bug, please include as muchinformation as you can about the issue, and try to recreate the same bug in a simple, easilyreproducible situation.
This project was developed byMartin Larraldeas part of a Master's Degree internship in theBBOP team of theLawrence Berkeley National Laboratory, under the supervision ofChris 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)
About
Faultless AST for Open Biomedical Ontologies.