[−][src]Struct taxonomy::GeneralTaxonomy
A concrete implementation of the Taxonomy trait suitable for interconversions of different formats.
Fields
tax_ids: Vec<String>
parent_ids: Vec<usize>
parent_dists: Vec<f32>
ranks: Vec<TaxRank>
names: Vec<String>
Methods
impl GeneralTaxonomy
[src]
pub fn from_arrays(
tax_ids: Vec<String>,
parent_ids: Vec<usize>,
names: Option<Vec<String>>,
ranks: Option<Vec<TaxRank>>,
dists: Option<Vec<f32>>
) -> Result<Self>
[src]
tax_ids: Vec<String>,
parent_ids: Vec<usize>,
names: Option<Vec<String>>,
ranks: Option<Vec<TaxRank>>,
dists: Option<Vec<f32>>
) -> Result<Self>
Initializer for a new GeneralTaxonomy.
All Vec
s must be the same length or initialization will fail.
pub fn from_taxonomy<'t, T: 't, D: 't>(
taxonomy: &'t impl Taxonomy<'t, T, D>
) -> Result<Self> where
T: Clone + Debug + Display + PartialEq + Ord,
D: Clone + Debug + Ord + Into<f64> + PartialOrd + PartialEq + Sum,
[src]
taxonomy: &'t impl Taxonomy<'t, T, D>
) -> Result<Self> where
T: Clone + Debug + Display + PartialEq + Ord,
D: Clone + Debug + Ord + Into<f64> + PartialOrd + PartialEq + Sum,
Build a GeneralTaxonomy from any object that implements the Taxonomy trait.
pub fn from_internal_id(&self, tax_id: usize) -> Result<&str>
[src]
Given an internal tax_id (an array position) return the corresponding external tax_id (e.g. a NCBI taxonomy ID).
Because the Taxonomy
trait is implemented for internal IDs also,
the can be used to speed up some operations by avoiding a string lookup.
pub fn to_internal_id(&self, tax_id: &str) -> Result<usize>
[src]
Given an external tax_id (e.g. a NCBI taxonomy ID) return the corresponding internal tax_id (the position of that tax node in the internal array).
Because the Taxonomy
trait is implemented for internal IDs also,
the can be used to speed up some operations by avoiding a string lookup.
pub fn remove(&mut self, tax_id: usize) -> Result<()>
[src]
Remove a single node from the taxonomy.
Unlike pruning the children of the node are kept, but are rejoined onto the node's parent. The root node can not be removed
pub fn add(&mut self, parent_id: usize, tax_id: &str) -> Result<()>
[src]
Add a new node to the taxonomy.
Trait Implementations
impl Clone for GeneralTaxonomy
[src]
fn clone(&self) -> GeneralTaxonomy
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for GeneralTaxonomy
[src]
impl Default for GeneralTaxonomy
[src]
impl<'de> Deserialize<'de> for GeneralTaxonomy
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for GeneralTaxonomy
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'s> Taxonomy<'s, &'s str, f32> for GeneralTaxonomy
[src]
This is the implementation for &str taxonomy access for a more end-user understandable (but slightly slower) workflow.
fn root(&'s self) -> &'s str
[src]
fn children(&self, tax_id: &str) -> Result<Vec<&str>>
[src]
fn parent(&self, tax_id: &str) -> Result<Option<(&str, f32)>>
[src]
fn len(&self) -> usize
[src]
fn name(&self, tax_id: &str) -> Result<&str>
[src]
fn rank(&self, tax_id: &str) -> Result<TaxRank>
[src]
fn lineage(&'t self, tax_id: T) -> Result<Vec<T>>
[src]
fn parent_at_rank(&'t self, tax_id: T, rank: TaxRank) -> Result<Option<(T, D)>>
[src]
fn lca(&'t self, id1: T, id2: T) -> Result<T>
[src]
fn traverse(&'t self, node: T) -> Result<TaxonomyIterator<'t, T, D>> where
Self: Sized,
[src]
Self: Sized,
fn is_empty(&'t self) -> bool where
Self: Sized,
[src]
Self: Sized,
impl<'s> Taxonomy<'s, usize, f32> for GeneralTaxonomy
[src]
This is the implementation for "internal" tax ID lookup; these IDs are arbitrary (they're positions of the tax nodes in the internal array) and not linked at all to the "external" (e.g. NCBI) IDs. Using these IDs directly can lead to a decent speed up without having to build indicies.
fn root(&self) -> usize
[src]
fn children(&self, tax_id: usize) -> Result<Vec<usize>>
[src]
fn parent(&self, tax_id: usize) -> Result<Option<(usize, f32)>>
[src]
fn len(&self) -> usize
[src]
fn name(&self, tax_id: usize) -> Result<&str>
[src]
fn rank(&self, tax_id: usize) -> Result<TaxRank>
[src]
fn lineage(&'t self, tax_id: T) -> Result<Vec<T>>
[src]
fn parent_at_rank(&'t self, tax_id: T, rank: TaxRank) -> Result<Option<(T, D)>>
[src]
fn lca(&'t self, id1: T, id2: T) -> Result<T>
[src]
fn traverse(&'t self, node: T) -> Result<TaxonomyIterator<'t, T, D>> where
Self: Sized,
[src]
Self: Sized,
fn is_empty(&'t self) -> bool where
Self: Sized,
[src]
Self: Sized,
Auto Trait Implementations
impl RefUnwindSafe for GeneralTaxonomy
impl Send for GeneralTaxonomy
impl Sync for GeneralTaxonomy
impl Unpin for GeneralTaxonomy
impl UnwindSafe for GeneralTaxonomy
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,