Mercurial > repos > yufei-luo > s_mart
diff commons/launcher/launchTCoffee.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commons/launcher/launchTCoffee.py Mon Apr 29 03:20:15 2013 -0400 @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +import os +import sys +import getopt +import exceptions + +if not os.environ.has_key( "REPET_PATH" ): + print "ERROR: no environment variable REPET_PATH" + sys.exit(1) +sys.path.append( os.environ["REPET_PATH"] ) + +from pyRepet.launcher.programLauncher import programLauncher + + +def help(): + print + print "usage: ",sys.argv[0],"[ options ]" + print "options:" + print " -h: this help" + print " -i: name of the input file (format='fasta')" + print " -P: parameters" + print " -o: name of the output file (format='aligned fasta', default='inFileName'+fa_aln)" + print " -c: clean" + print " -v: verbosity level (default=0/1)" + print + + +def main(): + + inFileName = "" + parameters = "" + outFileName = "" + clean = False + verbose = 0 + + try: + opts, args = getopt.getopt(sys.argv[1:],"hi:P:o:cv:") + except getopt.GetoptError, err: + print str(err); help(); sys.exit(1) + for o,a in opts: + if o == "-h": + help(); sys.exit(0) + elif o == "-i": + inFileName = a + elif o == "-P": + parameters = a + elif o == "-o": + outFileName = a + elif o == "-c": + clean = True + elif o == "-v": + verbose = "yes" + + if inFileName == "" and parameters == "": + print "ERROR: missing compulsory options" + help() + sys.exit(1) + + if outFileName == "": + outFileName = "%s.fa_aln" % ( inFileName ) + + if verbose > 0: + print "START %s" % (sys.argv[0].split("/")[-1]) + sys.stdout.flush() + + pL = programLauncher( inFileName ) + pL.launchTcoffee( outFileName, parameters ) + + if verbose > 0: + print "END %s" % (sys.argv[0].split("/")[-1]) + sys.stdout.flush() + + return 0 + + +if __name__ == "__main__": + main()