Improve support for the "clade" rank
As detailed in https://github.com/apcamargo/taxopy/issues/14, the "clade" rank is problematic for `taxopy` because multiple taxa in a lineage can be assigned to this rank. This affects `rank_name_dictionary`, `rank_taxid_dictionary`, and `__repr__`.
```py
taxon = taxopy.Taxon(33213, taxdb)
print(taxon.name)
print(taxon.rank_name_dictionary)
print(taxon.rank_taxid_dictionary)
print(taxon)
```
Bilateria
OrderedDict({'clade': 'Opisthokonta', 'kingdom': 'Metazoa', 'superkingdom': 'Eukaryota'})
OrderedDict({'clade': 33154, 'kingdom': 33208, 'superkingdom': 2759})
s__Eukaryota;k__Metazoa;c__Opisthokonta
In the example above, "_Bilateria_" doesn't appear in the name and taxid dictionaries nor in its `__repr__`. This is because "_Bilateria_" is the third taxon assigned to the "clade" rank in its lineage:
```py
print(taxon.ranked_name_lineage)
```
[('clade', 'Bilateria'), ('clade', 'Eumetazoa'), ('kingdom', 'Metazoa'), ('clade', 'Opisthokonta'), ('superkingdom', 'Eukaryota'), ('no rank', 'cellular organisms'), ('no rank', 'root')]
0 条评论