Skip to content

Commit

Permalink
docs: Update taxid_from_name example
Browse files Browse the repository at this point in the history
  • Loading branch information
apcamargo committed Aug 9, 2024
1 parent 3e7daa6 commit e04e8d6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,21 @@ Some taxa may share the same name, which are known as homonyms. In such cases, t
```pycon
>>> print(taxopy.taxid_from_name("Aotus", taxdb))
[9504, 114498]
>>> print(taxopy.taxid_from_name(["Homininae", "Homo sapiens", "Aotus"], taxdb))
[[207598], [9606], [9504, 114498]]
>>> for ti in taxopy.taxid_from_name(
... ["Homininae", "Homo sapiens", "Aotus"], taxdb
... ):
... print(f"{ti}:")
... for t in ti:
... taxon = taxopy.Taxon(t, taxdb)
... parent_taxon = taxon.parent(taxdb)
... print(f"{taxon.name} (TaxId: {t}, parent: {parent_taxon.name})")
[207598]:
Homininae (TaxId: 207598, parent: Hominidae)
[9606]:
Homo sapiens (TaxId: 9606, parent: Homo)
[9504, 114498]:
Aotus (TaxId: 9504, parent: Aotidae)
Aotus (TaxId: 114498, parent: Mirbelieae)
```

### Retrieval of taxa with nearly matching names though fuzzy search
Expand Down

0 comments on commit e04e8d6

Please sign in to comment.