From d82d6e31326a2b925039e45960d12768f5b58c03 Mon Sep 17 00:00:00 2001 From: Antonio Camargo Date: Sun, 15 Mar 2020 01:22:51 -0700 Subject: [PATCH] Version 0.2.1 --- setup.py | 2 +- taxopy/core.py | 2 +- taxopy/utilities.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index ef634e4..7243937 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( name="taxopy", - version="0.2.0", + version="0.2.1", packages=find_packages(), license="GNU General Public License v3.0", description="A Python package for obtaining complete lineages and the lowest common ancestor (LCA) from a set of taxonomic identifiers.", diff --git a/taxopy/core.py b/taxopy/core.py index 5c5d249..15afa6d 100644 --- a/taxopy/core.py +++ b/taxopy/core.py @@ -191,7 +191,7 @@ def __init__(self, taxid: str, taxdb: TaxDb): ) def __repr__(self): - return " -> ".join(reversed(self.name_lineage)) + return " > ".join(reversed(self.name_lineage)) def _find_lineage(self, taxid2parent): lineage = [] diff --git a/taxopy/utilities.py b/taxopy/utilities.py index 705a1b2..def4db2 100644 --- a/taxopy/utilities.py +++ b/taxopy/utilities.py @@ -76,15 +76,15 @@ def find_majority_vote(taxon_list: list, taxdb: TaxDb): Raises ------ MajorityVoteError - If the input list has less than three Taxon objects. + If the input list has less than two Taxon objects. """ - if len(taxon_list) < 3: + if len(taxon_list) < 2: raise MajorityVoteError( - "The input list must contain at least three Taxon objects." + "The input list must contain at least two Taxon objects." ) n_taxa = len(taxon_list) zipped_taxid_lineage = zip_longest(*[reversed(i.taxid_lineage) for i in taxon_list]) for taxonomic_level in reversed(list(zipped_taxid_lineage)): majority_taxon = Counter(taxonomic_level).most_common()[0] - if majority_taxon[1] > n_taxa / 2: + if majority_taxon[0] and majority_taxon[1] > n_taxa / 2: return Taxon(majority_taxon[0], taxdb)