Repository 'unzip'
hg clone https://toolshed.g2.bx.psu.edu/repos/imgteam/unzip

Changeset 2:57f0914ddb7b (2023-04-14)
Previous changeset 1:38eec75fbe9b (2019-08-02)
Commit message:
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/unzip/ commit a8d89b9ebc13951944dcec84323464692837bba7
modified:
unzip.xml
added:
test-data/input_binary.zip
test-data/subfolders.zip
test-data/yelp
test-data/yes
b
diff -r 38eec75fbe9b -r 57f0914ddb7b test-data/input_binary.zip
b
Binary file test-data/input_binary.zip has changed
b
diff -r 38eec75fbe9b -r 57f0914ddb7b test-data/subfolders.zip
b
Binary file test-data/subfolders.zip has changed
b
diff -r 38eec75fbe9b -r 57f0914ddb7b test-data/yelp
b
Binary file test-data/yelp has changed
b
diff -r 38eec75fbe9b -r 57f0914ddb7b test-data/yes
b
Binary file test-data/yes has changed
b
diff -r 38eec75fbe9b -r 57f0914ddb7b unzip.xml
--- a/unzip.xml Fri Aug 02 07:21:01 2019 -0400
+++ b/unzip.xml Fri Apr 14 19:02:41 2023 +0000
[
b'@@ -1,88 +1,125 @@\n-<tool id="unzip" name="Unzip" version="0.2"> \n-  <description>Unzip file</description>\n-  <requirements>\n-        <requirement type="package">unzip</requirement>\n-        <requirement type="package">tar</requirement>\n-  </requirements>\n-  <command> \n-        <![CDATA[  \n+<tool id="unzip" name="Unzip" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">\n+    <description>Unzip a file</description>\n+    <macros>\n+        <token name="@TOOL_VERSION@">6.0</token>\n+        <token name="@VERSION_SUFFIX@">0</token>\n+        <token name="@PROFILE@">22.01</token>\n+    </macros>\n+    <requirements>\n+        <requirement type="package" version="@TOOL_VERSION@">unzip</requirement>\n+        <requirement type="package" version="1.34">tar</requirement>\n+    </requirements>\n+    <command> \n+    <![CDATA[\n         mkdir ./out &&\n         #if $input_file.is_of_type("zip"):\n-          unzip\n-          #if $extract_options[\'extract_all\'] == \'False\'\n-            -p "$input_file" "$extract_options[\'pathtofile\']" > out.data\n-          #else\n-            "$input_file" -d out/\n-          #end if\n+            unzip\n+            #if $extract_options[\'extract_all\'] == \'False\'\n+                -p \'$input_file\' \'$extract_options["pathtofile"]\' > out.data\n+            #else\n+                \'$input_file\' -d out/\n+            #end if\n         #end if\n         #if $input_file.is_of_type("tar"):\n-          tar\n-          #if $extract_options[\'extract_all\'] == \'False\'\n-            xfO "$input_file" "$extract_options[\'pathtofile\']" > out.data\n-          #else\n-            -xf "$input_file" -C ./out/\n-          #end if\n+            tar\n+            #if $extract_options[\'extract_all\'] == \'False\'\n+              xfO \'$input_file\' \'$extract_options["pathtofile"]\' > out.data\n+            #else\n+              -xf \'$input_file\' -C ./out/\n+            #end if\n         #end if\n-        ]]>\n-  </command>\n-  <inputs>\n-    <param label="input_file" name="input_file" type="data" format="zip,tar"/>\n-    <conditional name="extract_options">\n-      <param label="Extract single file" name="extract_all" type="select">\n-          <option selected="True" value="True">All files</option>\n-          <option value="False">Single file</option>\n-      </param>\n-      <when value="True"></when>\n-      <when value="False">\n-        <param name="pathtofile" type="text" value="" label="Filepath">\n-          <validator type="expression" message="No two dots (..) allowed">\'..\' not in value</validator>\n-          <validator type="expression" message="No comma (,) allowed">\',\' not in value</validator>\n-          <validator type="expression" message="No asterisk (*) allowed">\'*\' not in value</validator>\n-          <validator type="expression" message="No leading slash (/) allowed">str(value)[0] != \'/\'</validator>\n-        </param>\n-      </when>\n-    </conditional>\n-  </inputs>\n-  <outputs>\n-        <data auto_format="true" name="unzipped_single" from_work_dir="out.data">\n-          <filter>extract_options[\'extract_all\'] == \'False\'</filter>\n+        &&\n+\n+        ## Flatten any potential directory structure, e.g.\n+        ## out/sub1/subsub2/fileA.ext -> out/sub1_subsub2_fileA.ext\n+        find out -type f | cut -d \'/\' -f 2- | grep \'/\' | xargs -I % sh -c "mv out/% out/\\\\$(echo % | tr / _)"\n+    ]]>\n+    </command>\n+    <inputs>\n+        <param label="input_file" name="input_file" type="data" format="zip,tar"/>\n+        <conditional name="extract_options">\n+            <param label="Extract single file" name="extract_all" type="select">\n+                <option selected="True" value="True">All files</option>\n+                <option value="False">Single file</option>\n+            </param>\n+            <when value="True"></when>\n+            <when value="False">\n+                <param name="pathtofile" type="text" value="" label="Filepath">\n+                    <validator type="expression" message="No two dots (..) allowed">\'..\' not in value</validator>\n+       '..b'tion&gt;.+?)(\\.(?P&lt;ext&gt;[^\\._]+))?$" visible="false" format="auto"/>\n+            <!--      pattern=__designation_and_ext__ = (?P&lt;designation&gt;.*)\\.(?P&lt;ext&gt;[^\\._]+)? would discard files without extensions -->\n+            <filter>extract_options[\'extract_all\'] == \'True\'</filter>\n         </collection>\n-  </outputs>\n-  <tests>\n-        <test>\n+    </outputs>\n+    <tests>\n+       <test expect_num_outputs="1">\n             <param name="input_file" value="input.zip" ftype="zip"/>\n             <param name="extract_all" value="False"/>\n             <param name="pathtofile" value="input.png"/>\n-            <output name="unzipped_single" file="input.png" ftype="png" compare="sim_size" />\n+            <output name="unzipped_single" file="input.png" ftype="png" compare="sim_size"/>\n         </test>\n-        <test>\n+        <test expect_num_outputs="1">\n             <param name="input_file" value="input.zip" ftype="zip"/>\n             <param name="extract_all" value="True"/>\n-            <output_collection name="unzipped" type="list">\n+            <output_collection name="unzipped" type="list" count="2">\n                 <element name="input" file="input.png" ftype="png" compare="sim_size"/>\n                 <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/>\n             </output_collection>\n         </test>\n-        <test>\n+        <!-- Binary files without file extension -->\n+        <test expect_num_outputs="1">\n+            <param name="input_file" value="input_binary.zip" ftype="zip"/>\n+            <param name="extract_all" value="True"/>\n+            <output_collection name="unzipped" type="list" count="2">\n+                <element name="yelp" file="yelp" compare="sim_size"/>\n+                <element name="yes" file="yes" compare="sim_size"/>\n+            </output_collection>\n+        </test>\n+        <!-- Compressed object with subfolders, each containing files -->\n+        <test expect_num_outputs="1">\n+            <param name="input_file" value="subfolders.zip" ftype="zip"/>\n+            <param name="extract_all" value="True"/>\n+            <output_collection name="unzipped" type="list" count="4">\n+                <element name="binaries_yelp" file="yelp" compare="sim_size"/>\n+                <element name="binaries_yes" file="yes" compare="sim_size"/>\n+                <element name="images_input" file="input.png" ftype="png" compare="sim_size"/>\n+                <element name="images_res" file="res.tiff" ftype="tiff" compare="sim_size"/>\n+            </output_collection>\n+        </test>\n+        <test expect_num_outputs="1">\n+            <param name="input_file" value="input.tar" ftype="tar"/>\n+            <param name="extract_all" value="False"/>\n+            <param name="pathtofile" value="input.png"/>\n+            <output name="unzipped_single" file="input.png" ftype="png" compare="sim_size"/>\n+        </test>\n+        <test expect_num_outputs="1">\n             <param name="input_file" value="input.tar" ftype="tar"/>\n             <param name="extract_all" value="True"/>\n-            <output_collection name="unzipped" type="list">\n+            <output_collection name="unzipped" type="list" count="2">\n                 <element name="input" file="input.png" ftype="png" compare="sim_size"/>\n                 <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/>\n             </output_collection>\n         </test>\n-  </tests>   \n-  <help>\n-    **What it does**\n-\n-  Unzip folder to collection.\n-  </help>\n-  <citations>\n-    <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>\n-  </citations>\n+    </tests>   \n+    <help>\n+        **What it does**\n+          \n+        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.\n+    </help>\n+    <citations>\n+        <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>\n+    </citations>\n </tool>\n \n'