From 22eb95497ad83a725963b2d14c5721cefe64f860 Mon Sep 17 00:00:00 2001 From: Wei Shen Date: Wed, 5 Feb 2020 19:34:52 +0800 Subject: [PATCH] accelerate rank query --- gtdb_to_taxdump.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gtdb_to_taxdump.py b/gtdb_to_taxdump.py index b8cae34..6d11029 100755 --- a/gtdb_to_taxdump.py +++ b/gtdb_to_taxdump.py @@ -125,10 +125,7 @@ def __str__(self): def get_rank(self, vertex): """ Getting rank based on GTDB prefixes """ - for r in self.__ranks: - if vertex.startswith(r): - return self.__ranks[r] - return 'subspecies' + return self.__ranks.get(vertex[0:3], 'subspecies') def iter_graph(self, vertex): """ General iteration of all nodes in the graph """