Next changeset 1:1162bfd9f782 (2022-04-12) |
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/pyega3 commit 3da28c7772346e1872b6d768b904305be0c61db7" |
added:
README.md pyega3.xml |
b |
diff -r 000000000000 -r caf213d51d6c README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Fri Oct 30 22:18:41 2020 +0000 |
b |
@@ -0,0 +1,20 @@ +# PyEGA3 + +## Set up user credentials on Galaxy + +To enable users to set their credentials for this tool, +make sure the file `config/user_preferences_extra.yml` has the following section: + +``` + ega_account: + description: Your EGA (European Genome Archive) account + inputs: + - name: username + label: Username + type: text + required: False + - name: password + label: Password + type: password + required: False +``` |
b |
diff -r 000000000000 -r caf213d51d6c pyega3.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pyega3.xml Fri Oct 30 22:18:41 2020 +0000 |
[ |
@@ -0,0 +1,138 @@ +<tool id="pyega3" name="EGA Download Client" version="@VERSION@+galaxy0" profile="19.09" > + <macros> + <token name="@VERSION@">3.4.0</token> + </macros> + <requirements> + <requirement type="package" version="@VERSION@">pyega3</requirement> + </requirements> + <command detect_errors="exit_code"><![CDATA[ +#set $username = $__user__.extra_preferences.get('ega_account|username', "") +#if $username == "": + #set $username = "ega-test-data@ebi.ac.uk (default user)" +#end if + echo "Running as user: $username. Set your credentials via: User -> Preferences -> Manage Information" && + +#if $action.action_type == "list_datasets" + pyega3 -cf '$credentials' + datasets +#elif $action.action_type == "list_dataset_files" + pyega3 -cf '$credentials' + files '$action.dataset_id' +#elif $action.action_type == "download_file" + pyega3 -cf '$credentials' + fetch '$action.file_id' + #if $action.range.reference_name + --reference-name '$action.range.reference_name' + #if $action.range.start + --start $action.range.start + #end if + #if $action.range.end + --end $action.range.end + #end if + #end if + --saveto '$downloaded_file' +#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 = "ega-test-data@ebi.ac.uk" + #set $password = "egarocks" +#end if +{ + "username": "$username", + "password": "$password" +} + ]]></configfile> + </configfiles> + <inputs> + <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> + <option value="list_dataset_files"> List files in a datasets </option> + <option value="download_file"> Download a file </option> + </param> + <when value="list_dataset_files"> + <param name="dataset_id" type="text" optional="false" label="EGA Dataset Accession ID" help="Identifier starting with 'EGAD'. For example: EGAD00001003338"> + <validator type="regex" message="EGA dataset ID must be a string of numbers prefixed by 'EGAD'">EGAD[0-9]+</validator> + </param> + </when> + <when value="list_datasets"/> + <when value="download_file"> + <param name="file_id" type="text" optional="false" label="EGA File Accession Identifier" help="Identifier starting with 'EGAF'. For example: EGAF00001753735"> + <validator type="regex" message="EGA Accession ID must be a string of numbers prefixed by 'EGAD' (datasets) or 'EGAF' (files)">EGAF[0-9]+</validator> + </param> + <section name="range" title="Request a specific Genomic range?" expanded="false"> + <param argument="--reference-name" type="text" optional="true" label="Reference Sequence Name" help="For example 'chr1', '1', or 'chrX'. If unspecified, all data is returned." /> + <param argument="--start" type="integer" optional="true" min="0" label="Start Position" help="0-based, inclusive. Only used if a reference sequence name was specified"/> + <param argument="--end" type="integer" optional="true" min="0" label="End Position" help="0-based, exclusive. Only used if a reference sequence name was specified"/> + </section> + </when> + </conditional> + </inputs> + <outputs> + <data name="authorized_datasets" format="txt" from_work_dir="pyega3_output.log" label="${tool.name}: authorized datasets"> + <filter> action['action_type'] == 'list_datasets' </filter> + </data> + <data name="dataset_file_list" format="txt" from_work_dir="pyega3_output.log" label="${tool.name}: dataset file list"> + <filter> action['action_type'] == 'list_dataset_files' </filter> + </data> + <data name="downloaded_file" auto_format="true" label="${tool.name}: ${action.file_id} ${action.range.reference_name} ${action.range.start} ${action.range.end}"> + <filter> action['action_type'] == 'download_file' </filter> + </data> + </outputs> + <tests> + <test expect_num_outputs="1"><!-- list datasets with default credentials --> + <param name="action_type" value="list_datasets"/> + <output name="authorized_datasets" ftype="txt"> + <assert_contents> + <has_text text="pyEGA3 - EGA python client version @VERSION@"/> + <has_text text="EGAD00001003338"/> + </assert_contents> + </output> + </test> + <test expect_num_outputs="1"><!-- list dataset files with default credentials --> + <param name="action_type" value="list_dataset_files"/> + <param name="dataset_id" value="EGAD00001003338"/> + <output name="dataset_file_list" ftype="txt"> + <assert_contents> + <has_text text="pyEGA3 - EGA python client version @VERSION@"/> + <has_line_matching expression="^\[.*\]\s+File ID\s+Status\s+Bytes\s+Check sum\s+File name$"/> + <has_text text="EGAF00001753734"/> + </assert_contents> + </output> + </test> + <test expect_num_outputs="1"> <!-- download a single file --> + <param name="action_type" value="download_file"/> + <param name="file_id" value="EGAF00001775036"/> + <output name="downloaded_file" md5="3b89b96387db5199fef6ba613f70e27c"/> + </test> + <test expect_num_outputs="1"> <!-- download a single file, with genomic range specified --> + <param name="action_type" value="download_file"/> + <param name="file_id" value="EGAF00001753756"/> + <param name="reference_name" value="1"/> + <param name="start" value="100"/> + <param name="end" value="10000"/> + <output name="downloaded_file" ftype="bam" md5="e576a38748feec45aa45191f6e902ce2"/> + </test> + </tests> + <help><![CDATA[ +The pyEGA3 download client is a python-based tool for viewing and downloading files from authorized EGA datasets. + +If you have an EGA account, you can set your EGA credentials in the user preferences menu of Galaxy. Otherwise, default EGA credentials with access to an example dataset will be used. + +pyEGA3 uses the EGA Data API and has several key features: + +- Files are transferred over secure https connections and received unencrypted, so no need for decryption after download. +- Downloads resume from where they left off in the event that the connection is interrupted. +- pyEGA3 supports file segmenting and parallelized download of segments, improving overall performance. +- After download completes, file integrity is verified using checksums. +- pyEGA3 implements the GA4GH-compliant htsget protocol for download of genomic ranges for data files with accompanying index files. + + ]]></help> + <citations> + <citation type="doi">10.1038/ng.3312</citation> + </citations> +</tool> |