Commit 81641e78 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

remove useless code

parent 907a5126
......@@ -94,29 +94,6 @@ class ImportNCBITaxonomy(object):
logger.info("[DONE] %s/%s Taxonomy updated.", self.updated_tax, self.total_tax)
logger.info("[DONE] %s/%s Taxonomy skipped.", self.skipped_tax, self.total_tax)
def build_all_hierarchy(self, chunk_size=1000):
"""
The hierarchy is automatically built when retrieving an taxonomy entry so we get all of them
"""
logger.info(f"Building hierarchy for all entries in %s...", self.tax_nodes_file)
with open(self.tax_nodes_file, "r") as f:
while True:
next_nodes = list(islice(f, chunk_size))
if not next_nodes:
break
nodes = [NCBITaxonomyLineParser.node(i) for i in next_nodes]
for node in nodes:
try:
response = self.metagenedb_tax_api.get(node.get('tax_id')) # noqa
self.updated_tax += 1
except HTTPError as http_error:
logger.warning(http_error)
self.skipped_tax += 1
self.processed_tax += len(nodes)
logger.info("%s/%s Taxonomy processed so far...", self.processed_tax, self.total_tax)
logger.info("[DONE] %s/%s Hierarchy built.", self.updated_tax, self.total_tax)
logger.info("[DONE] %s/%s Taxonomy skipped.", self.skipped_tax, self.total_tax)
def parse_arguments():
"""
......@@ -127,7 +104,6 @@ def parse_arguments():
parser.add_argument('--nodes', help='nodes.dmp file from ncbi_taxonomy', required=True)
parser.add_argument('--names', help='names.dmp file from ncbi_taxonomy', required=True)
parser.add_argument('--skip_creation', action='store_true', help='Skip taxonomy creation.')
parser.add_argument('--skip_hierarchy', action='store_true', help='Skip taxonomy hierarchy built.')
parser.add_argument('--url', help='base URL of the instance.', default='http://localhost/')
parser.add_argument('-v', '--verbose', action='store_true')
......@@ -146,8 +122,6 @@ def run():
if not args.skip_creation:
import_ncbi_tax.create_taxo_nodes(taxonomy_names)
import_ncbi_tax.update_taxo_nodes()
if not args.skip_hierarchy:
import_ncbi_tax.build_all_hierarchy()
if __name__ == "__main__":
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment