changeset 3:d78f28cae91b draft default tip

"planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/pileup_interval commit 8b2095c59ecc2e94c58a42e2e04dbcecdc823dbf"
author devteam
date Fri, 15 Jan 2021 11:38:35 +0000
parents 1e897622570e
children
files pileup_interval.py pileup_interval.xml
diffstat 2 files changed, 26 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/pileup_interval.py	Tue Oct 13 12:28:06 2015 -0400
+++ b/pileup_interval.py	Fri Jan 15 11:38:35 2021 +0000
@@ -14,23 +14,17 @@
    -r, --base_column=r: Reference base column
    -C, --cvrg_column=C: Coverage column
 """
-
-from galaxy import eggs
-import pkg_resources; pkg_resources.require( "bx-python" )
-from bx.cookbook import doc_optparse
 import sys
 
-def stop_err( msg ):
-    sys.stderr.write( msg )
-    sys.exit()
+from bx.cookbook import doc_optparse
+
 
 def __main__():
-    strout = ''
-    #Parse Command Line
-    options, args = doc_optparse.parse( __doc__ )
+    # Parse Command Line
+    options, args = doc_optparse.parse(__doc__)
     coverage = int(options.coverage)
-    fin = file(options.input, 'r')
-    fout = file(options.output, 'w')
+    fin = open(options.input, 'r')
+    fout = open(options.output, 'w')
     inLine = fin.readline()
     if options.format == 'six':
         seqIndex = 0
@@ -59,20 +53,20 @@
         lineParts = inLine.split('\t')
         try:
             seq, loc, base, cov = lineParts[seqIndex], int(lineParts[locIndex]), lineParts[baseIndex], int(lineParts[covIndex])
-        except IndexError, ei:
+        except IndexError as ei:
             if options.format == 'ten':
-                stop_err( 'It appears that you have selected 10 columns while your file has 6. Make sure that the number of columns you specify matches the number in your file.\n' + str( ei ) )
+                sys.exit('It appears that you have selected 10 columns while your file has 6. Make sure that the number of columns you specify matches the number in your file.\n' + str(ei))
             else:
-                stop_err( 'There appears to be something wrong with your column index values.\n' + str( ei ) )
-        except ValueError, ev:
+                sys.exit('There appears to be something wrong with your column index values.\n' + str(ei))
+        except ValueError as ev:
             if options.format == 'six':
-                stop_err( 'It appears that you have selected 6 columns while your file has 10. Make sure that the number of columns you specify matches the number in your file.\n' + str( ev ) )
+                sys.exit('It appears that you have selected 6 columns while your file has 10. Make sure that the number of columns you specify matches the number in your file.\n' + str(ev))
             else:
-                stop_err( 'There appears to be something wrong with your column index values.\n' + str( ev ) )
+                sys.exit('There appears to be something wrong with your column index values.\n' + str(ev))
 #        strout += str(startLoc) + '\n'
 #        strout += str(bases) + '\n'
 #        strout += '%s\t%s\t%s\t%s\n' % (seq, loc, base, cov)
-        if loc == lastLoc+1 or lastLoc == -1:
+        if loc == lastLoc + 1 or lastLoc == -1:
             if cov >= coverage:
                 if seq == lastSeq or lastSeq == '':
                     if startLoc == -1:
@@ -81,19 +75,19 @@
                     bases.append(base)
                 else:
                     if len(bases) > 0:
-                        fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc-1, lastLoc, ''.join(bases)))
+                        fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc - 1, lastLoc, ''.join(bases)))
                     startLoc = loc
                     locs = [loc]
                     bases = [base]
             else:
                 if len(bases) > 0:
-                    fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc-1, lastLoc, ''.join(bases)))
+                    fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc - 1, lastLoc, ''.join(bases)))
                 startLoc = -1
                 locs = []
                 bases = []
         else:
             if len(bases) > 0:
-                fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc-1, lastLoc, ''.join(bases)))
+                fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc - 1, lastLoc, ''.join(bases)))
             if cov >= coverage:
                 startLoc = loc
                 locs = [loc]
@@ -106,12 +100,13 @@
         lastLoc = loc
         inLine = fin.readline()
     if len(bases) > 0:
-        fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc-1, lastLoc, ''.join(bases)))
+        fout.write('%s\t%s\t%s\t%s\n' % (lastSeq, startLoc - 1, lastLoc, ''.join(bases)))
     fout.close()
     fin.close()
-    
 #    import sys
 #    strout += file(fout.name,'r').read()
 #    sys.stderr.write(strout)
 
-if __name__ == "__main__" : __main__()
+
+if __name__ == "__main__":
+    __main__()
--- a/pileup_interval.xml	Tue Oct 13 12:28:06 2015 -0400
+++ b/pileup_interval.xml	Fri Jan 15 11:38:35 2021 +0000
@@ -1,7 +1,10 @@
-<tool id="pileup_interval" name="Pileup-to-Interval" version="1.0.2">
+<tool id="pileup_interval" name="Pileup-to-Interval" version="1.0.3">
+  <requirements>
+    <requirement type="package" version="0.7.1">bx-python</requirement>
+  </requirements>
   <description>condenses pileup format into ranges of bases</description>
-  <command interpreter="python">
-    pileup_interval.py 
+  <command>
+python '$__tool_directory__/pileup_interval.py'
       --input=$input 
       --output=$output 
       --coverage=$coverage