changeset 2:705ebd286b57 draft default tip

"planemo upload commit 7761f1e59039279728185e751f1a51b56fe14cb0"
author nml
date Mon, 24 Aug 2020 12:14:15 -0400
parents cd6da887a5f4
children
files bundle_collection.pl bundle_collection.xml test-data/first.txt test-data/out-1.html test-data/out-2.html test-data/second.txt
diffstat 6 files changed, 249 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/bundle_collection.pl	Fri Aug 04 12:04:09 2017 -0400
+++ b/bundle_collection.pl	Mon Aug 24 12:14:15 2020 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use strict;
 use warnings;
@@ -52,57 +52,60 @@
 
 printf $out "<!DOCTYPE html>
 <html>
-<style type=\"text/css\">
-
-body {
-        font-family: sans-serif;
-        color: #000;
-        }
+<head>
+  <style type=\"text/css\">
+  
+  body {
+          font-family: sans-serif;
+          color: #000;
+          }
+  
+  table {
+          margin-left: 3em;
+          text-align: center;
+          }
+  th {
+          text-align:center;
+          background-color: #000080;
+          color: #FFF;
+          padding: 0.4em;
+          }
+  td {
+          font-family: monospace;
+          text-align: left;
+          background-color: #EEE;
+          color: #000;
+          padding: 0.4em;
+          }
+  h2 {
+          color: #800000;
+          padding-bottom: 0;
+          margin-bottom: 0;
+          clear: left;
+          }
+  </style>
+</head>
 
-table {
-        margin-left: 3em;
-        text-align: center;
-        }
-th {
-        text-align:center;
-        background-color: #000080;
-        color: #FFF;
-        padding: 0.4em;
-        }
-td {
-        font-family: monospace;
-        text-align: left;
-        background-color: #EEE;
-        color: #000;
-        padding: 0.4em;
-        }
-h2 {
-        color: #800000;
-        padding-bottom: 0;
-        margin-bottom: 0;
-        clear: left;
-        }
-</style></head>
+<body>
+
+  <h2 id=\"M0\">Bundle Collection Summary</h2><br><br>
 
-  <body>
-
-<h2 id=\"M0\">Bundle Collection Summary</h2><br><br>
+  Number of keys: $num_keys<br>
+  Number of values: $num_vals<br><br> 
 
-Number of keys: $num_keys<br>
-Number of values: $num_vals<br><br> 
-
-<table border=\"1\"><tr><th>File name</th><th>File type</th></tr>";
+  <table border=\"1\">
+    <tr><th>File name</th><th>File type</th></tr>\n";
 
 foreach my $key (sort(keys %information))
 {
 
 	foreach my $val (keys %{$information{$key}} )
 	{
-		printf $out "<tr><td>$key</td><td>$val</td></tr>";
+		printf $out "    <tr><td>$key</td><td>$val</td></tr>\n";
 	}
 }
 
-printf $out "</table></body></html>";
+printf $out "  </table>\n</body>\n</html>";
 
 close $out;
 
@@ -114,7 +117,7 @@
 
 =head1 SYNOPSIS
 
-	bundle_collection.pl -h html_file -p output_path -o "key=value"
+	bundle_collection.pl -h html_file -p output_path -i "key=value"
 
 =back
-=cut
\ No newline at end of file
+=cut
--- a/bundle_collection.xml	Fri Aug 04 12:04:09 2017 -0400
+++ b/bundle_collection.xml	Mon Aug 24 12:14:15 2020 -0400
@@ -1,71 +1,112 @@
-<tool id="bundle_collection" name="Bundle Collection" version="1.2.1">
-	<description>Download a collection of files</description>
-	<stdio>
-  	<exit_code range="1:" level="fatal" description="Unknown error has occurred"/>
-  </stdio>
-	<command interpreter="perl">bundle_collection.pl -h $html_file -p $html_file.files_path
+<tool id="bundle_collection" name="Bundle Collection" version="1.3.0">
+  <description>Package up and download a collection of files as a single archive.</description>
+  <requirements>
+    <requirement type="package" version="2.50">perl-getopt-long</requirement>
+    <requirement type="package" version="1.69">perl-pod-usage</requirement>
+  </requirements>
+  <command detect_errors="aggressive"><![CDATA[
+    perl '$__tool_directory__/bundle_collection.pl' -h '$html_file' -p '$html_file.files_path'
+
+    #if $singles_or_list.type == "list":
 
-        #if $singles_or_list.type == "list":
+      #if $singles_or_list.input:
+        #for $f in $singles_or_list.input.keys
+          -i "$f,$singles_or_list.input[$f].ext=$singles_or_list.input[$f]"
+          #if $singles_or_list.input[$f].metadata.bam_index and $singles_or_list.input[$f].metadata.bam_index != "None"
+            #set $bamind = $f+","+$singles_or_list.input[$f].ext+".bai="+$singles_or_list.input[$f].metadata.bam_index
+            -i "$bamind"
+          #end if
+        #end for
+      #end if
+    #elif $singles_or_list.type == "singles":
+      #for $dataset in $singles_or_list.single_files
+        #if $dataset.single_file:
+          -i "$dataset.single_file.name,$dataset.single_file.ext=$dataset.single_file"
+        #end if
 
-                #if $singles_or_list.input:
-               	    #for $f in $singles_or_list.input.keys
-		    -i "$f,$singles_or_list.input[$f].ext=$singles_or_list.input[$f]"
-		    #if $singles_or_list.input[$f].metadata.bam_index and $singles_or_list.input[$f].metadata.bam_index != "None"
-		        #set $bamind = $f+","+$singles_or_list.input[$f].ext+".bai="+$singles_or_list.input[$f].metadata.bam_index
-		        -i "$bamind"
-	            #end if
-		    #end for
-                #end if
-      #elif $singles_or_list.type == "singles":
-                #for $dataset in $singles_or_list.single_files
-                    #if $dataset.single_file:
-                        -i "$dataset.single_file.name,$dataset.single_file.ext=$dataset.single_file"
-                    #end if
+        #if $dataset.single_file.metadata.bam_index and $dataset.single_file.metadata.bam_index != "None"
+          #set $bamind = $dataset.single_file.name+","+$dataset.single_file.ext+".bai="+$dataset.single_file.metadata.bam_index
+          -i "$bamind"
+        #end if
+      #end for
+    #end if
+  ]]></command>
 
-		    #if $dataset.single_file.metadata.bam_index and $dataset.single_file.metadata.bam_index != "None"
-		        #set $bamind = $dataset.single_file.name+","+$dataset.single_file.ext+".bai="+$dataset.single_file.metadata.bam_index
-		        -i "$bamind"
-	            #end if
-                    
-                #end for
-      #end if
-	</command>
+  <inputs>
+    <conditional name="singles_or_list">
+      <param name="type" type="select" label="Bundle type">
+        <option value="singles">Individual datasets</option>
+        <option value="list">List Collection </option>
+      </param>
+      <when value="singles">
+        <repeat name='single_files' title='Single dataset(s)'>
+          <param name="single_file" label="Dataset to add the bundle" type="data" format='data' optional='False'/>
+        </repeat>              
+      </when>
+      <when value="list">
+        <param name="input" type="data_collection" label="Data Collection" collection_type="list" optional='False'/>
+      </when>
+    </conditional>
+  </inputs>
+
+  <outputs>
+    <data name="html_file" format="html" label="Bundled Collection" />
+  </outputs>
 
-	<inputs>
-          <conditional name="singles_or_list">
-            <param name="type" type="select" label="Bundle type">
-              <option value="singles">Individual datasets</option>
-              <option value="list">List Collection </option>
-            </param>
-            <when value="singles">
-              <repeat name='single_files' title='Single dataset(s)'>
-                <param name="single_file" label="Dataset to add the bundle" type="data" format='data' optional='False'/>
-              </repeat>              
-            </when>
-            <when value="list">
-              <param name="input" type="data_collection" label="Data Collection" collection_type="list" optional='False'/>
-            </when>
-          </conditional>
-	</inputs>
+  <tests>
+    <test>
+      <conditional name="singles_or_list">
+        <param name="type" value="singles" />
+        <repeat name="single_files">
+          <param name="single_file" value="first.txt" />
+        </repeat>
+      </conditional>
+      <output name="html_file" file="out-1.html" />
+    </test>
+    <test>
+      <conditional name="singles_or_list">
+        <param name="type" value="singles" />
+        <repeat name="single_files">
+          <param name="single_file" value="first.txt" />
+        </repeat>
+        <repeat name="single_files">
+          <param name="single_file" value="second.txt" />
+        </repeat>
+      </conditional>
+      <output name="html_file" file="out-2.html" />
+    </test>
+    <test>
+      <conditional name="singles_or_list">
+        <param name="type" value="list" />
+        <param name="input">
+          <collection type="list">
+            <element name="first.txt" value="first.txt"/>
+            <element name="second.txt" value="second.txt"/>
+          </collection>
+        </param>
+      </conditional>
+      <output name="html_file" file="out-2.html" />
+    </test>
+  </tests>
 
-	<outputs>
-		<data name="html_file" format="html" label="Bundled Collection" />
-	</outputs>
-	<tests>
-		<test>
-		  <output/>
-		</test>
-	</tests>
+  <help><![CDATA[
+    ***What it does**
+
+    This tool will bundle up files in a list collection into a downloadable zip file
+
+    Author: Mariam Iskander, Jen Cabral, and Aaron Petkau (Public Health Agency of Canada).
+    ]]>
+  </help>
 
-	<help>
-		***What it does**
-
-		This tool will bundle up files in a list collection into a downloadable zip file
-
-		Author: Mariam Iskander and Jen Cabral
-	</help>
-
-	<citations>
+  <citations>
+    <citation type="bibtex">
+      @UNPUBLISHED{PHAC2020,
+        author = "Public Health Agency of Canada",
+        title = "Bundle Collections",
+        year = "2020",
+        url = {https://github.com/phac-nml/galaxy_tools}
+      }
+    </citation>
   </citations>
 
 </tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/first.txt	Mon Aug 24 12:14:15 2020 -0400
@@ -0,0 +1,1 @@
+first
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out-1.html	Mon Aug 24 12:14:15 2020 -0400
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style type="text/css">
+  
+  body {
+          font-family: sans-serif;
+          color: #000;
+          }
+  
+  table {
+          margin-left: 3em;
+          text-align: center;
+          }
+  th {
+          text-align:center;
+          background-color: #000080;
+          color: #FFF;
+          padding: 0.4em;
+          }
+  td {
+          font-family: monospace;
+          text-align: left;
+          background-color: #EEE;
+          color: #000;
+          padding: 0.4em;
+          }
+  h2 {
+          color: #800000;
+          padding-bottom: 0;
+          margin-bottom: 0;
+          clear: left;
+          }
+  </style>
+</head>
+
+<body>
+
+  <h2 id="M0">Bundle Collection Summary</h2><br><br>
+
+  Number of keys: 1<br>
+  Number of values: 1<br><br> 
+
+  <table border="1">
+    <tr><th>File name</th><th>File type</th></tr>
+    <tr><td>first.txt</td><td>txt</td></tr>
+  </table>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out-2.html	Mon Aug 24 12:14:15 2020 -0400
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style type="text/css">
+  
+  body {
+          font-family: sans-serif;
+          color: #000;
+          }
+  
+  table {
+          margin-left: 3em;
+          text-align: center;
+          }
+  th {
+          text-align:center;
+          background-color: #000080;
+          color: #FFF;
+          padding: 0.4em;
+          }
+  td {
+          font-family: monospace;
+          text-align: left;
+          background-color: #EEE;
+          color: #000;
+          padding: 0.4em;
+          }
+  h2 {
+          color: #800000;
+          padding-bottom: 0;
+          margin-bottom: 0;
+          clear: left;
+          }
+  </style>
+</head>
+
+<body>
+
+  <h2 id="M0">Bundle Collection Summary</h2><br><br>
+
+  Number of keys: 2<br>
+  Number of values: 2<br><br> 
+
+  <table border="1">
+    <tr><th>File name</th><th>File type</th></tr>
+    <tr><td>first.txt</td><td>txt</td></tr>
+    <tr><td>second.txt</td><td>txt</td></tr>
+  </table>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/second.txt	Mon Aug 24 12:14:15 2020 -0400
@@ -0,0 +1,1 @@
+second