From 9f31ac441e69d4e07bf93235cfa0459a077fb00c Mon Sep 17 00:00:00 2001 From: AndreaGuarracino Date: Sat, 6 Jun 2020 16:12:44 +0200 Subject: fixed collection-date management using a parser --- scripts/from_genbank_to_fasta_and_yaml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/from_genbank_to_fasta_and_yaml.py b/scripts/from_genbank_to_fasta_and_yaml.py index fc09615..9c8e9b9 100755 --- a/scripts/from_genbank_to_fasta_and_yaml.py +++ b/scripts/from_genbank_to_fasta_and_yaml.py @@ -8,8 +8,8 @@ import json import os import requests -from dateutil import parser from datetime import date +from dateutil.parser import parse num_ids_for_request = 100 @@ -312,7 +312,7 @@ for path_metadata_xxx_xml in [os.path.join(dir_metadata, name_metadata_xxx_xml) GBQualifier_value_text_list = GBQualifier_value_text.split('-') if GBQualifier_value_text_list[1].isalpha(): - date_to_write = GBQualifier_value_text_list[1] + '-' + GBQualifier_value_text_list[0] + '-' + GBQualifier_value_text_list[2] + date_to_write = parse(GBQualifier_value_text).strftime('%Y-%m-%d') info_for_yaml_dict['sample']['collection_date'] = date_to_write elif GBQualifier_name_text in ['lat_lon', 'country']: -- cgit v1.2.3