pub struct HpoTerm<'a> { /* private fields */ }
Expand description
The HpoTerm
represents a single term from the HP Ontology
The term holds all required information and relationship data. It provides functionality for path traversals and similarity calculations.
Implementations§
source§impl<'a> HpoTerm<'a>
impl<'a> HpoTerm<'a>
sourcepub fn try_new<I: Into<HpoTermId>>(
ontology: &'a Ontology,
term: I
) -> HpoResult<HpoTerm<'a>>
pub fn try_new<I: Into<HpoTermId>>( ontology: &'a Ontology, term: I ) -> HpoResult<HpoTerm<'a>>
Constructs a new HpoTerm
§Errors
If the given HpoTermId
does not match an existing term
it returns an Error
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = HpoTerm::try_new(&ontology, 118u32);
assert!(term.is_ok());
let non_existing_term = HpoTerm::try_new(&ontology, 666666666u32);
assert!(non_existing_term.is_err());
sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns the name of the term
e.g.: Abnormality of the nervous system
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(118u32).unwrap();
assert_eq!(term.name(), "Phenotypic abnormality");
sourcepub fn parent_ids(&self) -> &HpoGroup
pub fn parent_ids(&self) -> &HpoGroup
sourcepub fn parents(&self) -> Iter<'a> ⓘ
pub fn parents(&self) -> Iter<'a> ⓘ
Returns an iterator of the direct patients of the term
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(11017u32).unwrap();
assert_eq!(term.parents().count(), 1);
for parent in term.parents() {
println!("{}", parent.name());
}
sourcepub fn all_parent_ids(&self) -> &HpoGroup
pub fn all_parent_ids(&self) -> &HpoGroup
sourcepub fn all_parents(&self) -> Iter<'a> ⓘ
pub fn all_parents(&self) -> Iter<'a> ⓘ
Returns an iterator of the direct and indirect parents of the term
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(11017u32).unwrap();
assert_eq!(term.all_parents().count(), 3);
for parent in term.all_parents() {
println!("{}", parent.name());
}
sourcepub fn children_ids(&self) -> &HpoGroup
pub fn children_ids(&self) -> &HpoGroup
sourcepub fn children(&self) -> Iter<'a> ⓘ
pub fn children(&self) -> Iter<'a> ⓘ
Returns an iterator of the direct children of the term
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(1939u32).unwrap();
for child in term.children() {
println!("{}", child.name());
}
sourcepub fn all_common_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
pub fn all_common_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
Returns the HpoTermId
s that are parents of both self
and other
§Note:
This method includes self
and other
into their corresponding
parent-id list so that if one term is a parent term of the other,
it is included. It also means that self
is included if self == other
.
This might seem counter-intuitive at first, but in most cases this is what is actually needed
§Examples
§Note:
Check out the crate::Ontology
documentation to see the example ontology
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(25454u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let common_ancestors = term1.all_common_ancestor_ids(&term2);
assert_eq!(common_ancestors.len(), 3);
assert!(!common_ancestors.contains(&11017u32.into()));
assert!(!common_ancestors.contains(&25454u32.into()));
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let common_ancestors = term1.all_common_ancestor_ids(&term2);
assert_eq!(common_ancestors.len(), 3);
assert!(!common_ancestors.contains(&11017u32.into()));
assert!(common_ancestors.contains(&1939u32.into()));
sourcepub fn common_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
pub fn common_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
Returns the HpoTermId
s that are parents of both self
and other
§Note:
This method does not include self
and other
. Depending on your
use case, you might prefer HpoTerm::all_common_ancestor_ids
.
§Examples
§Note:
Check out the crate::Ontology
documentation to see the example ontology
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(25454u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let common_ancestors = term1.common_ancestor_ids(&term2);
assert_eq!(common_ancestors.len(), 3);
assert!(!common_ancestors.contains(&11017u32.into()));
assert!(!common_ancestors.contains(&25454u32.into()));
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let common_ancestors = term1.common_ancestor_ids(&term2);
assert_eq!(common_ancestors.len(), 2);
assert!(!common_ancestors.contains(&11017u32.into()));
assert!(!common_ancestors.contains(&1939u32.into()));
sourcepub fn all_union_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
pub fn all_union_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
Returns the HpoTermId
s that are parents of either self
or other
§Note:
This method includes self
and other
into their corresponding
parent-id list so that both are included themselves as well.
This might seem counter-intuitive at first, but in many cases this is what is actually needed
§Examples
§Note:
Check out the crate::Ontology
documentation to see the example ontology
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(12639u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let union_ancestors = term1.all_union_ancestor_ids(&term2);
assert_eq!(union_ancestors.len(), 4);
assert!(!union_ancestors.contains(&11017u32.into()));
assert!(!union_ancestors.contains(&12639u32.into()));
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let union_ancestors = term1.all_union_ancestor_ids(&term2);
assert_eq!(union_ancestors.len(), 3);
assert!(!union_ancestors.contains(&11017u32.into()));
assert!(union_ancestors.contains(&1939u32.into()));
sourcepub fn union_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
pub fn union_ancestor_ids(&self, other: &HpoTerm<'_>) -> HpoGroup
Returns the HpoTermId
s that are parents of either self
or other
§Examples
§Note:
Check out the crate::Ontology
documentation to see the example ontology
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(12639u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let union_ancestors = term1.all_union_ancestor_ids(&term2);
assert_eq!(union_ancestors.len(), 4);
assert!(!union_ancestors.contains(&11017u32.into()));
assert!(!union_ancestors.contains(&12639u32.into()));
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let union_ancestors = term1.all_union_ancestor_ids(&term2);
assert_eq!(union_ancestors.len(), 3);
assert!(!union_ancestors.contains(&11017u32.into()));
assert!(union_ancestors.contains(&1939u32.into()));
sourcepub fn all_common_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
pub fn all_common_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
Returns an iterator of HpoTerm
s that are parents of both self
and other
§Note:
This method includes self
and other
into their corresponding
parent-id list so that if one term is a parent term of the other,
it is included. It also means that self
is included if self == other
.
This might seem counter-intuitive at first, but in most cases this is what is actually needed
§Examples
§Note:
Check out the crate::Ontology
documentation to see the example ontology
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(25454u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let common_ancestors = term1.all_common_ancestors(&term2);
assert_eq!(common_ancestors.len(), 3);
for term in &common_ancestors {
println!("{}", term.name());
}
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let common_ancestors = term1.all_common_ancestors(&term2);
assert_eq!(common_ancestors.len(), 3);
for term in &common_ancestors {
println!("{}", term.name());
}
sourcepub fn common_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
pub fn common_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
Returns an iterator of HpoTerm
s that are parents of both self
and other
§Note:
This method does not include self
and other
. Depending on your
use case, you might prefer [HpoTerm.all_common_ancestor_ids
].
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(25454u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let common_ancestors = term1.common_ancestors(&term2);
assert_eq!(common_ancestors.len(), 3);
for term in &common_ancestors {
println!("{}", term.name());
}
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let common_ancestors = term1.common_ancestors(&term2);
assert_eq!(common_ancestors.len(), 2);
for term in &common_ancestors {
println!("{}", term.name());
}
sourcepub fn all_union_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
pub fn all_union_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
Returns an iterator of HpoTerm
s that are parents of either self
or other
§Note:
This method includes self
and other
into their corresponding
parent-id list so that both are included themselves as well.
This might seem counter-intuitive at first, but in many cases this is what is actually needed
§Examples
§Note:
Check out the crate::Ontology
documentation to see the example ontology
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(12639u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let union_ancestors = term1.all_union_ancestors(&term2);
assert_eq!(union_ancestors.len(), 4);
for term in &union_ancestors {
println!("{}", term.name());
}
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let union_ancestors = term1.all_union_ancestors(&term2);
assert_eq!(union_ancestors.len(), 3);
for term in &union_ancestors {
println!("{}", term.name());
}
sourcepub fn union_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
pub fn union_ancestors(&self, other: &HpoTerm<'_>) -> Combined<'_>
Returns an iterator of HpoTerm
s that are parents of either self
or other
§Examples
§Note:
Check out the crate::Ontology
documentation to see the example ontology
§Test-case 1: Terms do not have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(12639u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(!term2.parent_of(&term1));
let union_ancestors = term1.union_ancestors(&term2);
assert_eq!(union_ancestors.len(), 4);
for term in &union_ancestors {
println!("{}", term.name());
}
§Test-case 2: Terms do have a parent - child relationship
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(1939u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
let union_ancestors = term1.union_ancestors(&term2);
assert_eq!(union_ancestors.len(), 3);
for term in &union_ancestors {
println!("{}", term.name());
}
sourcepub fn genes(&self) -> GeneIterator<'a> ⓘ
pub fn genes(&self) -> GeneIterator<'a> ⓘ
Returns an iterator of all associated crate::annotations::Gene
s
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(11017u32).unwrap();
for gene in term.genes() {
println!("{}", gene.name());
}
sourcepub fn gene_ids(&self) -> &Genes
pub fn gene_ids(&self) -> &Genes
Returns the set of all associated crate::annotations::Gene
s
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(11017u32).unwrap();
assert_eq!(term.gene_ids().len(), 575);
sourcepub fn omim_diseases(&self) -> OmimDiseaseIterator<'a> ⓘ
pub fn omim_diseases(&self) -> OmimDiseaseIterator<'a> ⓘ
Returns an iterator of all associated crate::annotations::OmimDisease
s
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(11017u32).unwrap();
for disease in term.omim_diseases() {
println!("{}", disease.name());
}
sourcepub fn omim_disease_ids(&self) -> &OmimDiseases
pub fn omim_disease_ids(&self) -> &OmimDiseases
Returns the set of all associated crate::annotations::OmimDisease
s
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(1939u32).unwrap();
assert_eq!(term.omim_disease_ids().len(), 143);
sourcepub fn information_content(&self) -> &InformationContent
pub fn information_content(&self) -> &InformationContent
Returns the InformationContent
of the term
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term = ontology.hpo(1939u32).unwrap();
let ic = term.information_content();
assert_eq!(ic.gene(), 0.6816717);
assert_eq!(ic.omim_disease(), 3.4335358);
sourcepub fn similarity_score(
&self,
other: &HpoTerm<'_>,
similarity: &impl Similarity
) -> f32
pub fn similarity_score( &self, other: &HpoTerm<'_>, similarity: &impl Similarity ) -> f32
Calculates the similarity of self
and other
using the provided Similarity
algorithm
§Examples
use hpo::{HpoTerm, Ontology};
use hpo::similarity::Builtins;
use hpo::term::InformationContentKind;
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(11017u32).unwrap();
let term2 = ontology.hpo(12639u32).unwrap();
let sim = term1.similarity_score(&term2, &Builtins::GraphIc(InformationContentKind::Omim));
assert_eq!(sim, 0.2765914);
sourcepub fn distance_to_ancestor(&self, other: &HpoTerm<'_>) -> Option<usize>
pub fn distance_to_ancestor(&self, other: &HpoTerm<'_>) -> Option<usize>
Returns the distance (steps) from self
to other
, if other
is a parent of self
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(25454u32).unwrap();
let term2 = ontology.hpo(118u32).unwrap();
let term3 = ontology.hpo(12639u32).unwrap();
assert_eq!(term1.distance_to_ancestor(&term2), Some(2));
assert_eq!(term2.distance_to_ancestor(&term1), None);
assert_eq!(term1.distance_to_ancestor(&term3), None);
sourcepub fn child_of(&self, other: &HpoTerm<'_>) -> bool
pub fn child_of(&self, other: &HpoTerm<'_>) -> bool
Returns true
if self
is a child (direct or indirect) of other
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(25454u32).unwrap();
let term2 = ontology.hpo(118u32).unwrap();
assert!(term1.child_of(&term2));
assert!(!term2.child_of(&term1));
sourcepub fn parent_of(&self, other: &HpoTerm<'_>) -> bool
pub fn parent_of(&self, other: &HpoTerm<'_>) -> bool
Returns true
if self
is a parent (direct or indirect) of other
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(25454u32).unwrap();
let term2 = ontology.hpo(118u32).unwrap();
assert!(!term1.parent_of(&term2));
assert!(term2.parent_of(&term1));
sourcepub fn path_to_ancestor(&self, other: &HpoTerm<'_>) -> Option<Vec<HpoTermId>>
pub fn path_to_ancestor(&self, other: &HpoTerm<'_>) -> Option<Vec<HpoTermId>>
Returns the shortest path to traverse from self
to other
, if other
is a parent of self
§Examples
use hpo::{HpoTerm, HpoTermId, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(25454u32).unwrap();
let term2 = ontology.hpo(118u32).unwrap();
assert_eq!(
term1.path_to_ancestor(&term2).unwrap(),
vec![
HpoTermId::try_from("HP:0001939").unwrap(),
HpoTermId::try_from("HP:0000118").unwrap()
]
);
assert_eq!(term2.path_to_ancestor(&term1), None);
sourcepub fn distance_to_term(&self, other: &HpoTerm<'_>) -> Option<usize>
pub fn distance_to_term(&self, other: &HpoTerm<'_>) -> Option<usize>
Returns the distance (steps) from self
to other
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(25454u32).unwrap();
let term2 = ontology.hpo(118u32).unwrap();
let term3 = ontology.hpo(12639u32).unwrap();
assert_eq!(term1.distance_to_term(&term2), Some(2));
assert_eq!(term2.distance_to_term(&term1), Some(2));
assert_eq!(term1.distance_to_term(&term3), Some(4));
sourcepub fn path_to_term(&self, other: &HpoTerm<'_>) -> Option<Vec<HpoTermId>>
pub fn path_to_term(&self, other: &HpoTerm<'_>) -> Option<Vec<HpoTermId>>
Returns the shortest path to traverse from self
to other
This method is not optimized for performance
§Examples
use hpo::{HpoTerm, Ontology, HpoTermId};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let term1 = ontology.hpo(25454u32).unwrap();
let term3 = ontology.hpo(12639u32).unwrap();
assert_eq!(
term1.path_to_term(&term3).unwrap(),
vec![
HpoTermId::try_from("HP:0001939").unwrap(),
HpoTermId::try_from("HP:0000118").unwrap(),
HpoTermId::try_from("HP:0000707").unwrap(),
HpoTermId::try_from("HP:0012639").unwrap()
]
);
§Panics
TODO
sourcepub fn is_obsolete(&self) -> bool
pub fn is_obsolete(&self) -> bool
Returns true
if the term is flagged as obsolete
sourcepub fn replaced_by(&self) -> Option<HpoTerm<'a>>
pub fn replaced_by(&self) -> Option<HpoTerm<'a>>
Returns the replacement term, if it exists
Returns None
otherwise
If a term has multiple replaced_by
annotations only one annotation
is selected as replacement. Usually the last one, if parsing from an obo
file.
sourcepub fn replacement_id(&self) -> Option<HpoTermId>
pub fn replacement_id(&self) -> Option<HpoTermId>
Returns the HpoTermId
of an replacement term, if it exists
Returns None
otherwise
If a term has multiple replaced_by
annotations only one annotation
is selected as replacement. Usually the last one, if parsing from an obo
file.
sourcepub fn is_modifier(&self) -> bool
pub fn is_modifier(&self) -> bool
Returns true
if the term is a descendent of a modifier root term
§Examples
use hpo::{HpoTerm, Ontology};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let mendelian_inheritance = ontology.hpo(34345u32).unwrap();
let adult_onset = ontology.hpo(3581u32).unwrap();
let abnormal_forebrain_morphology = ontology.hpo(100547u32).unwrap();
assert!(mendelian_inheritance.is_modifier());
assert!(adult_onset.is_modifier());
assert!(!abnormal_forebrain_morphology.is_modifier());
sourcepub fn categories(&self) -> Vec<HpoTermId>
pub fn categories(&self) -> Vec<HpoTermId>
Returns the category of the term, or None
if uncategorized
Categories are defined in Ontology::set_default_categories()
The default implementation ensures that each term is categorized in exactly one category, but this can be modified on the Ontology level. If a term might be part of multiple categories, one is (semi-)randomly selected.
§Examples
use hpo::{HpoTerm, Ontology, HpoTermId};
let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let mendelian_inheritance = ontology.hpo(HpoTermId::from_u32(34345)).unwrap();
let adult_onset = ontology.hpo(HpoTermId::from_u32(3581)).unwrap();
let abnormal_hypothalamus_physiology = ontology.hpo(HpoTermId::from_u32(12285)).unwrap();
assert_eq!(mendelian_inheritance.categories(), vec![HpoTermId::from_u32(5)]);
assert_eq!(adult_onset.categories(), vec![HpoTermId::from_u32(12823)]);
assert_eq!(abnormal_hypothalamus_physiology.categories(), vec![HpoTermId::from_u32(707), HpoTermId::from_u32(818)]);
Trait Implementations§
source§impl<'b, 'a> Extend<HpoTerm<'b>> for HpoSet<'a>
impl<'b, 'a> Extend<HpoTerm<'b>> for HpoSet<'a>
source§fn extend<T: IntoIterator<Item = HpoTerm<'b>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = HpoTerm<'b>>>(&mut self, iter: T)
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<'a> FromIterator<HpoTerm<'a>> for HpoGroup
impl<'a> FromIterator<HpoTerm<'a>> for HpoGroup
source§impl PartialEq for HpoTerm<'_>
impl PartialEq for HpoTerm<'_>
impl<'a> Copy for HpoTerm<'a>
impl Eq for HpoTerm<'_>
Auto Trait Implementations§
impl<'a> Freeze for HpoTerm<'a>
impl<'a> RefUnwindSafe for HpoTerm<'a>
impl<'a> Send for HpoTerm<'a>
impl<'a> Sync for HpoTerm<'a>
impl<'a> Unpin for HpoTerm<'a>
impl<'a> UnwindSafe for HpoTerm<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.