From 330d6c2da8a0dc2d57efffe690e8db2928455776 Mon Sep 17 00:00:00 2001 From: Sijie Date: Thu, 15 Aug 2024 19:58:38 -0700 Subject: [PATCH] use batch genome save in GenbankToGenome.py --- lib/GenomeFileUtil/core/GenbankToGenome.py | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/GenomeFileUtil/core/GenbankToGenome.py b/lib/GenomeFileUtil/core/GenbankToGenome.py index 3bf11b0f..606f83e3 100644 --- a/lib/GenomeFileUtil/core/GenbankToGenome.py +++ b/lib/GenomeFileUtil/core/GenbankToGenome.py @@ -202,7 +202,6 @@ def _import_genbank_mass(self, params): for genome_obj in genome_objs: shutil.rmtree(genome_obj.input_directory) - # TODO make an internal mass function save_genomes results = self._save_genomes(workspace_id, genome_objs) # return the result @@ -220,17 +219,18 @@ def _import_genbank_mass(self, params): return details def _save_genomes(self, workspace_id, genome_objs): - results = [ - self.gi.save_one_genome( - { - 'workspace_id': workspace_id, - 'name': genome_obj.genome_name, - 'data': genome_obj.genome_data, - "meta": genome_obj.genome_meta, - } - ) for genome_obj in genome_objs - ] - + results = self.gi.save_genome_mass( + { + "workspace_id": workspace_id, + "inputs": [ + { + "name": genome_obj.genome_name, + "data": genome_obj.genome_data, + "meta": genome_obj.genome_meta, + } for genome_obj in genome_objs + ], + } + ) return results def _validate_params(self, params):