comparison velvetg_wrapper.py @ 0:c170448acc8a draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/velvet commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
author devteam
date Mon, 09 Nov 2015 12:02:53 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c170448acc8a
1 #!/usr/bin/env python
2
3 """
4 Classes encapsulating decypher tool.
5 James E Johnson - University of Minnesota
6 """
7 import os
8 import sys
9 import subprocess
10
11 assert sys.version_info[:2] >= ( 2, 4 )
12
13 def stop_err( msg ):
14 sys.stderr.write( "%s\n" % msg )
15 sys.exit()
16
17
18 def __main__():
19 #Parse Command Line
20 working_dir = sys.argv[1]
21 inputs = ' '.join(sys.argv[2:])
22 for _ in ('Roadmaps', 'Sequences'):
23 os.symlink(os.path.join(working_dir, _), _)
24 cmdline = 'velvetg . %s' % (inputs)
25 print "Command to be executed: %s" % cmdline
26 try:
27 proc = subprocess.Popen( args=cmdline, shell=True, stderr=subprocess.PIPE )
28 returncode = proc.wait()
29 # get stderr, allowing for case where it's very large
30 stderr = ''
31 buffsize = 1048576
32 try:
33 while True:
34 stderr += proc.stderr.read( buffsize )
35 if not stderr or len( stderr ) % buffsize != 0:
36 break
37 except OverflowError:
38 pass
39 if returncode != 0:
40 raise Exception, stderr
41 except Exception, e:
42 stop_err( 'Error running velvetg ' + str( e ) )
43
44
45 if __name__ == "__main__":
46 __main__()