Mercurial > repos > imgteam > unzip
comparison unzip.xml @ 2:57f0914ddb7b draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/unzip/ commit a8d89b9ebc13951944dcec84323464692837bba7
author | imgteam |
---|---|
date | Fri, 14 Apr 2023 19:02:41 +0000 |
parents | 38eec75fbe9b |
children |
comparison
equal
deleted
inserted
replaced
1:38eec75fbe9b | 2:57f0914ddb7b |
---|---|
1 <tool id="unzip" name="Unzip" version="0.2"> | 1 <tool id="unzip" name="Unzip" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> |
2 <description>Unzip file</description> | 2 <description>Unzip a file</description> |
3 <requirements> | 3 <macros> |
4 <requirement type="package">unzip</requirement> | 4 <token name="@TOOL_VERSION@">6.0</token> |
5 <requirement type="package">tar</requirement> | 5 <token name="@VERSION_SUFFIX@">0</token> |
6 </requirements> | 6 <token name="@PROFILE@">22.01</token> |
7 <command> | 7 </macros> |
8 <![CDATA[ | 8 <requirements> |
9 <requirement type="package" version="@TOOL_VERSION@">unzip</requirement> | |
10 <requirement type="package" version="1.34">tar</requirement> | |
11 </requirements> | |
12 <command> | |
13 <![CDATA[ | |
9 mkdir ./out && | 14 mkdir ./out && |
10 #if $input_file.is_of_type("zip"): | 15 #if $input_file.is_of_type("zip"): |
11 unzip | 16 unzip |
12 #if $extract_options['extract_all'] == 'False' | 17 #if $extract_options['extract_all'] == 'False' |
13 -p "$input_file" "$extract_options['pathtofile']" > out.data | 18 -p '$input_file' '$extract_options["pathtofile"]' > out.data |
14 #else | 19 #else |
15 "$input_file" -d out/ | 20 '$input_file' -d out/ |
16 #end if | 21 #end if |
17 #end if | 22 #end if |
18 #if $input_file.is_of_type("tar"): | 23 #if $input_file.is_of_type("tar"): |
19 tar | 24 tar |
20 #if $extract_options['extract_all'] == 'False' | 25 #if $extract_options['extract_all'] == 'False' |
21 xfO "$input_file" "$extract_options['pathtofile']" > out.data | 26 xfO '$input_file' '$extract_options["pathtofile"]' > out.data |
22 #else | 27 #else |
23 -xf "$input_file" -C ./out/ | 28 -xf '$input_file' -C ./out/ |
24 #end if | 29 #end if |
25 #end if | 30 #end if |
26 ]]> | 31 && |
27 </command> | 32 |
28 <inputs> | 33 ## Flatten any potential directory structure, e.g. |
29 <param label="input_file" name="input_file" type="data" format="zip,tar"/> | 34 ## out/sub1/subsub2/fileA.ext -> out/sub1_subsub2_fileA.ext |
30 <conditional name="extract_options"> | 35 find out -type f | cut -d '/' -f 2- | grep '/' | xargs -I % sh -c "mv out/% out/\\$(echo % | tr / _)" |
31 <param label="Extract single file" name="extract_all" type="select"> | 36 ]]> |
32 <option selected="True" value="True">All files</option> | 37 </command> |
33 <option value="False">Single file</option> | 38 <inputs> |
34 </param> | 39 <param label="input_file" name="input_file" type="data" format="zip,tar"/> |
35 <when value="True"></when> | 40 <conditional name="extract_options"> |
36 <when value="False"> | 41 <param label="Extract single file" name="extract_all" type="select"> |
37 <param name="pathtofile" type="text" value="" label="Filepath"> | 42 <option selected="True" value="True">All files</option> |
38 <validator type="expression" message="No two dots (..) allowed">'..' not in value</validator> | 43 <option value="False">Single file</option> |
39 <validator type="expression" message="No comma (,) allowed">',' not in value</validator> | 44 </param> |
40 <validator type="expression" message="No asterisk (*) allowed">'*' not in value</validator> | 45 <when value="True"></when> |
41 <validator type="expression" message="No leading slash (/) allowed">str(value)[0] != '/'</validator> | 46 <when value="False"> |
42 </param> | 47 <param name="pathtofile" type="text" value="" label="Filepath"> |
43 </when> | 48 <validator type="expression" message="No two dots (..) allowed">'..' not in value</validator> |
44 </conditional> | 49 <validator type="expression" message="No comma (,) allowed">',' not in value</validator> |
45 </inputs> | 50 <validator type="expression" message="No asterisk (*) allowed">'*' not in value</validator> |
46 <outputs> | 51 <validator type="expression" message="No leading slash (/) allowed">str(value)[0] != '/'</validator> |
47 <data auto_format="true" name="unzipped_single" from_work_dir="out.data"> | 52 </param> |
48 <filter>extract_options['extract_all'] == 'False'</filter> | 53 </when> |
54 </conditional> | |
55 </inputs> | |
56 <outputs> | |
57 <data auto_format="true" name="unzipped_single" from_work_dir="out.data" label="${tool.name} on ${on_string}"> | |
58 <filter>extract_options['extract_all'] == 'False'</filter> | |
49 </data> | 59 </data> |
50 <collection name="unzipped" type="list" label="${tool.name} on ${on_string}"> | 60 <collection name="unzipped" type="list" label="${tool.name} on ${on_string} all files as collection"> |
51 <discover_datasets pattern="__designation_and_ext__" directory="out" visible="false" format="auto" /> | 61 <discover_datasets directory="out" pattern="(?P<designation>.+?)(\.(?P<ext>[^\._]+))?$" visible="false" format="auto"/> |
52 <filter>extract_options['extract_all'] == 'True'</filter> | 62 <!-- pattern=__designation_and_ext__ = (?P<designation>.*)\.(?P<ext>[^\._]+)? would discard files without extensions --> |
63 <filter>extract_options['extract_all'] == 'True'</filter> | |
53 </collection> | 64 </collection> |
54 </outputs> | 65 </outputs> |
55 <tests> | 66 <tests> |
56 <test> | 67 <test expect_num_outputs="1"> |
57 <param name="input_file" value="input.zip" ftype="zip"/> | 68 <param name="input_file" value="input.zip" ftype="zip"/> |
58 <param name="extract_all" value="False"/> | 69 <param name="extract_all" value="False"/> |
59 <param name="pathtofile" value="input.png"/> | 70 <param name="pathtofile" value="input.png"/> |
60 <output name="unzipped_single" file="input.png" ftype="png" compare="sim_size" /> | 71 <output name="unzipped_single" file="input.png" ftype="png" compare="sim_size"/> |
61 </test> | 72 </test> |
62 <test> | 73 <test expect_num_outputs="1"> |
63 <param name="input_file" value="input.zip" ftype="zip"/> | 74 <param name="input_file" value="input.zip" ftype="zip"/> |
64 <param name="extract_all" value="True"/> | 75 <param name="extract_all" value="True"/> |
65 <output_collection name="unzipped" type="list"> | 76 <output_collection name="unzipped" type="list" count="2"> |
66 <element name="input" file="input.png" ftype="png" compare="sim_size"/> | 77 <element name="input" file="input.png" ftype="png" compare="sim_size"/> |
67 <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/> | 78 <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/> |
68 </output_collection> | 79 </output_collection> |
69 </test> | 80 </test> |
70 <test> | 81 <!-- Binary files without file extension --> |
82 <test expect_num_outputs="1"> | |
83 <param name="input_file" value="input_binary.zip" ftype="zip"/> | |
84 <param name="extract_all" value="True"/> | |
85 <output_collection name="unzipped" type="list" count="2"> | |
86 <element name="yelp" file="yelp" compare="sim_size"/> | |
87 <element name="yes" file="yes" compare="sim_size"/> | |
88 </output_collection> | |
89 </test> | |
90 <!-- Compressed object with subfolders, each containing files --> | |
91 <test expect_num_outputs="1"> | |
92 <param name="input_file" value="subfolders.zip" ftype="zip"/> | |
93 <param name="extract_all" value="True"/> | |
94 <output_collection name="unzipped" type="list" count="4"> | |
95 <element name="binaries_yelp" file="yelp" compare="sim_size"/> | |
96 <element name="binaries_yes" file="yes" compare="sim_size"/> | |
97 <element name="images_input" file="input.png" ftype="png" compare="sim_size"/> | |
98 <element name="images_res" file="res.tiff" ftype="tiff" compare="sim_size"/> | |
99 </output_collection> | |
100 </test> | |
101 <test expect_num_outputs="1"> | |
102 <param name="input_file" value="input.tar" ftype="tar"/> | |
103 <param name="extract_all" value="False"/> | |
104 <param name="pathtofile" value="input.png"/> | |
105 <output name="unzipped_single" file="input.png" ftype="png" compare="sim_size"/> | |
106 </test> | |
107 <test expect_num_outputs="1"> | |
71 <param name="input_file" value="input.tar" ftype="tar"/> | 108 <param name="input_file" value="input.tar" ftype="tar"/> |
72 <param name="extract_all" value="True"/> | 109 <param name="extract_all" value="True"/> |
73 <output_collection name="unzipped" type="list"> | 110 <output_collection name="unzipped" type="list" count="2"> |
74 <element name="input" file="input.png" ftype="png" compare="sim_size"/> | 111 <element name="input" file="input.png" ftype="png" compare="sim_size"/> |
75 <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/> | 112 <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/> |
76 </output_collection> | 113 </output_collection> |
77 </test> | 114 </test> |
78 </tests> | 115 </tests> |
79 <help> | 116 <help> |
80 **What it does** | 117 **What it does** |
81 | 118 |
82 Unzip folder to collection. | 119 Unzip a folder containing file(s) of various types. If multiple files are asked to be retained, the output will be a collection containing all files within the zip or tar archive. |
83 </help> | 120 </help> |
84 <citations> | 121 <citations> |
85 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> | 122 <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation> |
86 </citations> | 123 </citations> |
87 </tool> | 124 </tool> |
88 | 125 |