changeset 2:b5df930313cc draft

planemo upload for repository https://bitbucket.org/drosofff/gedtools/
author drosofff
date Mon, 22 Jun 2015 10:39:20 -0400
parents 070f9de358fc
children f08d9c814ffb
files oases_optimiser.py oases_optimiser.sh oases_optimiser.xml tool_dependencies.xml
diffstat 4 files changed, 22 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/oases_optimiser.py	Sun Jun 21 15:05:17 2015 -0400
+++ b/oases_optimiser.py	Mon Jun 22 10:39:20 2015 -0400
@@ -17,34 +17,32 @@
     sys.stderr.write( "%s\n" % msg )
     sys.exit()
 
+def oases_optimiser(starthash, endhash, input, job_dir):
+    '''
+    Replaces call to oases_optimiser.sh. For all k-mers between
+    starthash and endhash run velvet and oases.
+    '''
+    for i in xrange(starthash, endhash, 2):
+        cmd1="velveth {0}/outputFolder_{1} {1} {2} && ".format(job_dir, i, input)
+        cmd2="velvetg {0}/outputFolder_{1} -read_trkg yes && ".format(job_dir, i)
+        cmd3="oases {0}/outputFolder_{1}".format(job_dir, i)
+        proc = subprocess.call( args=cmd1+cmd2+cmd3, shell=True, stdout=sys.stdout, stderr=sys.stderr )
+    cmd4="velveth {0}/MergedAssemblyFolder 27 -long outputFolder_*/transcripts.fa && ".format(job_dir)
+    cmd5="velvetg {0}/MergedAssemblyFolder -read_trkg yes -conserveLong yes && ".format(job_dir)
+    cmd6="oases {0}/MergedAssemblyFolder -merge yes".format(job_dir)
+    proc = subprocess.call( args=cmd4+cmd5+cmd6, shell=True, stdout=sys.stdout, stderr=sys.stderr )
+
 def __main__():
     job_dir= os.getcwd()
-    #tmp_work_dir = tempfile.mkdtemp(dir = job_dir) # make temp directory in the job_dir
     #Parse Command Line
-    starthash = sys.argv[1]
-    endhash = sys.argv[2]
-    inputs = sys.argv[3]
+    starthash = int(sys.argv[1])
+    endhash = int(sys.argv[2])
+    input = sys.argv[3]
     transcripts = sys.argv[4]
     transcripts_path = ''
-    cmdline = "oases_optimiser.sh %s %s '%s' %s  2&1>/dev/null" % (starthash, endhash, inputs, job_dir) # 2&1>/dev/null
-    print >> sys.stdout, cmdline # so will appear as blurb for file
-    print >> sys.stdout, job_dir
     print >> sys.stdout, "PATH = %s" % (os.environ['PATH'])
     try:
-        proc = subprocess.Popen( args=cmdline, shell=True, stderr=subprocess.PIPE ) #  cwd=job_dir
-        returncode = proc.wait()
-        # get stderr, allowing for case where it's very large
-        stderr = ''
-        buffsize = 1048576
-        try:
-            while True:
-                stderr += proc.stderr.read( buffsize )
-                if not stderr or len( stderr ) % buffsize != 0:
-                    break
-        except OverflowError:
-            pass
-        if returncode != 0:
-            raise Exception, stderr
+        oases_optimiser(starthash, endhash, input, job_dir)
     except Exception, e:
         stop_err( 'Error running oases_optimiser.py' + str( e ) )
     out = open(transcripts,'w')
--- a/oases_optimiser.sh	Sun Jun 21 15:05:17 2015 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-min_k=$1
-max_k=$2
-input=$3
-job_dir=$4
-
-for i in `seq $min_k 2 $max_k`
-do
-     velveth $job_dir/outputFolder_$i $i $input
-     velvetg $job_dir/outputFolder_$i -read_trkg yes
-     oases $job_dir/outputFolder_$i
-done
-
-velveth $job_dir/MergedAssemblyFolder 27 -long outputFolder_*/transcripts.fa
-velvetg $job_dir/MergedAssemblyFolder -read_trkg yes -conserveLong yes
-oases $job_dir/MergedAssemblyFolder -merge yes
-
--- a/oases_optimiser.xml	Sun Jun 21 15:05:17 2015 -0400
+++ b/oases_optimiser.xml	Mon Jun 22 10:39:20 2015 -0400
@@ -1,8 +1,6 @@
-<tool id="oasesoptimiserv" name="Oases_optimiser" version="1.1.0">
+<tool id="oasesoptimiserv" name="Oases_optimiser" version="1.1.3">
 	<description>Auto optimise de novo RNA-seq Oases/Velvet assembly</description>
         <requirements>
-                <requirement type="package" version="1.2.10_9adf09f7ded7fedaf6b0e5e4edf9f46602e263d3">velvet</requirement>
-                <requirement type="set_environment">PATH</requirement>
                 <requirement type="package" version="0.2.08_7a32460a60929b510037952ae815bb6e29b68123">oases</requirement>
         </requirements>
 	<command interpreter="python">
--- a/tool_dependencies.xml	Sun Jun 21 15:05:17 2015 -0400
+++ b/tool_dependencies.xml	Mon Jun 22 10:39:20 2015 -0400
@@ -1,16 +1,6 @@
 <?xml version="1.0"?>
 <tool_dependency>
-  <set_environment version="1.0">
-    <environment_variable action="prepend_to" name="PATH">$REPOSITORY_INSTALL_DIR</environment_variable>
-  </set_environment>
-  <package name="velvet" version="1.2.10_9adf09f7ded7fedaf6b0e5e4edf9f46602e263d3">
-      <repository changeset_revision="b3e2c0f12e11" name="package_ged_velvet" owner="drosofff" toolshed="https://toolshed.g2.bx.psu.edu" />
+    <package name="oases" version="0.2.08_7a32460a60929b510037952ae815bb6e29b68123">
+      <repository changeset_revision="76e8c94ea259" name="package_ged_oases" owner="drosofff" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
-    <package name="oases" version="0.2.08_7a32460a60929b510037952ae815bb6e29b68123">
-      <repository changeset_revision="853ebf512cc7" name="package_ged_oases" owner="drosofff" toolshed="https://toolshed.g2.bx.psu.edu" />
-    </package>
-    <action type="set_environment">
-      <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR</environment_variable>
-      <environment_variable action="prepend_to" name="PATH">$REPOSITORY_INSTALL_DIR</environment_variable>
-    </action>
 </tool_dependency>