Skip to content

Commit

Permalink
Update ENA upload tool to latest version (#5472)
Browse files Browse the repository at this point in the history
* Update ena_upload.xml

* Update README.md

* fix linting + no nonviral

* viral only

* better cleanup

* update doc

* rst instead of md

* fixed tests

* match number of outputs

* add more options

* update tests

* update templates + refactor

* fix linting

* header collection date

* fix tests

* add extra matching line

* replace line

* Bring back non viral interactive submissions

* fix tests

* update missing attributes

* fix linting

* fix indentation

* attempt in fixing the tests

* new way of versioning the tool

* consistent use of True and False

* fix values

* attempt 1000

* add false

* leave out unnecessary test

* trigger fail

* test assert_stderr

* has_line

* add full line

* duplicate
  • Loading branch information
bedroesb authored Oct 27, 2023
1 parent 94b799b commit dccd4c0
Show file tree
Hide file tree
Showing 17 changed files with 317 additions and 295 deletions.
31 changes: 0 additions & 31 deletions tools/ena_upload/README.md

This file was deleted.

42 changes: 42 additions & 0 deletions tools/ena_upload/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ENA-upload-cli wrapper
======================

Galaxy wrapper of the
`ena-upload-cli <https://github.com/usegalaxy-eu/ena-upload-cli>`__.
Templates that can be used in as input for the metadata can be found
`here <https://github.com/ELIXIR-Belgium/ENA-metadata-templates>`__

This tool is shipped in a ready to use Galaxy container found
`here <https://github.com/ELIXIR-Belgium/ena-upload-container>`__.

Setting up credentials on Galaxy
--------------------------------

The admin of the server can set up global credentials through a file
with the format:

.. code-block:: yaml
username: webin_id
password: webin_password
The path to this file must be exported as an environment variable called
$GALAXY_ENA_SECRETS

Alternatively, the admin can enable users to set their own credentials
for this tool. To enable it, make sure the file
``config/user_preferences_extra_conf.yml`` has the following section:

.. code-block:: yaml
ena_webin_account:
description: Your ENA Webin account details
inputs:
- name: webin_id
label: ENA Webin ID
type: text
required: False
- name: password
label: Password
type: password
required: False
197 changes: 76 additions & 121 deletions tools/ena_upload/ena_upload.xml

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions tools/ena_upload/extract_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,20 @@
for study_index, study in enumerate(studies_dict):
study_alias = 'study_' + str(study_index) + '_' + timestamp
studies_table.write('\t'.join([study_alias, action, study['title'],
study['type'], study['abstract'], study['pubmed_id'],
]))
if "geo_location" in study['samples'][0].keys(): # sample belongs to a viral sample
study['type'], study['abstract'], study['pubmed_id']]))
if "host_subject_id" in study['samples'][0].keys(): # sample belongs to a viral sample
samples_table.write('\t'.join(['alias', 'status', 'title', 'scientific_name',
'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',
]) + '\n')
'collector name', 'collecting institution', 'isolate']) + '\n')
else:
samples_table.write('\t'.join(['alias', 'status', 'title', 'scientific_name',
'taxon_id', 'sample_description']) + '\n')
'taxon_id', 'sample_description', 'collection date',
'geographic location (country and/or sea)']) + '\n')
for sample_index, sample in enumerate(study['samples']):
sample_alias = 'sample_' + str(sample_index) + '_' + timestamp
if "geo_location" in sample.keys(): # sample belongs to a viral sample
if "host_subject_id" in sample.keys(): # sample belongs to a viral sample
if sample['collector_name'] == '':
sample['collector_name'] = 'unknown'
samples_table.write('\t'.join([sample_alias, action, sample['title'],
Expand All @@ -64,12 +63,13 @@
sample['host_subject_id'], sample['host_health_state'],
sample['host_sex'], sample['host_scientific_name'],
sample['collector_name'],
sample['collecting_institution'], sample['isolate'],
sample['collecting_institution'], sample['isolate']
]) + '\n')
else:
samples_table.write('\t'.join([sample_alias, action, sample['title'],
sample['tax_name'], sample['tax_id'],
sample['description']]) + '\n')
sample['description'], sample['collection_date'],
sample['geo_location']]) + '\n')
for exp_index, exp in enumerate(sample['experiments']):
exp_alias = 'experiment_' + str(exp_index) + '.' + str(sample_index) + '_' + timestamp
lib_alias = 'library_' + str(exp_index) + '_' + str(sample_index)
Expand All @@ -79,8 +79,7 @@
exp['library_source'], exp['library_selection'],
exp['library_layout'].lower(), exp['insert_size'],
exp['library_construction_protocol'],
exp['platform'], exp['instrument_model'],
]) + '\n')
exp['platform'], exp['instrument_model']]) + '\n')
run_index = 0
# exp['runs'] is a list of lists
for (base_run, run_files) in exp['runs']:
Expand Down
Loading

0 comments on commit dccd4c0

Please sign in to comment.