comparison process_xlsx.py @ 3:4e9af789b2de 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:16 +0000
parents 982757f4aa8c
children 863a964fd1d6
comparison
equal deleted inserted replaced
2:982757f4aa8c 3:4e9af789b2de
207 month = "{:02d}".format(month) 207 month = "{:02d}".format(month)
208 day = "{:02d}".format(day) 208 day = "{:02d}".format(day)
209 hour = "{:02d}".format(hour) 209 hour = "{:02d}".format(hour)
210 minute = "{:02d}".format(minute) 210 minute = "{:02d}".format(minute)
211 second = "{:02d}".format(second) 211 second = "{:02d}".format(second)
212 # format it as 2008-01-23T19:23:10 212 if optional_col in ('collection date'):
213 sample[optional_col] = str(year) + '-' + str(month) + '-' + str(day) + \ 213 # collection date uses the format 2008-01-23T19:23:10
214 'T' + str(hour) + ':' + str(minute) + ':' + str(second) 214 sample[optional_col] = str(year) + '-' + str(month) + '-' + str(day) + \
215 'T' + str(hour) + ':' + str(minute) + ':' + str(second)
216 if optional_col in ('receipt date'):
217 # receipt date uses forma: 2008-01-23
218 sample[optional_col] = str(year) + '-' + str(month) + '-' + str(day)
215 # excel stores everything as float so I need to check if 219 # excel stores everything as float so I need to check if
216 # the value was actually an int and keep it as int 220 # the value was actually an int and keep it as int
217 if isinstance(sample[optional_col], float): 221 if isinstance(sample[optional_col], float):
218 if int(sample[optional_col]) == sample[optional_col]: 222 if int(sample[optional_col]) == sample[optional_col]:
219 # it is not really a float but an int 223 # it is not really a float but an int
224 for exp_alias, exp in experiments_dict.items(): 228 for exp_alias, exp in experiments_dict.items():
225 # should I check here if any experiment has a study or sample alias that is incorrect? 229 # should I check here if any experiment has a study or sample alias that is incorrect?
226 # (not listed in the samples or study dict) 230 # (not listed in the samples or study dict)
227 # process the experiments for this sample 231 # process the experiments for this sample
228 if exp['sample_alias'] == sample_alias: 232 if exp['sample_alias'] == sample_alias:
229 lib_alias = 'library_' + exp_alias + '_' + exp['sample_alias']
230 experiments_table.write('\t'.join([exp_alias, action, 'accession_ena', exp['title'], 233 experiments_table.write('\t'.join([exp_alias, action, 'accession_ena', exp['title'],
231 exp['study_alias'], sample_alias, 234 exp['study_alias'], sample_alias,
232 exp['design_description'], lib_alias, 235 exp['design_description'], exp['library_name'],
233 exp['library_strategy'], exp['library_source'], 236 exp['library_strategy'], exp['library_source'],
234 exp['library_selection'], 237 exp['library_selection'],
235 exp['library_layout'].lower(), 238 exp['library_layout'].lower(),
236 str(int(exp['insert_size'])), 239 str(int(exp['insert_size'])),
237 exp['library_construction_protocol'], 240 exp['library_construction_protocol'],