view unzip.xml @ 1:38eec75fbe9b draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/unzip/ commit ab38debe1175446664e9bede9be8c667894bf9f1
author imgteam
date Fri, 02 Aug 2019 07:21:01 -0400
parents ec30427e0d42
children 57f0914ddb7b
line wrap: on
line source

<tool id="unzip" name="Unzip" version="0.2"> 
  <description>Unzip file</description>
  <requirements>
        <requirement type="package">unzip</requirement>
        <requirement type="package">tar</requirement>
  </requirements>
  <command> 
        <![CDATA[  
        mkdir ./out &&
        #if $input_file.is_of_type("zip"):
          unzip
          #if $extract_options['extract_all'] == 'False'
            -p "$input_file" "$extract_options['pathtofile']" > out.data
          #else
            "$input_file" -d out/
          #end if
        #end if
        #if $input_file.is_of_type("tar"):
          tar
          #if $extract_options['extract_all'] == 'False'
            xfO "$input_file" "$extract_options['pathtofile']" > out.data
          #else
            -xf "$input_file" -C ./out/
          #end if
        #end if
        ]]>
  </command>
  <inputs>
    <param label="input_file" name="input_file" type="data" format="zip,tar"/>
    <conditional name="extract_options">
      <param label="Extract single file" name="extract_all" type="select">
          <option selected="True" value="True">All files</option>
          <option value="False">Single file</option>
      </param>
      <when value="True"></when>
      <when value="False">
        <param name="pathtofile" type="text" value="" label="Filepath">
          <validator type="expression" message="No two dots (..) allowed">'..' not in value</validator>
          <validator type="expression" message="No comma (,) allowed">',' not in value</validator>
          <validator type="expression" message="No asterisk (*) allowed">'*' not in value</validator>
          <validator type="expression" message="No leading slash (/) allowed">str(value)[0] != '/'</validator>
        </param>
      </when>
    </conditional>
  </inputs>
  <outputs>
        <data auto_format="true" name="unzipped_single" from_work_dir="out.data">
          <filter>extract_options['extract_all'] == 'False'</filter>
        </data>
        <collection name="unzipped" type="list" label="${tool.name} on ${on_string}">
          <discover_datasets pattern="__designation_and_ext__" directory="out" visible="false" format="auto" />
          <filter>extract_options['extract_all'] == 'True'</filter>
        </collection>
  </outputs>
  <tests>
        <test>
            <param name="input_file" value="input.zip" ftype="zip"/>
            <param name="extract_all" value="False"/>
            <param name="pathtofile" value="input.png"/>
            <output name="unzipped_single" file="input.png" ftype="png" compare="sim_size" />
        </test>
        <test>
            <param name="input_file" value="input.zip" ftype="zip"/>
            <param name="extract_all" value="True"/>
            <output_collection name="unzipped" type="list">
                <element name="input" file="input.png" ftype="png" compare="sim_size"/>
                <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/>
            </output_collection>
        </test>
        <test>
            <param name="input_file" value="input.tar" ftype="tar"/>
            <param name="extract_all" value="True"/>
            <output_collection name="unzipped" type="list">
                <element name="input" file="input.png" ftype="png" compare="sim_size"/>
                <element name="res" file="res.tiff" ftype="tiff" compare="sim_size"/>
            </output_collection>
        </test>
  </tests>   
  <help>
    **What it does**

  Unzip folder to collection.
  </help>
  <citations>
    <citation type="doi">10.1016/j.jbiotec.2017.07.019</citation>
  </citations>
</tool>