Skip to content

Improve support for the "clade" rank #17

@apcamargo

Description

@apcamargo

As detailed in #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__.

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:

print(taxon.ranked_name_lineage)
[('clade', 'Bilateria'), ('clade', 'Eumetazoa'), ('kingdom', 'Metazoa'), ('clade', 'Opisthokonta'), ('superkingdom', 'Eukaryota'), ('no rank', 'cellular organisms'), ('no rank', 'root')]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions