Mercurial > repos > iuc > ena_upload
annotate extract_tables.py @ 11:f803a68fc9e5 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit c7f54e6e3b1ffad5631ff7c150449cb79bd3686d
author | iuc |
---|---|
date | Sat, 23 Mar 2024 22:06:45 +0000 |
parents | 480d9e9d156b |
children |
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') |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
22 studies_table.write('\t'.join(['alias', 'status', 'title', 'study_type', |
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
23 'study_abstract', 'pubmed_id']) + '\n') |
0
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') |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
26 experiments_table.write('\t'.join(['alias', 'status', 'title', 'study_alias', |
0
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', |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
31 ]) + '\n') |
0
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') |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
33 runs_table.write('\t'.join(['alias', 'status', 'experiment_alias', 'file_name', |
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
34 'file_format']) + '\n') |
0
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 |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
42 studies_table.write('\t'.join([study_alias, action, study['title'], |
10
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
43 study['type'], study['abstract'], study['pubmed_id']])) |
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
44 if "host_subject_id" in study['samples'][0].keys(): # sample belongs to a viral sample |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
45 samples_table.write('\t'.join(['alias', 'status', '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
|
46 '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
|
47 '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
|
48 'host health state', 'host sex', 'host scientific name', |
10
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
49 'collector name', 'collecting institution', 'isolate']) + '\n') |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
50 else: |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
51 samples_table.write('\t'.join(['alias', 'status', 'title', 'scientific_name', |
10
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
52 'taxon_id', 'sample_description', 'collection date', |
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
53 'geographic location (country and/or sea)']) + '\n') |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
54 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
|
55 sample_alias = 'sample_' + str(sample_index) + '_' + timestamp |
10
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
56 if "host_subject_id" in sample.keys(): # sample belongs to a viral sample |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
57 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
|
58 sample['collector_name'] = 'unknown' |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
59 samples_table.write('\t'.join([sample_alias, action, sample['title'], |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 sample['collector_name'], |
10
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
66 sample['collecting_institution'], sample['isolate'] |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
67 ]) + '\n') |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
68 else: |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
69 samples_table.write('\t'.join([sample_alias, action, sample['title'], |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
70 sample['tax_name'], sample['tax_id'], |
10
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
71 sample['description'], sample['collection_date'], |
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
72 sample['geo_location']]) + '\n') |
0
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) |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
76 experiments_table.write('\t'.join([exp_alias, action, exp['title'], |
0
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'], |
10
480d9e9d156b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit dccd4c0668ec8ce1b1c8fd9cef4dcf3a99dc78b3
iuc
parents:
9
diff
changeset
|
82 exp['platform'], exp['instrument_model']]) + '\n') |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
83 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
|
84 # 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 else: |
57251c760cab
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit ffea061c1ad6e7291abfe220230dbdbe8d19a2bd"
iuc
parents:
0
diff
changeset
|
90 # 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
|
91 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
|
92 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
|
93 for file_entry in run_files: |
9
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
94 runs_table.write('\t'.join([run_alias, action, exp_alias, |
a62c4a11a67d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 6770d277b4136b4068293c4260022d4ae33b2379
iuc
parents:
7
diff
changeset
|
95 file_entry, FILE_FORMAT]) + '\n') |
0
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
96 |
382518f24d6d
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload commit 57b434bcf493554d060a99b65e66f274d5c00e0a"
iuc
parents:
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 runs_table.close() |