pub struct OmimDisease { /* private fields */ }
Expand description

A single OMIM disease

A disease has a unique OmimDiseaseId and a name and is connected to a set of HPO terms

Implementations§

source§

impl OmimDisease

source

pub fn new(id: OmimDiseaseId, name: &str) -> OmimDisease

Initializes a new OMIM disease

This method should rarely, if ever, be used directly. The preferred way to create new genes is through Ontology::add_omim_disease to ensure that each disease exists only once.

source

pub fn id(&self) -> &OmimDiseaseId

The unique OmimDiseaseId of the disease, the OMIM MIM number

source

pub fn name(&self) -> &str

The OMIM disease name

source

pub fn add_term<I: Into<HpoTermId>>(&mut self, term_id: I) -> bool

Connect another HPO term to the disease

source

pub fn hpo_terms(&self) -> &HpoGroup

The set of connected HPO terms

source

pub fn as_bytes(&self) -> Vec<u8>

Returns a binary representation of the OmimDisease

The binary layout is defined as:

Byte offsetNumber of bytesDescription
04The total length of the binary data blob as big-endian u32
44The OmimDiseaseId as big-endian u32
84The length of the OmimDisease Name as big-endian u32
12nThe OmimDisease name as u8 vector
12 + n4The number of associated HPO terms as big-endian u32
16 + nx * 4The HpoTermIds of the associated terms, each encoded as big-endian u32
§Examples
use hpo::annotations::OmimDisease;

let mut disease = OmimDisease::new(123.into(), "FooBar");
let bytes = disease.as_bytes();

assert_eq!(bytes.len(), 4 + 4 + 4 + 6 + 4);
assert_eq!(bytes[4..8], [0u8, 0u8, 0u8, 123u8]); // ID of disease => 123
assert_eq!(bytes[8..12], [0u8, 0u8, 0u8, 6u8]); // Length of Name => 6
source

pub fn to_hpo_set<'a>(&self, ontology: &'a Ontology) -> HpoSet<'a>

Returns an HpoSet from the OmimDisease

Trait Implementations§

source§

impl Clone for OmimDisease

source§

fn clone(&self) -> OmimDisease

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 OmimDisease

source§

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

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

impl Default for OmimDisease

source§

fn default() -> OmimDisease

Returns the “default value” for a type. Read more
source§

impl Hash for OmimDisease

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 OmimDisease

source§

fn eq(&self, other: &OmimDisease) -> 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 TryFrom<&[u8]> for OmimDisease

source§

fn try_from(bytes: &[u8]) -> Result<Self, Self::Error>

Returns an OmimDisease from a bytes vector

The byte layout for this method is defined in OmimDisease::as_bytes

§Examples
use hpo::annotations::{OmimDisease, OmimDiseaseId};

let bytes = vec![
    0u8, 0u8, 0u8, 22u8, // Total size of Blop
    0u8, 0u8, 0u8, 123u8, // ID of the disease => 123
    0u8, 0u8, 0u8, 6u8, // Length of name => 6
    b'F', b'o', b'o', b'b', b'a', b'r', // Foobar
    0u8, 0u8, 0u8, 0u8  // Number of associated HPO Terms => 0
];
let disease = OmimDisease::try_from(&bytes[..]).unwrap();

assert_eq!(disease.name(), "Foobar");
assert_eq!(disease.id(), &OmimDiseaseId::from(123u32));
§

type Error = HpoError

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

impl Eq for OmimDisease

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,