Mercurial > repos > iuc > ena_upload
diff extract_tables.py @ 1:57251c760cab draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
author | iuc |
---|---|
date | Fri, 30 Apr 2021 12:09:25 +0000 |
parents | 382518f24d6d |
children | 6f6537780379 |
line wrap: on
line diff
--- a/extract_tables.py Sat Nov 28 09:45:44 2020 +0000 +++ b/extract_tables.py Fri Apr 30 12:09:25 2021 +0000 @@ -3,6 +3,11 @@ import pathlib from datetime import datetime +""" +Parse the configfile generated by the Galaxy tool. +This file is JSON-formatted and should be converted to a set of tabular files. +""" + FILE_FORMAT = 'fastq' parser = argparse.ArgumentParser() @@ -78,11 +83,15 @@ 'submission_date_ENA']) + '\n') run_index = 0 # exp['runs'] is a list of lists - for run in exp['runs']: + for (base_run, run_files) in exp['runs']: run_index += 1 - run_alias = '.'.join(['run_' + str(run_index), str(exp_index), str(sample_index)]) \ - + '_' + timestamp - for file_entry in run: + if base_run != '': + run_alias = base_run + else: + # no alias provided, generated a unique one + run_alias = '_'.join(['run_' + str(run_index), str(exp_index), + str(sample_index)]) + '_' + timestamp + for file_entry in run_files: runs_table.write('\t'.join([run_alias, action, 'ena_run_accession', exp_alias, file_entry, FILE_FORMAT, 'file_checksum', 'submission_date_ENA']) + '\n')