changeset 3:f58ba0382c26 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/subtract_query commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
author devteam
date Thu, 22 Jun 2017 18:51:44 -0400
parents 659a1c095357
children
files macros.xml subtract_query.py subtract_query.xml tool_dependencies.xml
diffstat 4 files changed, 106 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Thu Jun 22 18:51:44 2017 -0400
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="0.7.1">bx-python</requirement>
+            <requirement type="package" version="1.0.0">galaxy-ops</requirement>
+        </requirements>
+    </xml>
+    <token name="@SCREENCASTS@">
+-----
+
+**Screencasts!**
+
+See Galaxy Interval Operation Screencasts_ (right click to open this link in another window).
+
+.. _Screencasts: https://galaxyproject.org/learn/interval-operations/
+
+-----
+    </token>
+</macros>
--- a/subtract_query.py	Fri Dec 18 19:39:32 2015 -0500
+++ b/subtract_query.py	Thu Jun 22 18:51:44 2017 -0400
@@ -1,12 +1,14 @@
 #!/usr/bin/env python
 # Greg Von Kuster
-
 """
 Subtract an entire query from another query
 usage: %prog in_file_1 in_file_2 begin_col end_col output
     --ignore-empty-end-cols: ignore empty end columns when subtracting
 """
+from __future__ import print_function
+
 import sys
+
 from bx.cookbook import doc_optparse
 
 # Older py compatibility
@@ -81,7 +83,7 @@
     try:
         fo = open(out_file, 'w')
     except:
-        print >> sys.stderr, "Unable to open output file"
+        print("Unable to open output file", file=sys.stderr)
         sys.exit()
 
     """
@@ -97,7 +99,7 @@
     """lines1 is now the set of unique lines in inp1_file - the set of unique lines in inp2_file"""
 
     for line in lines1:
-        print >> fo, line
+        print(line, file=fo)
 
     fo.close()
 
@@ -109,7 +111,8 @@
     if diff1 > 0:
         info_msg += 'Eliminated %d duplicate/blank/comment/invalid lines from first query.' % diff1
 
-    print info_msg
+    print(info_msg)
+
 
 if __name__ == "__main__":
     main()
--- a/subtract_query.xml	Fri Dec 18 19:39:32 2015 -0500
+++ b/subtract_query.xml	Thu Jun 22 18:51:44 2017 -0400
@@ -1,87 +1,89 @@
 <tool id="subtract_query1" name="Subtract Whole Dataset" version="0.1">
-  <description>from another dataset</description>
-  <requirements>
-    <requirement type="package" version="0.7.1">bx-python</requirement>
-    <requirement type="package" version="1.0.0">galaxy-ops</requirement>
-  </requirements>
-  <command interpreter="python">
-    subtract_query.py $input1 $input2 $begin_col $end_col $output
-    #if str($ignore_empty_end_cols) == 'true':
-      --ignore-empty-end-cols
-    #end if
-
-  </command>
-  <inputs>
-    <param format="txt" name="input2" type="data" label="Subtract" help="Second dataset" />
-    <param format="txt" name="input1" type="data" label="from" help="First dataset" />
-    <param name="begin_col" type="data_column" data_ref="input1" force_select="False" label="Restrict subtraction between 'begin column'" />
-    <param name="end_col" type="data_column" data_ref="input1" force_select="False" label="and 'end column'" help="Specifying columns for restricting subtraction is available only for tabular formatted datasets" />
-    <param name="ignore_empty_end_cols" type="boolean" label="Ignore empty columns and whitespace at end of line when subtracting"/>
-  </inputs>
-  <outputs>
-    <data format="input" name="output" metadata_source="input1" />
-  </outputs>
-  <tests>
-  	<!-- Subtract 2 non-tabular files with no column restrictions. -->
-  	<!-- Cannot figure out why this test won't pass, it works in real time... -->
-  	<!--
-    <test>
-      <param name="input1" value="1.txt" />
-      <param name="input2" value="2.txt" />
-      <param name="begin_col" value="None" />
-      <param name="end_col" value="None" />
-      <output name="output" file="subtract-query-1.dat" />
-    </test>
-    -->
-  	<!-- Subtract 2 tabular files with no column restrictions. -->
-    <test>
-      <param name="input1" value="eq-showbeginning.dat" />
-      <param name="input2" value="eq-showtail.dat" />
-      <param name="begin_col" value="None" />
-      <param name="end_col" value="None" />
-      <output name="output" file="subtract-query-2.dat" />
-    </test>
-  	<!-- Subtract 2 tabular files with column restrictions. -->
-    <test>
-      <param name="input1" value="eq-showbeginning.dat" />
-      <param name="input2" value="eq-removebeginning.dat" />
-      <param name="begin_col" value="c1" />
-      <param name="end_col" value="c3" />
-      <output name="output" file="subtract-query-3.dat" />
-    </test>
-  	<!-- Subtract a non-tabular file from a tabular file with no column restrictions. -->
-    <test>
-      <param name="input1" value="eq-showbeginning.dat" />
-      <param name="input2" value="2.txt" />
-      <param name="begin_col" value="None" />
-      <param name="end_col" value="None" />
-      <output name="output" file="subtract-query-4.dat" />
-    </test>
-    <!-- Subtract  2 tabular files with no column restrictions, ignoring empty end columns. -->
-    <test>
-      <param name="input1" value="eq-showbeginning_e.dat" />
-      <param name="input2" value="eq-showtail.dat" />
-      <param name="begin_col" value="None" />
-      <param name="end_col" value="None" />
-      <param name="ignore_empty_end_cols" value="true" />
-      <output name="output" file="subtract-query-2.dat" />
-    </test>
-  </tests>
-  <help>
-
+    <description>from another dataset</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <command><![CDATA[
+python '$__tool_directory__/subtract_query.py'
+'$input1'
+'$input2'
+$begin_col
+$end_col
+'$output'
+#if str($ignore_empty_end_cols) == 'true':
+    --ignore-empty-end-cols
+#end if
+    ]]></command>
+    <inputs>
+        <param name="input2" type="data" format="txt" label="Subtract" help="Second dataset" />
+        <param name="input1" type="data" format="txt" label="from" help="First dataset" />
+        <param name="begin_col" type="data_column" data_ref="input1" force_select="False" label="Restrict subtraction between 'begin column'" />
+        <param name="end_col" type="data_column" data_ref="input1" force_select="False" label="and 'end column'" help="Specifying columns for restricting subtraction is available only for tabular formatted datasets" />
+        <param name="ignore_empty_end_cols" type="boolean" label="Ignore empty columns and whitespace at end of line when subtracting"/>
+    </inputs>
+    <outputs>
+        <data name="output" format_source="input1" metadata_source="input1" />
+    </outputs>
+    <tests>
+        <!-- Subtract 2 non-tabular files with no column restrictions. -->
+        <!-- Cannot figure out why this test won't pass, it works in real time... -->
+        <!--
+        <test>
+            <param name="input1" value="1.txt" />
+            <param name="input2" value="2.txt" />
+            <param name="begin_col" value="None" />
+            <param name="end_col" value="None" />
+            <output name="output" file="subtract-query-1.dat" />
+        </test>
+        -->
+        <!-- Subtract 2 tabular files with no column restrictions. -->
+        <test>
+            <param name="input1" value="eq-showbeginning.dat" />
+            <param name="input2" value="eq-showtail.dat" />
+            <param name="begin_col" value="" />
+            <param name="end_col" value="" />
+            <output name="output" file="subtract-query-2.dat" />
+        </test>
+        <!-- Subtract 2 tabular files with column restrictions. -->
+        <test>
+            <param name="input1" value="eq-showbeginning.dat" />
+            <param name="input2" value="eq-removebeginning.dat" />
+            <param name="begin_col" value="c1" />
+            <param name="end_col" value="c3" />
+            <output name="output" file="subtract-query-3.dat" />
+        </test>
+        <!-- Subtract a non-tabular file from a tabular file with no column restrictions. -->
+        <test>
+            <param name="input1" value="eq-showbeginning.dat" />
+            <param name="input2" value="2.txt" />
+            <param name="begin_col" value="" />
+            <param name="end_col" value="" />
+            <output name="output" file="subtract-query-4.dat" />
+        </test>
+        <!-- Subtract  2 tabular files with no column restrictions, ignoring empty end columns. -->
+        <test>
+            <param name="input1" value="eq-showbeginning_e.dat" />
+            <param name="input2" value="eq-showtail.dat" />
+            <param name="begin_col" value="" />
+            <param name="end_col" value="" />
+            <param name="ignore_empty_end_cols" value="true" />
+            <output name="output" file="subtract-query-2.dat" />
+        </test>
+    </tests>
+    <help><![CDATA[
 .. class:: infomark
 
 **TIP:** This tool complements the tool in the **Operate on Genomic Intervals** tool set which subtracts the intervals of two datasets.
 
-
 -----
 
 **Syntax**
 
-This tool subtracts an entire dataset from another dataset.  
+This tool subtracts an entire dataset from another dataset.
 
 - Any text format is valid.
-- If both dataset formats are tabular, you may restrict the subtraction to specific columns **contained in both datasets** and the resulting dataset will include only the columns specified. 
+- If both dataset formats are tabular, you may restrict the subtraction to specific columns **contained in both datasets** and the resulting dataset will include only the columns specified.
 - The begin column must be less than or equal to the end column.  If it is not, begin column is switched with end column.
 - If begin column is specified but end column is not, end column will default to begin_column (and vice versa).
 - All blank and comment lines are skipped and not included in the resulting dataset (comment lines are lines beginning with a # character).
@@ -102,7 +104,7 @@
   chr1            30      55
   chrY            1       20
   chr1            1225979 42287290
-  chr10           7       8 
+  chr10           7       8
 
 and this is the **Second dataset**::
 
@@ -117,7 +119,7 @@
 
 Subtracting the **Second dataset** from the **First dataset** (including all columns) will yield::
 
-  chr10           7       8 
+  chr10           7       8
   chr10           2       10
 
 Conversely, subtracting the **First dataset** from the **Second dataset** (including all columns) will result in an empty dataset.
@@ -126,6 +128,5 @@
 
   chr10           7
   chr10           2
-
-  </help>
-</tool>
\ No newline at end of file
+    ]]></help>
+</tool>
--- a/tool_dependencies.xml	Fri Dec 18 19:39:32 2015 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<tool_dependency>
-  <package name="bx-python" version="0.7.1">
-      <repository changeset_revision="35e2457234ef" name="package_bx_python_0_7" owner="devteam" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-    <package name="galaxy-ops" version="1.0.0">
-      <repository changeset_revision="60c9a7af1345" name="package_galaxy_ops_1_0_0" owner="devteam" toolshed="https://testtoolshed.g2.bx.psu.edu" />
-    </package>
-</tool_dependency>