1use crate::Ontology;
16use core::fmt::Debug;
17
18pub mod group;
19mod hpoterm;
20mod hpotermid;
21mod information_content;
22pub(crate) mod internal;
23
24pub use group::HpoGroup;
25pub use hpoterm::HpoTerm;
26pub use hpotermid::HpoTermId;
27pub use information_content::{InformationContent, InformationContentKind};
28
29pub struct Iter<'a> {
31 group_iter: group::Iter<'a>,
32 ontology: &'a Ontology,
33}
34
35impl<'a> Iter<'a> {
36 pub(crate) fn new(group_iter: group::Iter<'a>, ontology: &'a Ontology) -> Self {
37 Self {
38 group_iter,
39 ontology,
40 }
41 }
42}
43
44impl<'a> Iterator for Iter<'a> {
45 type Item = HpoTerm<'a>;
46 fn next(&mut self) -> Option<Self::Item> {
47 match self.group_iter.next() {
48 Some(term) => {
49 let term = self
50 .ontology
51 .get(term)
52 .unwrap_or_else(|| panic!("Invalid HPO-Term: {term}"));
53 Some(HpoTerm::new(self.ontology, term))
54 }
55 None => None,
56 }
57 }
58}
59
60impl Debug for Iter<'_> {
61 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
62 write!(f, "Iter<HpoTerm>")
63 }
64}