Mercurial > repos > iuc > ena_upload
annotate extract_tables.py @ 8:d147d6455873 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit bfc2dbccaec2ebeaf235ac833edbcead2758d792"
author | iuc |
---|---|
date | Wed, 04 May 2022 17:06:42 +0000 |
parents | 6f6537780379 |
children | a62c4a11a67d |
rev | line source |
---|---|
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
1 import argparse |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
2 import json |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
3 import pathlib |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
4 from datetime import datetime |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
5 |
1
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
6 """ |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
7 Parse the configfile generated by the Galaxy tool. |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
8 This file is JSON-formatted and should be converted to a set of tabular files. |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
9 """ |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
10 |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
11 FILE_FORMAT = 'fastq' |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
12 |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
13 parser = argparse.ArgumentParser() |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
14 parser.add_argument('--studies', dest='studies_json_path', required=True) |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
15 parser.add_argument('--out_dir', dest='out_path', required=True) |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
16 parser.add_argument('--action', dest='action', required=True) |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
17 args = parser.parse_args() |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
18 |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
19 with open(args.studies_json_path, 'r') as studies_json_file: |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
20 studies_dict = json.load(studies_json_file) |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
21 studies_table = open(pathlib.Path(args.out_path) / 'studies.tsv', 'w') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
22 studies_table.write('\t'.join(['alias', 'status', 'accession', 'title', 'study_type', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
23 'study_abstract', 'pubmed_id', 'submission_date']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
24 samples_table = open(pathlib.Path(args.out_path) / 'samples.tsv', 'w') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
25 experiments_table = open(pathlib.Path(args.out_path) / 'experiments.tsv', 'w') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
26 experiments_table.write('\t'.join(['alias', 'status', 'accession', 'title', 'study_alias', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
27 'sample_alias', 'design_description', 'library_name', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
28 'library_strategy', 'library_source', 'library_selection', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
29 'library_layout', 'insert_size', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
30 'library_construction_protocol', 'platform', 'instrument_model', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
31 'submission_date']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
32 runs_table = open(pathlib.Path(args.out_path) / 'runs.tsv', 'w') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
33 runs_table.write('\t'.join(['alias', 'status', 'accession', 'experiment_alias', 'file_name', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
34 'file_format', 'file_checksum', 'submission_date']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
35 |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
36 action = args.action |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
37 |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
38 dt_oobj = datetime.now(tz=None) |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
39 timestamp = dt_oobj.strftime("%Y%m%d_%H:%M:%S") |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
40 for study_index, study in enumerate(studies_dict): |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
41 study_alias = 'study_' + str(study_index) + '_' + timestamp |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
42 studies_table.write('\t'.join([study_alias, action, 'ENA_accession', study['title'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
43 study['type'], study['abstract'], study['pubmed_id'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
44 'ENA_submission_data'])) |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
45 if "geo_location" in study['samples'][0].keys(): # sample belongs to a viral sample |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
46 samples_table.write('\t'.join(['alias', 'status', 'accession', 'title', 'scientific_name', |
7
6f6537780379
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 9961f24acebb17f837238df6541e1af59df1163b"
iuc
parents:
1
diff
changeset
|
47 'taxon_id', 'sample_description', 'collection date', |
6f6537780379
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 9961f24acebb17f837238df6541e1af59df1163b"
iuc
parents:
1
diff
changeset
|
48 'geographic location (country and/or sea)', 'host common name', 'host subject id', |
6f6537780379
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 9961f24acebb17f837238df6541e1af59df1163b"
iuc
parents:
1
diff
changeset
|
49 'host health state', 'host sex', 'host scientific name', |
6f6537780379
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 9961f24acebb17f837238df6541e1af59df1163b"
iuc
parents:
1
diff
changeset
|
50 'collector name', 'collecting institution', 'isolate', |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
51 'submission_date']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
52 else: |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
53 samples_table.write('\t'.join(['alias', 'status', 'accession', 'title', 'scientific_name', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
54 'taxon_id', 'sample_description', 'submission_date']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
55 for sample_index, sample in enumerate(study['samples']): |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
56 sample_alias = 'sample_' + str(sample_index) + '_' + timestamp |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
57 if "geo_location" in sample.keys(): # sample belongs to a viral sample |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
58 if sample['collector_name'] == '': |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
59 sample['collector_name'] = 'unknown' |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
60 samples_table.write('\t'.join([sample_alias, action, 'ena_accession', sample['title'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
61 sample['tax_name'], sample['tax_id'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
62 sample['description'], sample['collection_date'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
63 sample['geo_location'], sample['host_common_name'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
64 sample['host_subject_id'], sample['host_health_state'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
65 sample['host_sex'], sample['host_scientific_name'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
66 sample['collector_name'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
67 sample['collecting_institution'], sample['isolate'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
68 'ENA_submission_date']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
69 else: |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
70 samples_table.write('\t'.join([sample_alias, action, 'ena_accession', sample['title'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
71 sample['tax_name'], sample['tax_id'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
72 sample['description'], 'ENA_submission_date']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
73 for exp_index, exp in enumerate(sample['experiments']): |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
74 exp_alias = 'experiment_' + str(exp_index) + '.' + str(sample_index) + '_' + timestamp |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
75 lib_alias = 'library_' + str(exp_index) + '_' + str(sample_index) |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
76 experiments_table.write('\t'.join([exp_alias, action, 'accession_ena', exp['title'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
77 study_alias, sample_alias, exp['experiment_design'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
78 lib_alias, exp['library_strategy'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
79 exp['library_source'], exp['library_selection'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
80 exp['library_layout'].lower(), exp['insert_size'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
81 exp['library_construction_protocol'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
82 exp['platform'], exp['instrument_model'], |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
83 'submission_date_ENA']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
84 run_index = 0 |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
85 # exp['runs'] is a list of lists |
1
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
86 for (base_run, run_files) in exp['runs']: |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
87 run_index += 1 |
1
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
88 if base_run != '': |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
89 run_alias = base_run |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
90 else: |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
91 # no alias provided, generated a unique one |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
92 run_alias = '_'.join(['run_' + str(run_index), str(exp_index), |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
93 str(sample_index)]) + '_' + timestamp |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
94 for file_entry in run_files: |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
95 runs_table.write('\t'.join([run_alias, action, 'ena_run_accession', exp_alias, |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
96 file_entry, FILE_FORMAT, 'file_checksum', |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
97 'submission_date_ENA']) + '\n') |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
98 |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
99 studies_table.close() |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
100 samples_table.close() |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
101 experiments_table.close() |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
102 runs_table.close() |