Enum hpo::similarity::Builtins

source ·
pub enum Builtins {
    Distance(InformationContentKind),
    GraphIc(InformationContentKind),
    InformationCoefficient(InformationContentKind),
    Jc(InformationContentKind),
    Lin(InformationContentKind),
    Mutation(InformationContentKind),
    Relevance(InformationContentKind),
    Resnik(InformationContentKind),
}
Expand description

Contains similarity methods for the standard built-in algorithms

For more details about each algorithm, check the defaults description.

§Examples

use hpo::{Ontology, HpoSet};
use hpo::term::{InformationContentKind, HpoGroup};
use hpo::similarity::{Builtins, StandardCombiner};

fn set1(ontology: &Ontology) -> HpoSet {
// ...
}

fn set2(ontology: &Ontology) -> HpoSet {
// ...
}

let ontology = Ontology::from_binary("tests/example.hpo").unwrap();
let set_1 = set1(&ontology);
let set_2 = set2(&ontology);

let sim_method = Builtins::GraphIc(InformationContentKind::Omim);

let similarity = set_1.similarity(
    &set_2,
    sim_method,
    StandardCombiner::default()
);

Variants§

§

Distance(InformationContentKind)

Distance - based similarity

§

GraphIc(InformationContentKind)

GraphIc - based similarity

§

InformationCoefficient(InformationContentKind)

InformationCoefficient - based similarity

§

Jc(InformationContentKind)

Jiang & Conrath - based similarity

§

Lin(InformationContentKind)

Lin - based similarity

§

Mutation(InformationContentKind)

Mutation - based similarity

§

Relevance(InformationContentKind)

Relevance - based similarity

§

Resnik(InformationContentKind)

Resnik - based similarity

Implementations§

source§

impl Builtins

source

pub fn new(method: &str, kind: InformationContentKind) -> HpoResult<Self>

Constructs a new Builtins struct from a str

This method is useful to get a Similarity algorithm from a user provided string

use hpo::term::InformationContentKind;
use hpo::similarity::Builtins;

let sim_method = Builtins::new("graphic", InformationContentKind::Omim);
assert!(sim_method.is_ok());

let sim_method = Builtins::new("does-not-exist", InformationContentKind::Omim);
assert!(sim_method.is_err());
§Errors

Returns an HpoError::DoesNotExist error if no similary method with the given name exists

Trait Implementations§

source§

impl Clone for Builtins

source§

fn clone(&self) -> Builtins

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Builtins

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Builtins

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Builtins

source§

fn eq(&self, other: &Builtins) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Similarity for Builtins

source§

fn calculate(&self, a: &HpoTerm<'_>, b: &HpoTerm<'_>) -> f32

calculates the actual similarity between term a and term b
source§

impl Copy for Builtins

source§

impl Eq for Builtins

source§

impl StructuralPartialEq for Builtins

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,