pub struct NcbiFileTaxonomy { /* private fields */ }
Implementations§
Source§impl NcbiFileTaxonomy
impl NcbiFileTaxonomy
Sourcepub fn from_ncbi_files(
nodes_filename: &str,
names_filename: &str,
) -> Result<NcbiFileTaxonomy, NcbiTaxonomyError>
pub fn from_ncbi_files( nodes_filename: &str, names_filename: &str, ) -> Result<NcbiFileTaxonomy, NcbiTaxonomyError>
from_ncbi_files
Reads the nodes.dmp
file and names.dmp
file from the NCBI Taxonomy database to
generate a NcbiTaxonomy structure
§Examples
use ncbitaxonomy::*;
let taxonomy = NcbiFileTaxonomy::from_ncbi_files("data/nodes.dmp", "data/names.dmp");
pub fn save_to_sqlite( &self, db_url: Option<&str>, ) -> Result<SqliteConnection, ToSqliteError>
Sourcepub fn get_node_by_id(&self, id: i32) -> Option<&NodeId>
pub fn get_node_by_id(&self, id: i32) -> Option<&NodeId>
get_node_by_id
get a NodeId from a numeric NCBI Taxonomy ID
Sourcepub fn traversal(&self, from: i32) -> Option<Traverse<'_, i32>>
pub fn traversal(&self, from: i32) -> Option<Traverse<'_, i32>>
traversal
traverse the tree nodes (in depth first order) from the node with a given NCBI Taxonomy ID
Sourcepub fn get_id_by_node(&self, node_id: NodeId) -> Option<i32>
pub fn get_id_by_node(&self, node_id: NodeId) -> Option<i32>
get_id_by_node
get the NCBI Taxonomy ID held by the node with a given NodeId
Trait Implementations§
Source§impl Debug for NcbiFileTaxonomy
impl Debug for NcbiFileTaxonomy
Source§impl NcbiTaxonomy for NcbiFileTaxonomy
impl NcbiTaxonomy for NcbiFileTaxonomy
Source§fn contains_id(&self, id: i32) -> bool
fn contains_id(&self, id: i32) -> bool
contains_id
check whether the taxonomy contains a (number) ID
Source§fn contains_name(&self, name: &str) -> bool
fn contains_name(&self, name: &str) -> bool
contains_name
check whether the taxonomy contains a node with the specified name
note: the name used is what is reported as a the ‘scientific name’ in the NCBI Taxonomy database. synonyms are currently not supported
Source§fn is_descendant(&self, name: &str, ancestor_name: &str) -> bool
fn is_descendant(&self, name: &str, ancestor_name: &str) -> bool
is_descendant
check if a certain named node is a descendant of another named named
Source§fn is_descendant_taxid(&self, taxid: i32, ancestor_taxid: i32) -> bool
fn is_descendant_taxid(&self, taxid: i32, ancestor_taxid: i32) -> bool
is_descendant_taxid
check if a certain node with taxid is a descendant of another taxid
Source§fn get_name_by_id(&self, id: i32) -> Option<String>
fn get_name_by_id(&self, id: i32) -> Option<String>
get_name_by_id
get the scientific name associated with a given NCBI Taxonomy ID
Source§fn get_lineage(&self, name: &str) -> Option<Vec<i32>>
fn get_lineage(&self, name: &str) -> Option<Vec<i32>>
get_lineage
get the list of IDs of a taxon and its parents (up to the root)
Source§fn get_distance_to_common_ancestor_taxid(
&self,
taxid1: i32,
taxid2: i32,
only_canonical: bool,
) -> Option<(i32, i32)>
fn get_distance_to_common_ancestor_taxid( &self, taxid1: i32, taxid2: i32, only_canonical: bool, ) -> Option<(i32, i32)>
get_distance_to_common_ancestor_id
get the distance (in steps in the tree) between taxid1 and the common ancestor with taxid2
Source§fn get_distance_to_common_ancestor(
&self,
name1: &str,
name2: &str,
only_canonical: bool,
) -> Option<(i32, String)>
fn get_distance_to_common_ancestor( &self, name1: &str, name2: &str, only_canonical: bool, ) -> Option<(i32, String)>
get_distance_to_common_ancestor
find the distance in the tree between name1 and name2
fn get_id_by_name(&self, name: &str) -> Option<i32>
Auto Trait Implementations§
impl Freeze for NcbiFileTaxonomy
impl RefUnwindSafe for NcbiFileTaxonomy
impl Send for NcbiFileTaxonomy
impl Sync for NcbiFileTaxonomy
impl Unpin for NcbiFileTaxonomy
impl UnwindSafe for NcbiFileTaxonomy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
fn into_sql<T>(self) -> Self::Expressionwhere
Self: Sized + AsExpression<T>,
self
to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere
&'a Self: AsExpression<T>,
&self
to an expression for Diesel’s query builder. Read more