Struct fastax::db::DB

source ·
pub struct DB { /* private fields */ }
Expand description

The local taxonony database

Implementations§

source§

impl DB

source

pub fn new(dbpath: &PathBuf) -> Result<Self, Box<dyn Error>>

Open a database.

source

pub fn populate(&self, dump: &PathBuf) -> Result<(), Box<dyn Error>>

Populate the local taxonony database using that dump.

dump is expected to be the path to an accessible copy of the taxdmp.zip file, as the one available on the NCBI FTP servers.

source

pub fn get_taxids(&self, names: Vec<String>) -> Result<Vec<i64>, Box<dyn Error>>

Get the Taxonomy IDs corresponding to this scientific names. The used name class are “scientific name”, “synonym” and “genbank synonym”. Either return all the IDs or an error.

source

pub fn get_nodes(&self, ids: Vec<i64>) -> Result<Vec<Node>, Box<dyn Error>>

Get the Nodes corresponding to the IDs. The Nodes are ordered in the same way as the IDs. If an ID is invalid, an error is returned.

source

pub fn get_lineage(&self, id: i64) -> Result<Vec<Node>, Box<dyn Error>>

Get the Node corresponding to this unique ID, then all Nodes in the path to the root (the special node with taxonomy ID 1). The Nodes are ordered, with the root last.

source

pub fn get_children( &self, id: i64, species_only: bool ) -> Result<Vec<Node>, Box<dyn Error>>

Get the children of the Node corresponding to this unique ID. If species_only is true, then stop when the children are species, else continue until the children are tips. Note that the ID given as argument is included in the results. Thus, the resulting vector contains at least one element.

Auto Trait Implementations§

§

impl !RefUnwindSafe for DB

§

impl Send for DB

§

impl !Sync for DB

§

impl Unpin for DB

§

impl !UnwindSafe for DB

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.