Struct ncbitaxonomy::NcbiTaxonomy
source · pub struct NcbiTaxonomy { /* private fields */ }
Implementations
sourceimpl NcbiTaxonomy
impl NcbiTaxonomy
sourcepub fn from_ncbi_files(
nodes_filename: &str,
names_filename: &str
) -> Result<NcbiTaxonomy, Error>
pub fn from_ncbi_files(
nodes_filename: &str,
names_filename: &str
) -> Result<NcbiTaxonomy, Error>
from_ncbi_files
Reads the nodes.dmp
file and names.dmp
file from the NCBI Taxonomy database to
generate a NcbiTaxonomy structure
Examples
let taxonomy = NcbiTaxonomy::from_ncbi_files("data/nodes.dmp", "data/names.dmp")
sourcepub fn contains_id(&self, id: u32) -> bool
pub fn contains_id(&self, id: u32) -> bool
contains_id
check whether the taxonomy contains a (number) ID
sourcepub fn contains_name(&self, name: &str) -> bool
pub 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
sourcepub fn is_descendant(&self, name: &str, ancestor_name: &str) -> bool
pub 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
sourcepub fn get_node_by_id(&self, id: u32) -> Option<&NodeId>
pub fn get_node_by_id(&self, id: u32) -> Option<&NodeId>
get_node_by_id
get a NodeId from a numeric NCBI Taxonomy ID
sourcepub fn traversal(&self, from: u32) -> Option<Traverse<'_, u32>>
pub fn traversal(&self, from: u32) -> Option<Traverse<'_, u32>>
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<u32>
pub fn get_id_by_node(&self, node_id: NodeId) -> Option<u32>
get_id_by_node
get the NCBI Taxonomy ID held by the node with a given NodeId
sourcepub fn get_name_by_id(&self, id: u32) -> Option<&String>
pub fn get_name_by_id(&self, id: u32) -> Option<&String>
get_name_by_id
get the scientific name associated with a given NCBI Taxonomy ID