-
Notifications
You must be signed in to change notification settings - Fork 499
Pyega3 - Move credentials to requirements #7594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RZ9082
wants to merge
15
commits into
galaxyproject:main
Choose a base branch
from
RZ9082:pyega3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9bfe66e
Pyega3 - Move credentials to requierements
RZ9082 f121020
Adjust profile
RZ9082 2bdd65d
Fix linting
RZ9082 d98d50d
Update tests
RZ9082 b383630
Remove missing link
RZ9082 d42474b
Update DAA link
RZ9082 8c11f95
Add hidden test parameter
RZ9082 9386910
Update test file
RZ9082 b95ecc0
Check if vcf.gz files exist
RZ9082 f2bcef6
Update renaming command
RZ9082 fd9ac19
Update command and DAA link
RZ9082 8d2990a
Update tests
RZ9082 96bc4bb
Fix linting
RZ9082 5118bd8
Use configfiles for credentials
RZ9082 de26749
Add credential variables default values
RZ9082 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,30 @@ | ||
| <tool id="pyega3" name="EGA Download Client" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.01" > | ||
| <tool id="pyega3" name="EGA Download Client" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="25.1" > | ||
| <macros> | ||
| <token name="@TOOL_VERSION@">5.0.2</token> | ||
| <token name="@VERSION_SUFFIX@">0</token> | ||
| <token name="@VERSION_SUFFIX@">1</token> | ||
| </macros> | ||
| <requirements> | ||
| <requirement type="package" version="@TOOL_VERSION@">pyega3</requirement> | ||
| <credentials name="ega_credentials" version="1.0" label="EGA (European Genome Archive) credentials" description="Credentials for accessing EGA"> | ||
| <secret name="ega_usename" inject_as_env="EGA_USERNAME" optional="false" label="EGA account username"/> | ||
| <secret name="ega_password" inject_as_env="EGA_PASSWORD" optional="false" label="EGA account password"/> | ||
| </credentials> | ||
| </requirements> | ||
| <version_command><![CDATA[ | ||
| pyega3 -v |& grep version | cut -d" " -f 10 | ||
| ]]></version_command> | ||
| <command detect_errors="exit_code"><![CDATA[ | ||
| #set $username = $__user__.extra_preferences.get('ega_account|username', "") | ||
| #if $username == "": | ||
| #set $username = "[email protected] (default user)" | ||
| #if $test_boolean | ||
| echo '{"username":"[email protected]","password":"egarocks"}' > credentials.json && | ||
| #else | ||
| echo '{"username":"'\$EGA_USERNAME'","password":"'\$EGA_PASSWORD'"}' > credentials.json && | ||
| #end if | ||
| echo "Running as user: $username. Set your credentials via: User -> Preferences -> Manage Information" && | ||
|
|
||
| #if $action.action_type == "list_datasets" | ||
| pyega3 -cf '$credentials' | ||
| pyega3 -cf credentials.json | ||
| datasets | ||
| #elif $action.action_type == "list_dataset_files" | ||
| pyega3 -cf '$credentials' | ||
| pyega3 -cf credentials.json | ||
| files '$action.dataset_id' | ||
| && | ||
|
|
||
|
|
@@ -31,7 +35,7 @@ | |
| grep EGAF pyega3_output.log | sed -e 's/^\[.*\]\s\+//g' | sed 's/\s\+/\t/g' >> '$dataset_file_list' | ||
|
|
||
| #elif $action.action_type == "download_file" | ||
| pyega3 -c \${PYEGA_CONNECTIONS:-30} -cf '$credentials' | ||
| pyega3 -c \${PYEGA_CONNECTIONS:-30} -cf credentials.json | ||
| fetch '$action.file_id' | ||
| --max-retries 10 | ||
| #if $action.range.reference_name | ||
|
|
@@ -58,7 +62,7 @@ | |
| && | ||
| echo 'Downloading $f' | ||
| && | ||
| pyega3 -c \${PYEGA_CONNECTIONS:-30} -cf '$credentials' | ||
| pyega3 -c \${PYEGA_CONNECTIONS:-30} -cf credentials.json | ||
| fetch '$f' | ||
| --max-retries 10 | ||
| #if $action.range.reference_name | ||
|
|
@@ -72,26 +76,13 @@ | |
| #end if | ||
| --output-dir downloads | ||
| #end for | ||
| && for vcf in \$(ls downloads/**/*vcf.gz); do mv "\${vcf}" "\${vcf:0:-6}vcf_bgzip"; done ## renaming vcf.gz files to vcf_bgzip to recognize format | ||
| && if ls downloads/**/*vcf.gz >/dev/null 2>&1; then for vcf in downloads/**/*vcf.gz; do mv "\${vcf}" "\${vcf:0:-6}vcf_bgzip"; done; fi ## renaming vcf.gz files to vcf_bgzip to recognize format | ||
| && rm -f downloads/**/*.md5 ## checksum validation already performed by pyEGA, clean up downloads folder | ||
|
|
||
| #end if | ||
| ]]></command> | ||
| <configfiles> | ||
| <configfile name="credentials"><![CDATA[ | ||
| #set $password = $__user__.extra_preferences.get('ega_account|password', "") | ||
| #set $username = $__user__.extra_preferences.get('ega_account|username', "") | ||
| #if $username == "" or $password == "": | ||
| #set $username = "[email protected]" | ||
| #set $password = "egarocks" | ||
| #end if | ||
| { | ||
| "username": "$username", | ||
| "password": "$password" | ||
| } | ||
| ]]></configfile> | ||
| </configfiles> | ||
| <inputs> | ||
| <param name="test_boolean" type="boolean" checked="false" hidden="true"/> | ||
RZ9082 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <conditional name="action"> | ||
| <param name="action_type" type="select" label="What would you like to do?"> | ||
| <option value="list_datasets"> List my authorized datasets </option> | ||
|
|
@@ -146,9 +137,21 @@ | |
| </collection> | ||
| </outputs> | ||
| <tests> | ||
| <!-- testing credentials feature --> | ||
| <test expect_num_outputs="0"> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="list_datasets"/> | ||
| </conditional> | ||
| <assert_stderr> | ||
| <has_text text="Invalid username, password or secret key - please check and retry. If problem persists contact helpdesk on [email protected]"/> | ||
| </assert_stderr> | ||
| </test> | ||
| <!-- list datasets with default credentials --> | ||
| <test expect_num_outputs="1"> | ||
| <param name="action_type" value="list_datasets"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="list_datasets"/> | ||
| </conditional> | ||
| <output name="authorized_datasets" ftype="txt"> | ||
| <assert_contents> | ||
| <has_text text="pyEGA3 - EGA python client version @TOOL_VERSION@"/> | ||
|
|
@@ -158,8 +161,11 @@ | |
| </test> | ||
| <!-- list dataset files with default credentials, and request a log output file --> | ||
| <test expect_num_outputs="2"> | ||
| <param name="action_type" value="list_dataset_files"/> | ||
| <param name="dataset_id" value="EGAD00001003338"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="list_dataset_files"/> | ||
| <param name="dataset_id" value="EGAD00001003338"/> | ||
| </conditional> | ||
| <param name="output_log" value="true"/> | ||
| <output name="dataset_file_list" file="filelist_EGAD00001003338.tabular"/> | ||
| <output name="logfile" ftype="txt"> | ||
|
|
@@ -172,30 +178,44 @@ | |
| </test> | ||
| <!-- download a single file --> | ||
| <test expect_num_outputs="1"> | ||
| <param name="action_type" value="download_file"/> | ||
| <param name="file_id" value="EGAF00001775036"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="download_file"/> | ||
| <param name="file_id" value="EGAF00001775036"/> | ||
| </conditional> | ||
| <output name="downloaded_file" md5="3b89b96387db5199fef6ba613f70e27c"/> | ||
| </test> | ||
| <!-- download a single vcf.gz --> | ||
| <test expect_num_outputs="1"> | ||
| <param name="action_type" value="download_file"/> | ||
| <param name="file_id" value="EGAF00007243775"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="download_file"/> | ||
| <param name="file_id" value="EGAF00007243775"/> | ||
| </conditional> | ||
| <output name="downloaded_file" md5="51cfb69bf3b9416ff425381a58c18a2b" ftype="vcf_bgzip" /> | ||
| </test> | ||
| <!-- download a single bam, with genomic range specified --> | ||
| <test expect_num_outputs="1"> | ||
| <param name="action_type" value="download_file"/> | ||
| <param name="file_id" value="EGAF00001753756"/> | ||
| <param name="reference_name" value="1"/> | ||
| <param name="start" value="0"/> | ||
| <param name="end" value="10000"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="download_file"/> | ||
| <param name="file_id" value="EGAF00001753756"/> | ||
| <section name="range"> | ||
| <param name="reference_name" value="1"/> | ||
| <param name="start" value="0"/> | ||
| <param name="end" value="10000"/> | ||
| </section> | ||
| </conditional> | ||
| <output name="downloaded_file" md5="4b5344ad094c2bed7787430259205098"/> | ||
| </test> | ||
| <!-- download multiple files --> | ||
| <test expect_num_outputs="1"> | ||
| <param name="action_type" value="download_files"/> | ||
| <param name="id_table" value="filelist.tabular"/> | ||
| <param name="id_column" value="1"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="download_files"/> | ||
| <param name="id_table" value="filelist.tabular"/> | ||
| <param name="id_column" value="1"/> | ||
| </conditional> | ||
| <output_collection name="downloaded_file_collection" type="list" count="2"> | ||
| <element name="ENCFF000VWO.bam" md5="b8ae14d5d1f717ab17d45e8fc36946a0" /> | ||
| <element name="ENCFF284YOU.bam" md5="3b89b96387db5199fef6ba613f70e27c" /> | ||
|
|
@@ -206,12 +226,17 @@ | |
| </test> | ||
| <!-- download multiple files, in combination with a genomic range --> | ||
| <test expect_num_outputs="1"> | ||
| <param name="action_type" value="download_files"/> | ||
| <param name="id_table" value="filelist2.tabular"/> | ||
| <param name="id_column" value="1"/> | ||
| <param name="reference_name" value="1"/> | ||
| <param name="start" value="0"/> | ||
| <param name="end" value="10000"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="download_files"/> | ||
| <section name="range"> | ||
| <param name="start" value="0"/> | ||
| <param name="end" value="10000"/> | ||
| <param name="reference_name" value="1"/> | ||
| </section> | ||
| <param name="id_table" value="filelist2.tabular"/> | ||
| <param name="id_column" value="1"/> | ||
| </conditional> | ||
| <output_collection name="downloaded_file_collection" count="2"> | ||
| <element name="NA19239_genomic_range_1_0_10000" md5="497f443830a6a3ec2e5bb5a19c4db638" /> | ||
| <element name="NA19240_genomic_range_1_0_10000" md5="4b5344ad094c2bed7787430259205098" /> | ||
|
|
@@ -222,9 +247,12 @@ | |
| </test> | ||
| <!-- download multiple vcf.gz files --> | ||
| <test expect_num_outputs="1"> | ||
| <param name="action_type" value="download_files"/> | ||
| <param name="id_table" value="filelist3.tabular"/> | ||
| <param name="id_column" value="1"/> | ||
| <param name="test_boolean" value="true"/> | ||
| <conditional name="action"> | ||
| <param name="action_type" value="download_files"/> | ||
| <param name="id_table" value="filelist3.tabular"/> | ||
| <param name="id_column" value="1"/> | ||
| </conditional> | ||
| <output_collection name="downloaded_file_collection" type="list" count="2"> | ||
| <element name="HG00408.novoBreak__256r__4.100100-10100100__7.200100-9000100" md5="51cfb69bf3b9416ff425381a58c18a2b" ftype="vcf_bgzip" /> | ||
| <element name="HG01890.HGSVC__145r__1.900100-10001000__18.2001000-90001000" md5="ebad4425191a89d3e970c02190a87175" ftype="vcf_bgzip" /> | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.