Mercurial > repos > iuc > ega_download_client
comparison pyega3.xml @ 1:1162bfd9f782 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/pyega3 commit f91c99780efc91e89950ed9494ef9e6f83d198c7"
author | iuc |
---|---|
date | Tue, 12 Apr 2022 11:36:51 +0000 |
parents | caf213d51d6c |
children | e82175804eb1 |
comparison
equal
deleted
inserted
replaced
0:caf213d51d6c | 1:1162bfd9f782 |
---|---|
1 <tool id="pyega3" name="EGA Download Client" version="@VERSION@+galaxy0" profile="19.09" > | 1 <tool id="pyega3" name="EGA Download Client" version="@TOOL_VERSION@+galaxy0" profile="21.01" > |
2 <macros> | 2 <macros> |
3 <token name="@VERSION@">3.4.0</token> | 3 <token name="@TOOL_VERSION@">4.0.0</token> |
4 </macros> | 4 </macros> |
5 <requirements> | 5 <requirements> |
6 <requirement type="package" version="@VERSION@">pyega3</requirement> | 6 <requirement type="package" version="@TOOL_VERSION@">pyega3</requirement> |
7 </requirements> | 7 </requirements> |
8 <command detect_errors="exit_code"><![CDATA[ | 8 <command detect_errors="exit_code"><![CDATA[ |
9 #set $username = $__user__.extra_preferences.get('ega_account|username', "") | 9 #set $username = $__user__.extra_preferences.get('ega_account|username', "") |
10 #if $username == "": | 10 #if $username == "": |
11 #set $username = "ega-test-data@ebi.ac.uk (default user)" | 11 #set $username = "ega-test-data@ebi.ac.uk (default user)" |
16 pyega3 -cf '$credentials' | 16 pyega3 -cf '$credentials' |
17 datasets | 17 datasets |
18 #elif $action.action_type == "list_dataset_files" | 18 #elif $action.action_type == "list_dataset_files" |
19 pyega3 -cf '$credentials' | 19 pyega3 -cf '$credentials' |
20 files '$action.dataset_id' | 20 files '$action.dataset_id' |
21 && | |
22 | |
23 ## create file header | |
24 echo -e 'File ID\tStatus\tBytes\tCheck sum\tFile name' > '$dataset_file_list' && | |
25 | |
26 ## remove timestamps and convert spaces to tabs | |
27 grep EGAF pyega3_output.log | sed -e 's/^\[.*\]\s\+//g' | sed 's/\s\+/\t/g' >> '$dataset_file_list' | |
28 | |
21 #elif $action.action_type == "download_file" | 29 #elif $action.action_type == "download_file" |
22 pyega3 -cf '$credentials' | 30 pyega3 -c \${PYEGA_CONNECTIONS:-30} -cf '$credentials' |
23 fetch '$action.file_id' | 31 fetch '$action.file_id' |
32 --max-retries 10 | |
24 #if $action.range.reference_name | 33 #if $action.range.reference_name |
25 --reference-name '$action.range.reference_name' | 34 --reference-name '$action.range.reference_name' |
26 #if $action.range.start | 35 #if $action.range.start |
27 --start $action.range.start | 36 --start $action.range.start |
28 #end if | 37 #end if |
29 #if $action.range.end | 38 #if $action.range.end |
30 --end $action.range.end | 39 --end $action.range.end |
31 #end if | 40 #end if |
32 #end if | 41 #end if |
33 --saveto '$downloaded_file' | 42 && mv ${action.file_id} downloads |
43 && rm -f downloads/*.md5 ## checksum validation already performed by pyEGA, cleanup downloads folder | |
44 | |
45 #elif $action.action_type == "download_files" | |
46 #set file_ids=[x.split('\t')[int(str($action.id_column))-1] for x in open(str($id_table)).readlines() if x.split('\t')[int(str($action.id_column))-1].startswith('EGAF') ] | |
47 mkdir downloads | |
48 #for f in $file_ids | |
49 && | |
50 pyega3 -c \${PYEGA_CONNECTIONS:-30} -cf '$credentials' | |
51 fetch '$f' | |
52 --max-retries 10 | |
53 #if $action.range.reference_name | |
54 --reference-name '$action.range.reference_name' | |
55 #if $action.range.start | |
56 --start $action.range.start | |
57 #end if | |
58 #if $action.range.end | |
59 --end $action.range.end | |
60 #end if | |
61 #end if | |
62 --output-dir downloads | |
63 #end for | |
64 && rm -f downloads/**/*.md5 ## checksum validation already performed by pyEGA, clean up downloads folder | |
65 | |
34 #end if | 66 #end if |
35 ]]></command> | 67 ]]></command> |
36 <configfiles> | 68 <configfiles> |
37 <configfile name="credentials"><![CDATA[ | 69 <configfile name="credentials"><![CDATA[ |
38 #set $password = $__user__.extra_preferences.get('ega_account|password', "") | 70 #set $password = $__user__.extra_preferences.get('ega_account|password', "") |
51 <conditional name="action"> | 83 <conditional name="action"> |
52 <param name="action_type" type="select" label="What would you like to do?"> | 84 <param name="action_type" type="select" label="What would you like to do?"> |
53 <option value="list_datasets"> List my authorized datasets </option> | 85 <option value="list_datasets"> List my authorized datasets </option> |
54 <option value="list_dataset_files"> List files in a datasets </option> | 86 <option value="list_dataset_files"> List files in a datasets </option> |
55 <option value="download_file"> Download a file </option> | 87 <option value="download_file"> Download a file </option> |
88 <option value="download_files"> Download multiple files (based on a file with IDs) </option> | |
56 </param> | 89 </param> |
57 <when value="list_dataset_files"> | 90 <when value="list_dataset_files"> |
58 <param name="dataset_id" type="text" optional="false" label="EGA Dataset Accession ID" help="Identifier starting with 'EGAD'. For example: EGAD00001003338"> | 91 <param name="dataset_id" type="text" optional="false" label="EGA Dataset Accession ID" help="Identifier starting with 'EGAD'. For example: EGAD00001003338"> |
59 <validator type="regex" message="EGA dataset ID must be a string of numbers prefixed by 'EGAD'">EGAD[0-9]+</validator> | 92 <validator type="regex" message="EGA dataset ID must be a string of numbers prefixed by 'EGAD'">EGAD[0-9]+</validator> |
60 </param> | 93 </param> |
63 <when value="download_file"> | 96 <when value="download_file"> |
64 <param name="file_id" type="text" optional="false" label="EGA File Accession Identifier" help="Identifier starting with 'EGAF'. For example: EGAF00001753735"> | 97 <param name="file_id" type="text" optional="false" label="EGA File Accession Identifier" help="Identifier starting with 'EGAF'. For example: EGAF00001753735"> |
65 <validator type="regex" message="EGA Accession ID must be a string of numbers prefixed by 'EGAD' (datasets) or 'EGAF' (files)">EGAF[0-9]+</validator> | 98 <validator type="regex" message="EGA Accession ID must be a string of numbers prefixed by 'EGAD' (datasets) or 'EGAF' (files)">EGAF[0-9]+</validator> |
66 </param> | 99 </param> |
67 <section name="range" title="Request a specific Genomic range?" expanded="false"> | 100 <section name="range" title="Request a specific Genomic range?" expanded="false"> |
68 <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." /> | 101 <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." /> |
69 <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"/> | 102 <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"/> |
70 <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"/> | 103 <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"/> |
104 </section> | |
105 </when> | |
106 <when value="download_files"> | |
107 <param name="id_table" type="data" format="tabular" label="Table with IDs to download" help="A tabular file where one column contains the set of file IDs. This will output a collection. Please select files that are all the same format (e.g. all BAM or all VCF)."/> | |
108 <param name="id_column" type="data_column" data_ref="id_table" label="Column containing the file IDs" help="File Identifiers starting with 'EGAF'. For example: EGAF00001753735" /> | |
109 <section name="range" title="Request a specific Genomic range? (will be applied to ALL requested files)" expanded="false"> | |
110 <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." /> | |
111 <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"/> | |
112 <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"/> | |
71 </section> | 113 </section> |
72 </when> | 114 </when> |
73 </conditional> | 115 </conditional> |
116 <param name="output_log" type="boolean" checked="false" label="Output the log file?"/> | |
74 </inputs> | 117 </inputs> |
75 <outputs> | 118 <outputs> |
76 <data name="authorized_datasets" format="txt" from_work_dir="pyega3_output.log" label="${tool.name}: authorized datasets"> | 119 <data name="authorized_datasets" format="txt" from_work_dir="pyega3_output.log" label="${tool.name}: authorized datasets"> |
77 <filter> action['action_type'] == 'list_datasets' </filter> | 120 <filter> action['action_type'] == 'list_datasets' </filter> |
78 </data> | 121 </data> |
79 <data name="dataset_file_list" format="txt" from_work_dir="pyega3_output.log" label="${tool.name}: dataset file list"> | 122 <data name="dataset_file_list" format="tabular" label="${tool.name}: ${action.dataset_id} - file list"> |
80 <filter> action['action_type'] == 'list_dataset_files' </filter> | 123 <filter> action['action_type'] == 'list_dataset_files' </filter> |
81 </data> | 124 </data> |
82 <data name="downloaded_file" auto_format="true" label="${tool.name}: ${action.file_id} ${action.range.reference_name} ${action.range.start} ${action.range.end}"> | 125 <data name="downloaded_file" auto_format="true" from_work_dir="downloads/*" label="${tool.name}: ${action.file_id} ${action.range.reference_name} ${action.range.start} ${action.range.end}"> |
83 <filter> action['action_type'] == 'download_file' </filter> | 126 <filter> action['action_type'] == 'download_file' </filter> |
84 </data> | 127 </data> |
128 <data name="logfile" format="txt" from_work_dir="pyega3_output.log" label="${tool.name}: log"> | |
129 <filter> output_log </filter> | |
130 </data> | |
131 <collection name="downloaded_file_collection" type="list" label="${tool.name} on ${on_string}: Downloaded datasets"> | |
132 <filter> action['action_type'] == 'download_files' </filter> | |
133 <discover_datasets pattern="__designation_and_ext__" recurse="true" directory="downloads" /> | |
134 </collection> | |
85 </outputs> | 135 </outputs> |
86 <tests> | 136 <tests> |
87 <test expect_num_outputs="1"><!-- list datasets with default credentials --> | 137 <test expect_num_outputs="1"><!-- list datasets with default credentials --> |
88 <param name="action_type" value="list_datasets"/> | 138 <param name="action_type" value="list_datasets"/> |
89 <output name="authorized_datasets" ftype="txt"> | 139 <output name="authorized_datasets" ftype="txt"> |
90 <assert_contents> | 140 <assert_contents> |
91 <has_text text="pyEGA3 - EGA python client version @VERSION@"/> | 141 <has_text text="pyEGA3 - EGA python client version @TOOL_VERSION@"/> |
92 <has_text text="EGAD00001003338"/> | 142 <has_text text="EGAD00001003338"/> |
93 </assert_contents> | 143 </assert_contents> |
94 </output> | 144 </output> |
95 </test> | 145 </test> |
96 <test expect_num_outputs="1"><!-- list dataset files with default credentials --> | 146 <test expect_num_outputs="2"><!-- list dataset files with default credentials, and request a log output file --> |
97 <param name="action_type" value="list_dataset_files"/> | 147 <param name="action_type" value="list_dataset_files"/> |
98 <param name="dataset_id" value="EGAD00001003338"/> | 148 <param name="dataset_id" value="EGAD00001003338"/> |
99 <output name="dataset_file_list" ftype="txt"> | 149 <param name="output_log" value="true"/> |
150 <output name="dataset_file_list" file="filelist_EGAD00001003338.tabular"/> | |
151 <output name="logfile" ftype="txt"> | |
100 <assert_contents> | 152 <assert_contents> |
101 <has_text text="pyEGA3 - EGA python client version @VERSION@"/> | 153 <has_text text="pyEGA3 - EGA python client version @TOOL_VERSION@"/> |
102 <has_line_matching expression="^\[.*\]\s+File ID\s+Status\s+Bytes\s+Check sum\s+File name$"/> | 154 <has_line_matching expression="^\[.*\]\s+File ID\s+Status\s+Bytes\s+Check sum\s+File name$"/> |
103 <has_text text="EGAF00001753734"/> | 155 <has_text text="EGAF00001753734"/> |
104 </assert_contents> | 156 </assert_contents> |
105 </output> | 157 </output> |
106 </test> | 158 </test> |
107 <test expect_num_outputs="1"> <!-- download a single file --> | 159 <test expect_num_outputs="1"> <!-- download a single file --> |
108 <param name="action_type" value="download_file"/> | 160 <param name="action_type" value="download_file"/> |
109 <param name="file_id" value="EGAF00001775036"/> | 161 <param name="file_id" value="EGAF00001775036"/> |
110 <output name="downloaded_file" md5="3b89b96387db5199fef6ba613f70e27c"/> | 162 <output name="downloaded_file" md5="3b89b96387db5199fef6ba613f70e27c"/> |
111 </test> | 163 </test> |
112 <test expect_num_outputs="1"> <!-- download a single file, with genomic range specified --> | 164 <test expect_num_outputs="1"> <!-- download a single file, with genomic range specified --> |
113 <param name="action_type" value="download_file"/> | 165 <param name="action_type" value="download_file"/> |
114 <param name="file_id" value="EGAF00001753756"/> | 166 <param name="file_id" value="EGAF00001753756"/> |
115 <param name="reference_name" value="1"/> | 167 <param name="reference_name" value="1"/> |
116 <param name="start" value="100"/> | 168 <param name="start" value="100"/> |
117 <param name="end" value="10000"/> | 169 <param name="end" value="10000"/> |
118 <output name="downloaded_file" ftype="bam" md5="e576a38748feec45aa45191f6e902ce2"/> | 170 <output name="downloaded_file" ftype="bam" md5="e576a38748feec45aa45191f6e902ce2"/> |
119 </test> | 171 </test> |
172 <test expect_num_outputs="1"> <!-- download multiple files --> | |
173 <param name="action_type" value="download_files"/> | |
174 <param name="id_table" value="filelist.tabular"/> | |
175 <param name="id_column" value="1"/> | |
176 <output_collection name="downloaded_file_collection" type="list" count="2"> | |
177 <element name="ENCFF000VWO.bam" md5="b8ae14d5d1f717ab17d45e8fc36946a0" /> | |
178 <element name="ENCFF284YOU.bam" md5="3b89b96387db5199fef6ba613f70e27c" /> | |
179 </output_collection> | |
180 </test> | |
181 <test expect_num_outputs="1"> <!-- download multiple files, in combination with a genomic range --> | |
182 <param name="action_type" value="download_files"/> | |
183 <param name="id_table" value="filelist2.tabular"/> | |
184 <param name="id_column" value="1"/> | |
185 <param name="reference_name" value="1"/> | |
186 <param name="start" value="100"/> | |
187 <param name="end" value="10000"/> | |
188 <output_collection name="downloaded_file_collection" count="2"> | |
189 <element name="NA19239_genomic_range_1_100_10000" md5="bcdcf18846233cbe5cc8afd95168552c" /> | |
190 <element name="NA19240_genomic_range_1_100_10000" md5="e576a38748feec45aa45191f6e902ce2" /> | |
191 </output_collection> | |
192 </test> | |
120 </tests> | 193 </tests> |
121 <help><![CDATA[ | 194 <help><![CDATA[ |
122 The pyEGA3 download client is a python-based tool for viewing and downloading files from authorized EGA datasets. | 195 The pyEGA3 download client is a python-based tool for viewing and downloading files from authorized EGA datasets. |
123 | 196 |
124 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. | 197 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. |