taxaid API reference
- class taxadb2.taxid.TaxID(**kwargs)
Main class for querying taxid
Provide methods to request taxa table and get associated accession ids.
- Parameters:
**kwargs – Arbitrary arguments. Supported (username, password, port, hostname, config, dbtype, dbname)
- Raises:
SystemExit – If table taxa does not exist
- __init__(**kwargs)
- has_parent(taxid, parent)
Check if a taxid has a parent in its lineage
- Given a taxid and a parent in the form of a taxid or a scientific name,
return True if the taxid contains the parent in its lineage
- Parameters:
taxid (
int) – a taxidparent (
int|str) – taxid or scientific name
- Returns:
- True if the taxid contains the parent in its lineage, False
otherwise. None if taxid not found
- Return type:
bool
- lineage_id(taxid, ranks=False, reverse=False)
Get lineage for a taxonomic id
- Given a taxid, return its associated lineage (in the form of a list of
taxids, each parents of each others)
- Parameters:
taxid (
int) – a taxidranks (
bool) – Wether to return the the tax ranks or not. Default Falsereverse (
bool) – Inverted lineage, from top to bottom taxonomy hierarchy. Default False
- Returns:
- lineage_list, associated lineage id with taxid or None if
taxid not found
- Return type:
list
- lineage_name(taxid, ranks=False, reverse=False)
Get a lineage name for a taxonomic id
Given a taxid, return its associated lineage
- Parameters:
taxid (
int) – a taxidranks (
bool) – Wether to return the tax ranks or not. Default Falsereverse (
bool) – Inverted lineage, from top to bottom taxonomy hierarchy. Default False
- Returns:
- lineage_name, associated lineage name with taxid or None if
taxid not found
- Return type:
list
- sci_name(taxid)
Get taxonomic scientific name for taxonomy id
Given a taxid, return its associated scientific name
- Parameters:
taxid (
int) – a taxid- Returns:
name, scientific name or None if taxid not found
- Return type:
str