diff process_xlsx.py @ 3:59bb6d34fca6 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 28d2a0cfcbb04d88b6e19a7d898a2bada3bce149"
author iuc
date Wed, 18 Aug 2021 19:42:49 +0000
parents 9e2df763086c
children 26ccb678abc8
line wrap: on
line diff
--- a/process_xlsx.py	Thu Jul 15 20:12:34 2021 +0000
+++ b/process_xlsx.py	Wed Aug 18 19:42:49 2021 +0000
@@ -209,9 +209,13 @@
                         hour = "{:02d}".format(hour)
                         minute = "{:02d}".format(minute)
                         second = "{:02d}".format(second)
-                        # format it as 2008-01-23T19:23:10
-                        sample[optional_col] = str(year) + '-' + str(month) + '-' + str(day) + \
-                            'T' + str(hour) + ':' + str(minute) + ':' + str(second)
+                        if optional_col in ('collection date'):
+                            # collection date uses the format 2008-01-23T19:23:10
+                            sample[optional_col] = str(year) + '-' + str(month) + '-' + str(day) + \
+                                'T' + str(hour) + ':' + str(minute) + ':' + str(second)
+                        if optional_col in ('receipt date'):
+                            # receipt date uses forma: 2008-01-23
+                            sample[optional_col] = str(year) + '-' + str(month) + '-' + str(day)
                 # excel stores everything as float so I need to check if
                 # the value was actually an int and keep it as int
                 if isinstance(sample[optional_col], float):
@@ -226,10 +230,9 @@
         # (not listed in the samples or study dict)
         # process the experiments for this sample
         if exp['sample_alias'] == sample_alias:
-            lib_alias = 'library_' + exp_alias + '_' + exp['sample_alias']
             experiments_table.write('\t'.join([exp_alias, action, 'accession_ena', exp['title'],
                                                exp['study_alias'], sample_alias,
-                                               exp['design_description'], lib_alias,
+                                               exp['design_description'], exp['library_name'],
                                                exp['library_strategy'], exp['library_source'],
                                                exp['library_selection'],
                                                exp['library_layout'].lower(),