Struct taxonomy::GeneralTaxonomy [−][src]
pub struct GeneralTaxonomy {
pub tax_ids: Vec<String>,
pub parent_ids: Vec<usize>,
pub parent_dists: Vec<f32>,
pub ranks: Vec<TaxRank>,
pub names: Vec<String>,
// some fields omitted
}
Expand description
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>
Implementations
Initializer for a new GeneralTaxonomy.
All Vec
s must be the same length or initialization will fail.
Build a GeneralTaxonomy from any object that implements the Taxonomy trait.
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.
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.
Retrieves the external ID given its name
Always errors on Newick since it doesn’t contain names.
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
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This is the implementation for &str taxonomy access for a more end-user understandable (but slightly slower) workflow.
Returns a Vec of all the child IDs of the given tax_id.
Returns the taxonomic rank of the tax_id provided. Read more
Returns the parent at a given taxonomic rank (note this may not be the immediate parent). This also returns the distance to that parent. Read more
Returns the first common parent between two nodes. E.g. for the tree: Read more
Generates an iterator that traces over the entire taxonomic tree. During
preorder traversal, it returns (T, true)
and during postorder traversal
it returns (T, false)
Read more
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 indices.
Returns a Vec of all the child IDs of the given tax_id.
Returns the name of the tax_id provided. Read more
Returns the taxonomic rank of the tax_id provided. Read more
Returns the parent at a given taxonomic rank (note this may not be the immediate parent). This also returns the distance to that parent. Read more
Returns the first common parent between two nodes. E.g. for the tree: Read more
Generates an iterator that traces over the entire taxonomic tree. During
preorder traversal, it returns (T, true)
and during postorder traversal
it returns (T, false)
Read more
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
Mutably borrows from an owned value. Read more