From f3861384a04912e3a7a2c718181585cb8f0aefc8 Mon Sep 17 00:00:00 2001 From: Roberto Vera Alvarez Date: Wed, 2 Nov 2022 15:03:57 -0400 Subject: [PATCH] Fixing bug when parsing new dataset schema --- src/gtax/gtax_main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gtax/gtax_main.py b/src/gtax/gtax_main.py index 5e9e98e..eb8d8f1 100644 --- a/src/gtax/gtax_main.py +++ b/src/gtax/gtax_main.py @@ -42,7 +42,7 @@ def filter_metadata_zip(): '{}/ncbi_dataset/data/assembly_data_report.jsonl'.format(db), 'w') as fjson_out: for line in fjson.readlines(): d = json.loads(line.decode("utf-8")) - v = assemblies_tmp.setdefault(d['taxId'], []) + v = assemblies_tmp.setdefault(d['organism']['taxId'], []) v.append(d) for s in assemblies_tmp.keys(): rep_genome = [] @@ -50,10 +50,10 @@ def filter_metadata_zip(): if 'refseqCategory' in e['assemblyInfo']: rep_genome.append(e) if len(rep_genome) == 1: - assemblies.append(rep_genome[0]['assemblyInfo']['assemblyAccession']) + assemblies.append(rep_genome[0]['accession']) fjson_out.write('{}\n'.format(json.dumps(rep_genome[0]))) else: - assemblies.append(assemblies_tmp[s][0]['assemblyInfo']['assemblyAccession']) + assemblies.append(assemblies_tmp[s][0]['accession']) fjson_out.write('{}\n'.format(json.dumps(assemblies_tmp[s][0]))) print('There are {} assemblies included'.format(len(assemblies)))