Mercurial > repos > yufei-luo > s_mart
comparison commons/launcher/launchTCoffee.py @ 18:94ab73e8a190
Uploaded
| author | m-zytnicki | 
|---|---|
| date | Mon, 29 Apr 2013 03:20:15 -0400 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 17:b0e8584489e6 | 18:94ab73e8a190 | 
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 import os | |
| 4 import sys | |
| 5 import getopt | |
| 6 import exceptions | |
| 7 | |
| 8 if not os.environ.has_key( "REPET_PATH" ): | |
| 9 print "ERROR: no environment variable REPET_PATH" | |
| 10 sys.exit(1) | |
| 11 sys.path.append( os.environ["REPET_PATH"] ) | |
| 12 | |
| 13 from pyRepet.launcher.programLauncher import programLauncher | |
| 14 | |
| 15 | |
| 16 def help(): | |
| 17 print | |
| 18 print "usage: ",sys.argv[0],"[ options ]" | |
| 19 print "options:" | |
| 20 print " -h: this help" | |
| 21 print " -i: name of the input file (format='fasta')" | |
| 22 print " -P: parameters" | |
| 23 print " -o: name of the output file (format='aligned fasta', default='inFileName'+fa_aln)" | |
| 24 print " -c: clean" | |
| 25 print " -v: verbosity level (default=0/1)" | |
| 26 print | |
| 27 | |
| 28 | |
| 29 def main(): | |
| 30 | |
| 31 inFileName = "" | |
| 32 parameters = "" | |
| 33 outFileName = "" | |
| 34 clean = False | |
| 35 verbose = 0 | |
| 36 | |
| 37 try: | |
| 38 opts, args = getopt.getopt(sys.argv[1:],"hi:P:o:cv:") | |
| 39 except getopt.GetoptError, err: | |
| 40 print str(err); help(); sys.exit(1) | |
| 41 for o,a in opts: | |
| 42 if o == "-h": | |
| 43 help(); sys.exit(0) | |
| 44 elif o == "-i": | |
| 45 inFileName = a | |
| 46 elif o == "-P": | |
| 47 parameters = a | |
| 48 elif o == "-o": | |
| 49 outFileName = a | |
| 50 elif o == "-c": | |
| 51 clean = True | |
| 52 elif o == "-v": | |
| 53 verbose = "yes" | |
| 54 | |
| 55 if inFileName == "" and parameters == "": | |
| 56 print "ERROR: missing compulsory options" | |
| 57 help() | |
| 58 sys.exit(1) | |
| 59 | |
| 60 if outFileName == "": | |
| 61 outFileName = "%s.fa_aln" % ( inFileName ) | |
| 62 | |
| 63 if verbose > 0: | |
| 64 print "START %s" % (sys.argv[0].split("/")[-1]) | |
| 65 sys.stdout.flush() | |
| 66 | |
| 67 pL = programLauncher( inFileName ) | |
| 68 pL.launchTcoffee( outFileName, parameters ) | |
| 69 | |
| 70 if verbose > 0: | |
| 71 print "END %s" % (sys.argv[0].split("/")[-1]) | |
| 72 sys.stdout.flush() | |
| 73 | |
| 74 return 0 | |
| 75 | |
| 76 | |
| 77 if __name__ == "__main__": | |
| 78 main() | 
