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 Vecs 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

Add a new node to the taxonomy.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Create a new GeneralTaxonomy with only a root node.

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

This is the implementation for &str taxonomy access for a more end-user understandable (but slightly slower) workflow.

Returns the root node of the entire tree.

Returns a Vec of all the child IDs of the given tax_id.

Returns the parent of the given taxonomic node and the distance to said parent. The parent of the root node should always be None. Read more

Returns the number of nodes in the taxonomy Read more

Returns the name of the tax_id provided. Read more

Returns the taxonomic rank of the tax_id provided. Read more

Returns a Vec of taxonomy nodes from the one provided back to root. This method must return the node itself as the first entry in the list and the root node as the last entry in the list. 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

Determines if there are any nodes at all in the taxonomy. This should almost always be implemented for performance reasons. 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 the root node of the entire tree.

Returns a Vec of all the child IDs of the given tax_id.

Returns the parent of the given taxonomic node and the distance to said parent. The parent of the root node should always be None. Read more

Returns the number of nodes in the taxonomy Read more

Returns the name of the tax_id provided. Read more

Returns the taxonomic rank of the tax_id provided. Read more

Returns a Vec of taxonomy nodes from the one provided back to root. This method must return the node itself as the first entry in the list and the root node as the last entry in the list. 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

Determines if there are any nodes at all in the taxonomy. This should almost always be implemented for performance reasons. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.