Mercurial > repos > devteam > velvet
view 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 |
line wrap: on
line source
#!/usr/bin/env python """ Classes encapsulating decypher tool. James E Johnson - University of Minnesota """ import os import sys import subprocess assert sys.version_info[:2] >= ( 2, 4 ) def stop_err( msg ): sys.stderr.write( "%s\n" % msg ) sys.exit() def __main__(): #Parse Command Line working_dir = sys.argv[1] inputs = ' '.join(sys.argv[2:]) for _ in ('Roadmaps', 'Sequences'): os.symlink(os.path.join(working_dir, _), _) cmdline = 'velvetg . %s' % (inputs) print "Command to be executed: %s" % cmdline try: proc = subprocess.Popen( args=cmdline, shell=True, stderr=subprocess.PIPE ) 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 except Exception, e: stop_err( 'Error running velvetg ' + str( e ) ) if __name__ == "__main__": __main__()