aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndreaGuarracino2020-11-13 22:29:10 +0100
committerAndreaGuarracino2020-11-13 22:29:10 +0100
commitcb94ded3ea7d28a81ab41fc88ffd291bc0f8c079 (patch)
tree33acc7034944498f462db3ede353a6b30b0ca2b3 /scripts
parenta5f5a85b9db5e84f3680e85b7116f324fd6d2e2e (diff)
downloadbh20-seq-resource-cb94ded3ea7d28a81ab41fc88ffd291bc0f8c079.tar.gz
bh20-seq-resource-cb94ded3ea7d28a81ab41fc88ffd291bc0f8c079.tar.lz
bh20-seq-resource-cb94ded3ea7d28a81ab41fc88ffd291bc0f8c079.zip
generation of dates a little more robust
Diffstat (limited to 'scripts')
-rw-r--r--scripts/create_sra_metadata/create_sra_metadata.py2
-rwxr-xr-xscripts/download_genbank_data/from_genbank_to_fasta_and_yaml.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/scripts/create_sra_metadata/create_sra_metadata.py b/scripts/create_sra_metadata/create_sra_metadata.py
index 77cdf0d..85d4e9e 100644
--- a/scripts/create_sra_metadata/create_sra_metadata.py
+++ b/scripts/create_sra_metadata/create_sra_metadata.py
@@ -200,7 +200,7 @@ for i, EXPERIMENT_PACKAGE in enumerate(EXPERIMENT_PACKAGE_SET):
if VALUE_text_list[1].isalpha():
date_to_write = parse(VALUE_text).strftime('%Y-%m-%d')
elif len(VALUE_text_list) == 2:
- date_to_write = VALUE_text + '-15'
+ date_to_write = parse(VALUE_text).strftime('%Y-%m') + '-15'
else:
if int(VALUE_text) < 2020:
date_to_write = "{}-12-15".format(VALUE_text)
diff --git a/scripts/download_genbank_data/from_genbank_to_fasta_and_yaml.py b/scripts/download_genbank_data/from_genbank_to_fasta_and_yaml.py
index 8fbacd1..1352027 100755
--- a/scripts/download_genbank_data/from_genbank_to_fasta_and_yaml.py
+++ b/scripts/download_genbank_data/from_genbank_to_fasta_and_yaml.py
@@ -358,7 +358,7 @@ for path_metadata_xxx_xml in [os.path.join(dir_metadata, name_metadata_xxx_xml)
else:
info_for_yaml_dict['sample']['additional_collection_information'] = "The 'collection_date' is estimated (the original date was: {})".format(GBQualifier_value_text)
elif len(GBQualifier_value_text.split('-')) == 2:
- date_to_write += '-15'
+ date_to_write = parse(GBQualifier_value_text).strftime('%Y-%m') + '-15'
if 'additional_collection_information' in info_for_yaml_dict['sample']:
info_for_yaml_dict['sample']['additional_collection_information'] += "; The 'collection_date' is estimated (the original date was: {})".format(GBQualifier_value_text)