changeset 3:4cd116158aef draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/get_flanks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
author devteam
date Wed, 11 Nov 2015 12:48:31 -0500
parents 4b14d0e3a837
children 077f404ae1bb
files get_flanks.py get_flanks.xml tool_dependencies.xml
diffstat 3 files changed, 47 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/get_flanks.py	Mon Apr 14 09:18:30 2014 -0400
+++ b/get_flanks.py	Wed Nov 11 12:48:31 2015 -0500
@@ -9,15 +9,17 @@
    -o, --off=N: Offset
 """
 
-import sys, re, os
+import sys
 from bx.cookbook import doc_optparse
-from galaxy.tools.util.galaxyops import *
+from galaxy.tools.util.galaxyops import parse_cols_arg
+
 
 def stop_err( msg ):
     sys.stderr.write( msg )
     sys.exit()
 
-def main(): 
+
+def main():
     try:
         if int( sys.argv[3] ) < 0:
             raise Exception
@@ -30,26 +32,26 @@
         chr_col_1, start_col_1, end_col_1, strand_col_1 = parse_cols_arg( options.cols )
         inp_file, out_file, size, direction, region = args
         if strand_col_1 <= 0:
-            strand = "+"        #if strand is not defined, default it to +
+            strand = "+"  # if strand is not defined, default it to +
     except:
         stop_err( "Metadata issue, correct the metadata attributes by clicking on the pencil icon in the history item." )
     try:
         offset = int(options.off)
         size = int(size)
-    except:    
+    except:
         stop_err( "Invalid offset or length entered. Try again by entering valid integer values." )
 
-    fo = open(out_file,'w')
-    
+    fo = open(out_file, 'w')
+
     skipped_lines = 0
     first_invalid_line = 0
     invalid_line = None
     elems = []
-    j=0
+    j = 0
     for i, line in enumerate( file( inp_file ) ):
         line = line.strip()
         if line and (not line.startswith( '#' )) and line != '':
-            j+=1
+            j += 1
             try:
                 elems = line.split('\t')
                 #if the start and/or end columns are not numbers, skip that line.
@@ -76,15 +78,15 @@
                             elems[end_col_1] = str(int(elems[start_col_1]) + size)
                     assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                     fo.write( "%s\n" % '\t'.join( elems ) )
-                                
+
                 elif direction == 'Downstream':
                     if strand == '-':
                         if region == 'start':
-                           elems[end_col_1] = str(int(elems[end_col_1]) - offset)
-                           elems[start_col_1] = str( int(elems[end_col_1]) - size )
+                            elems[end_col_1] = str(int(elems[end_col_1]) - offset)
+                            elems[start_col_1] = str( int(elems[end_col_1]) - size )
                         else:
-                           elems[end_col_1] = str(int(elems[start_col_1]) - offset)
-                           elems[start_col_1] = str( int(elems[end_col_1]) - size )
+                            elems[end_col_1] = str(int(elems[start_col_1]) - offset)
+                            elems[start_col_1] = str( int(elems[end_col_1]) - size )
                     elif strand == '+':
                         if region == 'start':
                             elems[start_col_1] = str(int(elems[start_col_1]) + offset)
@@ -94,31 +96,31 @@
                             elems[end_col_1] = str(int(elems[start_col_1]) + size)
                     assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                     fo.write( "%s\n" % '\t'.join( elems ) )
-                    
+
                 elif direction == 'Both':
                     if strand == '-':
                         if region == 'start':
                             start = str(int(elems[end_col_1]) - offset)
                             end1 = str(int(start) + size)
                             end2 = str(int(start) - size)
-                            elems[start_col_1]=start
-                            elems[end_col_1]=end1
+                            elems[start_col_1] = start
+                            elems[end_col_1] = end1
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
-                            elems[start_col_1]=end2
-                            elems[end_col_1]=start
+                            elems[start_col_1] = end2
+                            elems[end_col_1] = start
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
                         elif region == 'end':
                             start = str(int(elems[start_col_1]) - offset)
                             end1 = str(int(start) + size)
                             end2 = str(int(start) - size)
-                            elems[start_col_1]=start
-                            elems[end_col_1]=end1
+                            elems[start_col_1] = start
+                            elems[end_col_1] = end1
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
-                            elems[start_col_1]=end2
-                            elems[end_col_1]=start
+                            elems[start_col_1] = end2
+                            elems[end_col_1] = start
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
                         else:
@@ -126,12 +128,12 @@
                             end1 = str(int(start1) + size)
                             start2 = str(int(elems[start_col_1]) - offset)
                             end2 = str(int(start2) - size)
-                            elems[start_col_1]=start1
-                            elems[end_col_1]=end1
+                            elems[start_col_1] = start1
+                            elems[end_col_1] = end1
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
-                            elems[start_col_1]=end2
-                            elems[end_col_1]=start2
+                            elems[start_col_1] = end2
+                            elems[end_col_1] = start2
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
                     elif strand == '+':
@@ -139,24 +141,24 @@
                             start = str(int(elems[start_col_1]) + offset)
                             end1 = str(int(start) - size)
                             end2 = str(int(start) + size)
-                            elems[start_col_1]=end1
-                            elems[end_col_1]=start
+                            elems[start_col_1] = end1
+                            elems[end_col_1] = start
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
-                            elems[start_col_1]=start
-                            elems[end_col_1]=end2
+                            elems[start_col_1] = start
+                            elems[end_col_1] = end2
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
                         elif region == 'end':
                             start = str(int(elems[end_col_1]) + offset)
                             end1 = str(int(start) - size)
                             end2 = str(int(start) + size)
-                            elems[start_col_1]=end1
-                            elems[end_col_1]=start
+                            elems[start_col_1] = end1
+                            elems[end_col_1] = start
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
-                            elems[start_col_1]=start
-                            elems[end_col_1]=end2
+                            elems[start_col_1] = start
+                            elems[end_col_1] = end2
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
                         else:
@@ -164,12 +166,12 @@
                             end1 = str(int(start1) - size)
                             start2 = str(int(elems[end_col_1]) + offset)
                             end2 = str(int(start2) + size)
-                            elems[start_col_1]=end1
-                            elems[end_col_1]=start1
+                            elems[start_col_1] = end1
+                            elems[end_col_1] = start1
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
-                            elems[start_col_1]=start2
-                            elems[end_col_1]=end2
+                            elems[start_col_1] = start2
+                            elems[end_col_1] = end2
                             assert int(elems[start_col_1]) > 0 and int(elems[end_col_1]) > 0
                             fo.write( "%s\n" % '\t'.join( elems ) )
             except:
@@ -183,7 +185,7 @@
         stop_err( "Data issue: click the pencil icon in the history item to correct the metadata attributes." )
     if skipped_lines > 0:
         print 'Skipped %d invalid lines starting with #%dL "%s"' % ( skipped_lines, first_invalid_line, invalid_line )
-    print 'Location: %s, Region: %s, Flank-length: %d, Offset: %d ' %( direction, region, size, offset )
-    
+    print 'Location: %s, Region: %s, Flank-length: %d, Offset: %d ' % ( direction, region, size, offset )
+
 if __name__ == "__main__":
     main()
--- a/get_flanks.xml	Mon Apr 14 09:18:30 2014 -0400
+++ b/get_flanks.xml	Wed Nov 11 12:48:31 2015 -0500
@@ -17,8 +17,8 @@
       <option value="Downstream">Downstream</option>
       <option value="Both">Both</option>
     </param>
-    <param name="offset" size="10" type="integer" value="0" label="Offset" help="Use positive values to offset co-ordinates in the direction of transcription and negative values to offset in the opposite direction."/>
-    <param name="size" size="10" type="integer" value="50" label="Length of the flanking region(s)" help="Use non-negative value for length"/>
+    <param name="offset" type="integer" value="0" label="Offset" help="Use positive values to offset co-ordinates in the direction of transcription and negative values to offset in the opposite direction."/>
+    <param name="size" type="integer" value="50" label="Length of the flanking region(s)" help="Use non-negative value for length"/>
     
     
   </inputs>
--- a/tool_dependencies.xml	Mon Apr 14 09:18:30 2014 -0400
+++ b/tool_dependencies.xml	Wed Nov 11 12:48:31 2015 -0500
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 <tool_dependency>
   <package name="bx-python" version="0.7.1">
-      <repository changeset_revision="41eb9d9f667d" name="package_bx_python_0_7" owner="devteam" prior_installation_required="False" toolshed="http://toolshed.g2.bx.psu.edu" />
+      <repository changeset_revision="2d0c08728bca" name="package_bx_python_0_7" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
     <package name="galaxy-ops" version="1.0.0">
-      <repository changeset_revision="4e39032e4ec6" name="package_galaxy_ops_1_0_0" owner="devteam" prior_installation_required="False" toolshed="http://toolshed.g2.bx.psu.edu" />
+      <repository changeset_revision="9cbb20b85c01" name="package_galaxy_ops_1_0_0" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
 </tool_dependency>