taxonomy
Module for searching taxon information from UniProt.
SearchField = Literal['tax_id', 'scientific', 'common', 'parent']
module-attribute
Type of search field
search_fields = set(get_args(SearchField)) | {None}
module-attribute
Set of valid search fields
Taxon
dataclass
Dataclass representing a taxon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
taxon_id
|
str
|
The unique identifier for the taxon. |
required |
scientific_name
|
str
|
The scientific name of the taxon. |
required |
rank
|
str
|
The taxonomic rank of the taxon (e.g., species, genus). |
required |
common_name
|
str | None
|
The common name of the taxon (if available). |
None
|
other_names
|
set[str] | None
|
A set of other names for the taxon (if available). |
None
|
search_taxon(query, field=None, limit=100)
async
Search for taxon information in UniProt.
Uses https://www.uniprot.org/taxonomy?query=*.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Search query for the taxon. |
required |
field
|
SearchField | None
|
Field to search in. If None, searches in all fields. If "tax_id" then searches by taxon ID. If "parent" then given a parent taxon ID returns all its children. For example, if the parent taxon ID is 9606 (Human), it will return Neanderthal and Denisovan. |
None
|
limit
|
int
|
Maximum number of results to return. |
100
|
Returns:
Type | Description |
---|---|
list[Taxon]
|
List of Taxon objects matching the search query. |
Raises:
Type | Description |
---|---|
ValueError
|
If the search field is invalid. |