diff options
author | AndreaGuarracino | 2020-06-06 16:12:44 +0200 |
---|---|---|
committer | AndreaGuarracino | 2020-06-06 16:12:44 +0200 |
commit | 9f31ac441e69d4e07bf93235cfa0459a077fb00c (patch) | |
tree | aa6631b9754690f56064e6ca4ec370c4d12d5681 /scripts/from_genbank_to_fasta_and_yaml.py | |
parent | 278b1e7ccbc8b56e6e9b3413840b18f3ce0f36e7 (diff) | |
download | bh20-seq-resource-9f31ac441e69d4e07bf93235cfa0459a077fb00c.tar.gz bh20-seq-resource-9f31ac441e69d4e07bf93235cfa0459a077fb00c.tar.lz bh20-seq-resource-9f31ac441e69d4e07bf93235cfa0459a077fb00c.zip |
fixed collection-date management using a parser
Diffstat (limited to 'scripts/from_genbank_to_fasta_and_yaml.py')
-rwxr-xr-x | scripts/from_genbank_to_fasta_and_yaml.py | 4 |
1 files 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']: |