# HG changeset patch # User ieguinoa # Date 1645453373 0 # Node ID 2f7a70c0d3abd0b3b5c4b511f2ef626e11ef6f31 # Parent 9681a9180730a2bf9e5631526c31b9ee7ea1cdbf Uploaded diff -r 9681a9180730 -r 2f7a70c0d3ab .shed.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.shed.yml Mon Feb 21 14:22:53 2022 +0000 @@ -0,0 +1,12 @@ +categories: + - Data Export +description: | + Submits experimental data and respective metadata to the European Nucleotide Archive (ENA). +long_description: | + The program submits experimental data and respective metadata to the European Nucleotide Archive (ENA). + The metadata should be provided in separate tables corresponding to ENA objects STUDY, SAMPLE, EXPERIMENT and RUN +name: ena_upload +owner: iuc +remote_repository_url: https://github.com/galaxyproject/tools-iuc/tree/master/tools/ena_upload +homepage_url: https://github.com/usegalaxy-eu/ena-upload-cli +type: unrestricted diff -r 9681a9180730 -r 2f7a70c0d3ab dump_yaml.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dump_yaml.py Mon Feb 21 14:22:53 2022 +0000 @@ -0,0 +1,37 @@ +import sys +import yaml + +def fetch_table_data(table_path): + data_dict = {} + with open(table_path) as table_to_load: + # load headers + headers = table_to_load.readline().strip('\n').split('\t') + row_id = 0 + for line in table_to_load.readlines(): + # print(line) + line_data = line.strip('\n').split('\t') + row_dict = {} + for col_num in range(len(headers)): + col_name = headers[col_num] + row_dict[col_name] = line_data[col_num] + data_dict[row_id] = row_dict + row_id += 1 + return data_dict + +all_data_dict = {} +print('YAML -------------') +studies_table_path = sys.argv[1] +table_data = fetch_table_data(studies_table_path) +all_data_dict['ENA_study'] = table_data +samples_table_path = sys.argv[2] +table_data = fetch_table_data(samples_table_path) +all_data_dict['ENA_sample'] = table_data +experiments_table_path = sys.argv[3] +table_data = fetch_table_data(experiments_table_path) +all_data_dict['ENA_experiment'] = table_data +runs_table_path = sys.argv[4] +table_data = fetch_table_data(runs_table_path) +all_data_dict['ENA_run'] = table_data +# print(all_data_dict) +print(yaml.dump(all_data_dict)) +print('YAML -------------') diff -r 9681a9180730 -r 2f7a70c0d3ab ena_upload.xml --- a/ena_upload.xml Wed Feb 02 17:30:12 2022 +0000 +++ b/ena_upload.xml Mon Feb 21 14:22:53 2022 +0000 @@ -26,6 +26,10 @@ #if $action_options.input_format_conditional.input_format == "build_tables": python '$__tool_directory__/extract_tables.py' --action $action_options.action --out_dir ./submission_files --studies $studies_json; #end if + +credentials_path='test_fake_path'; +echo "username: test_user" > \$credentials_path; +echo "password: test_password" >> \$credentials_path; #if $action_options.input_format_conditional.input_format == "build_tables": @@ -65,13 +69,6 @@ fi; #end if -#if $action_options.test_submit == "True" or $action_options.test_submit_parameters.dry_run == "true": - credentials_path='test_fake_path'; - #if $action_options.test_submit_parameters.dry_run == "true" and $action_options.input_format_conditional.input_format == "excel_tables": - echo "username: test_user" > \$credentials_path; - echo "password: test_password" >> \$credentials_path; - #end if -#end if ## create the list of files to upload and make the symlinks #import re @@ -173,8 +170,6 @@ #end if #end if - -#if $action_options.test_submit_parameters.dry_run == "false" or $action_options.input_format_conditional.input_format == "excel_tables": #if $action_options.action == "add": ena-upload-cli --tool 'ena-upload-cli v@VERSION@ @ Galaxy' @@ -215,6 +210,8 @@ >> '$output'; #end if + + #if $action_options.action == "modify": ena-upload-cli --tool 'ena-upload-cli v@VERSION@ @ Galaxy' @@ -251,27 +248,28 @@ #end if >> '$output'; #end if - #if $action_options.test_submit_parameters.dry_run == "false": - echo -e 'center_name\t$action_options.center' >> '$output'; - echo -e 'action_option\t$action_options.action' >> '$output'; - #if $action_options.input_format_conditional.input_format == "build_tables": - cp $studies_table_path_updated $studies_table_out 2>/dev/null; - cp $samples_table_path_updated $samples_table_out 2>/dev/null; - cp $experiments_table_path_updated $experiments_table_out 2>/dev/null; - cp $runs_table_path_updated $runs_table_out 2>/dev/null; - #end if - #else - ## for the excel input case, copy the upload-cli generated tables to the output files - ## this applies for both draft and real submissions - cp './ENA_template_experiment_updated.tsv' $experiments_table_out; - cp './ENA_template_sample_updated.tsv' $samples_table_out; - cp './ENA_template_study_updated.tsv' $studies_table_out; - cp './ENA_template_run_updated.tsv' $runs_table_out; - #end if -#else: - exit 0; + +#if $action_options.test_submit_parameters.dry_run == "false": + echo -e 'center_name\t$action_options.center' >> '$output'; + echo -e 'action_option\t$action_options.action' >> '$output'; +#end if + +## copy updated files +#if $action_options.input_format_conditional.input_format == "excel_tables": + ## for the excel input case, copy the upload-cli generated tables to the output files + ## this applies for both draft and real submissions + cp './ENA_template_experiment_updated.tsv' $experiments_table_out; + cp './ENA_template_sample_updated.tsv' $samples_table_out; + cp './ENA_template_study_updated.tsv' $studies_table_out; + cp './ENA_template_run_updated.tsv' $runs_table_out; +#else + cp $studies_table_path_updated $studies_table_out 2>/dev/null; + cp $samples_table_path_updated $samples_table_out 2>/dev/null; + cp $experiments_table_path_updated $experiments_table_out 2>/dev/null; + cp $runs_table_path_updated $runs_table_out 2>/dev/null; #end if +python '$__tool_directory__/dump_yaml.py' $studies_table_out $samples_table_out $experiments_table_out $runs_table_out >> $output; ]]> + + + + + + + + + @@ -549,7 +556,7 @@ - + @@ -561,7 +568,7 @@ - + @@ -574,7 +581,7 @@ - + @@ -632,7 +639,7 @@ - + @@ -660,16 +667,16 @@ - +
- +
- + @@ -682,7 +689,7 @@ - + @@ -696,7 +703,7 @@ - + @@ -707,25 +714,22 @@ - + - - -
- +
- +
- + @@ -738,7 +742,7 @@ - + @@ -777,21 +781,18 @@ - - -
- +
- +
- + @@ -804,7 +805,7 @@ - + @@ -828,7 +829,7 @@ - + @@ -839,21 +840,17 @@ - + - - -
diff -r 9681a9180730 -r 2f7a70c0d3ab extract_tables.py --- a/extract_tables.py Wed Feb 02 17:30:12 2022 +0000 +++ b/extract_tables.py Mon Feb 21 14:22:53 2022 +0000 @@ -44,10 +44,10 @@ 'ENA_submission_data'])) if "geo_location" in study['samples'][0].keys(): # sample belongs to a viral sample samples_table.write('\t'.join(['alias', 'status', 'accession', 'title', 'scientific_name', - 'taxon_id', 'sample_description', 'collection_date', - 'geographic_location', 'host_common_name', 'host_subject_id', - 'host_health_state', 'host_sex', 'host_scientific_name', - 'collector_name', 'collecting_institution', 'isolate', + 'taxon_id', 'sample_description', 'collection date', + 'geographic location (country and/or sea)', 'host common name', 'host subject id', + 'host health state', 'host sex', 'host scientific name', + 'collector name', 'collecting institution', 'isolate', 'submission_date']) + '\n') else: samples_table.write('\t'.join(['alias', 'status', 'accession', 'title', 'scientific_name', diff -r 9681a9180730 -r 2f7a70c0d3ab samples_macros.xml --- a/samples_macros.xml Wed Feb 02 17:30:12 2022 +0000 +++ b/samples_macros.xml Mon Feb 21 14:22:53 2022 +0000 @@ -67,14 +67,14 @@ - + - + @@ -207,7 +207,7 @@ - +