extern crate lazy_static;
extern crate obofoundry;
extern crate ureq;
extern crate fastobo;
use std::io::BufRead;
use std::io::BufReader;
lazy_static::lazy_static! {
static ref FOUNDRY: obofoundry::Foundry = {
let response = ureq::get("http://www.obofoundry.org/registry/ontologies.yml")
.call();
serde_yaml::from_reader(response.into_reader())
.expect("could not read the OBO Foundry listing")
};
}
macro_rules! foundrytest {
( $(#[$attr:meta])* $ont:ident) => (
$(#[$attr])*
#[test]
fn $ont() {
let ref url = FOUNDRY
.ontologies
.iter()
.find(|onto| onto.id == stringify!($ont))
.expect("could not find ontology")
.products
.iter()
.find(|prod| prod.id.ends_with(".obo"))
.expect("could not find obo product")
.ontology_purl;
let res = ureq::get(url.as_str()).call();
let mut buf = BufReader::new(res.into_reader());
let peek = buf.fill_buf().expect("could not read response");
if peek.starts_with(b"format-version:") {
match fastobo::ast::OboDoc::from_stream(&mut buf) {
Ok(doc) => println!("{}", doc.header()),
Err(e) => panic!("{}", e),
}
} else {
panic!("not an OBO file ({})", url);
}
}
)
}
foundrytest!(po);
foundrytest!(xao);
foundrytest!(zfa);
foundrytest!(bfo);
foundrytest!(pato);
foundrytest!(fao);
foundrytest!(eco);
foundrytest!(ceph);
foundrytest!(wbbt);
foundrytest!(ddanat);
foundrytest!(ms);
foundrytest!(cio);
foundrytest!(zfs);
foundrytest!(emapa);
foundrytest!(xpo);
foundrytest!(exo);
foundrytest!(wbls);
foundrytest!(olatdv);
foundrytest!(planp);
foundrytest!(fbbt);
foundrytest!(pdumdv);
foundrytest!(oba);
foundrytest!(cmo);
foundrytest!(hp);
foundrytest!(phipo);
foundrytest!(so);
foundrytest!(mmusdv);
foundrytest!(hsapdv);
foundrytest!(peco);
foundrytest!(apo);
foundrytest!(ehdaa2);
foundrytest!(taxrank);
foundrytest!(plana);
foundrytest!(ddpheno);
foundrytest!(wbphenotype);
foundrytest!(fbdv);
foundrytest!(omp);
foundrytest!(#[ignore] mondo);
foundrytest!(#[ignore] ncbitaxon);
foundrytest!(#[ignore] ncit);
foundrytest!(#[ignore] go);
foundrytest!(#[ignore] vto);
foundrytest!(#[ignore] pr);
foundrytest!(#[ignore] tto);
foundrytest!(#[ignore] trans);
foundrytest!(#[ignore] fix);
foundrytest!(#[ignore] fypo);
foundrytest!(#[ignore] sibo);
foundrytest!(#[ignore] fbcv);
foundrytest!(#[ignore] ecocore);
foundrytest!(#[ignore] chebi);
foundrytest!(#[ignore] uberon);
foundrytest!(#[ignore] xco);
foundrytest!(#[ignore] to);
foundrytest!(#[ignore] pw);
foundrytest!(#[ignore] envo);
foundrytest!(#[ignore] mmo);
foundrytest!(#[ignore] mi);
foundrytest!(#[ignore] mco);
foundrytest!(#[ignore] doid);
foundrytest!(#[ignore] cl);
foundrytest!(#[ignore] gaz);
foundrytest!(#[ignore] hao);
foundrytest!(#[ignore] mp);
foundrytest!(#[ignore] symp);
foundrytest!(#[ignore] zp);
foundrytest!(#[ignore] zeco);
foundrytest!(#[ignore] xlmod);
foundrytest!(#[ignore] rnao);
foundrytest!(#[ignore] ro);
foundrytest!(#[ignore] rs);
foundrytest!(#[ignore] eo);