taxaid API reference

class taxadb.taxid.TaxID(**kwargs)[source]

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)[source]

Initialize self. See help(type(self)) for accurate signature.

has_parent(taxid, parent)[source]

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 taxid
  • parent (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)[source]

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 taxid
  • ranks (bool) – Wether to return the the tax ranks or not. Default False
  • reverse (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)[source]

Get a lineage name for a taxonomic id

Given a taxid, return its associated lineage

Parameters:
  • taxid (int) – a taxid
  • ranks (bool) – Wether to return the tax ranks or not. Default False
  • reverse (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)[source]

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