diff unsorted_uniq.xml @ 30:5907d248dee3 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 28d2fcf2649b999762fbd94bd648485b916f2f0d
author bgruening
date Sat, 17 Jan 2026 00:56:56 +0000
parents 08cdbfffce67
children
line wrap: on
line diff
--- a/unsorted_uniq.xml	Wed Jun 04 15:11:51 2025 +0000
+++ b/unsorted_uniq.xml	Sat Jan 17 00:56:56 2026 +0000
@@ -4,30 +4,39 @@
         <import>macros.xml</import>
     </macros>
     <expand macro="creator"/>
-    <expand macro="requirements" />
+    <expand macro="requirements">
+        <requirement type="package" version="4.9">sed</requirement>
+    </expand>
     <version_command>sort --version | head -n 1</version_command>
     <command>
 <![CDATA[
-    sort -u
-        $ignore_case
-        $is_numeric
-        -t '	'
-        #if $adv_opts.adv_opts_selector == "advanced":
-            -k$adv_opts.column_start,$adv_opts.column_end
+    (
+        export LC_ALL=C;
+        #if int($header) > 0:
+            sed -u '${header}'q &&
         #end if
-        -o '$outfile'
-        '$infile'
+        sort -u
+            $ignore_case
+            $is_numeric
+            -t '	'
+            #if $adv_opts.adv_opts_selector == "advanced":
+                -k$adv_opts.column_start,$adv_opts.column_end
+            #end if
+    ) < '$infile' > '$outfile'
 ]]>
     </command>
     <inputs>
         <param name="infile" type="data" format="tabular" label="File to scan for unique values" />
-        <param name="ignore_case" type="boolean" truevalue="-f" falsevalue="" checked="False"
+        <param name="ignore_case" type="boolean" truevalue="-f" falsevalue=""
             label="Ignore differences in case when comparing" help="(-f)"/>
-        <param name="is_numeric" type="boolean" truevalue="-n" falsevalue="" checked="False"
-            label="Column only contains numeric values" help="(-n)" />
+        <param name="is_numeric" type="boolean" truevalue="-n" falsevalue=""
+            label="Compare numeric values at start of records" help="This will try to detect numeric values at the start of each record and base comparisons only on these numbers (or the empty string if no starting number is found) (-n)." />
+        <param name="header" type="integer" value="0" label="Number of header lines" help="These will be ignored during sort.">
+            <validator type="in_range" message="Negative values are not allowed." min="0"/>
+        </param>
         <conditional name="adv_opts">
             <param name="adv_opts_selector" type="select" label="Advanced Options">
-                <option value="basic" selected="True">Hide Advanced Options</option>
+                <option value="basic" selected="true">Hide Advanced Options</option>
                 <option value="advanced">Show Advanced Options</option>
             </param>
             <when value="basic" />
@@ -43,8 +52,8 @@
     <tests>
         <test>
             <param name="infile" value="1.bed"/>
-            <param name="is_numeric" value="True"/>
-            <param name="ignore_case" value="True"/>
+            <param name="is_numeric" value="true"/>
+            <param name="ignore_case" value="true"/>
             <conditional name="adv_opts">
                 <param name="adv_opts_selector" value="advanced"/>
                 <param name="column_start" value="2"/>
@@ -52,6 +61,24 @@
             </conditional>
             <output name="outfile" file="unique_results1.bed"/>
         </test>
+        <test>
+            <param name="infile" value="1.bed"/>
+            <param name="is_numeric" value="true"/>
+            <param name="ignore_case" value="true"/>
+            <param name="header" value="1"/>
+            <conditional name="adv_opts">
+                <param name="adv_opts_selector" value="advanced"/>
+                <param name="column_start" value="2"/>
+                <param name="column_end" value="3"/>
+            </conditional>
+            <output name="outfile" file="unique_results2.bed"/>
+        </test>
+        <test>
+            <param name="infile" value="1_dup.bed"/>
+            <param name="is_numeric" value="false"/>
+            <param name="ignore_case" value="true"/>
+            <output name="outfile" file="unique_results3.bed"/>
+        </test>
     </tests>
     <help>
 <![CDATA[