Mercurial > repos > trinity_ctat > align_and_estimate_abundance
comparison trinityToolWrapper.py @ 6:12bc09b4a26d draft
Adding TrinityPath/util to the PATH so other utilities can be found.
| author | trinity_ctat |
|---|---|
| date | Tue, 26 Sep 2017 13:58:08 -0400 |
| parents | 98d99fed9d35 |
| children | 78d12a725443 |
comparison
equal
deleted
inserted
replaced
| 5:98d99fed9d35 | 6:12bc09b4a26d |
|---|---|
| 42 print "That path is a link." | 42 print "That path is a link." |
| 43 TrinityPath = os.path.join(os.path.dirname(TrinityPath),os.readlink(TrinityPath)) | 43 TrinityPath = os.path.join(os.path.dirname(TrinityPath),os.readlink(TrinityPath)) |
| 44 print "The new path is: {:s}".format(TrinityPath) | 44 print "The new path is: {:s}".format(TrinityPath) |
| 45 # Take off the last part of the path (which is the Trinity command) | 45 # Take off the last part of the path (which is the Trinity command) |
| 46 TRINITY_BASE_DIR = "/".join(TrinityPath.split("/")[0:-1]) | 46 TRINITY_BASE_DIR = "/".join(TrinityPath.split("/")[0:-1]) |
| 47 else: | |
| 48 print "Either set TRINITY_HOME to the trinity base directory, or ensure that directory is in the PATH." | |
| 47 | 49 |
| 48 # get bindir | 50 # get bindir |
| 49 bindir = sys.argv[0] | 51 bindir = sys.argv[0] |
| 50 bindir = bindir.split("/") | 52 bindir = bindir.split("/") |
| 51 if len(bindir) > 1: | 53 if len(bindir) > 1: |
| 54 else: | 56 else: |
| 55 bindir = "." | 57 bindir = "." |
| 56 | 58 |
| 57 | 59 |
| 58 ## add locations of tools to path setting. | 60 ## add locations of tools to path setting. |
| 59 TOOL_PATHS_FILE = bindir + "/__add_to_PATH_setting.txt"; | 61 #TOOL_PATHS_FILE = bindir + "/__add_to_PATH_setting.txt"; |
| 60 for line in open(TOOL_PATHS_FILE): | 62 #for line in open(TOOL_PATHS_FILE): |
| 61 line = line.rstrip() | 63 # line = line.rstrip() |
| 62 os.environ['PATH'] += ":" + line | 64 # os.environ['PATH'] += ":" + line |
| 65 | |
| 66 # Add TrinityPath and its utils to the PATH environment variable. | |
| 67 # print "Initially the PATH env variable is:\n\t{:s}".format(os.environ['PATH']) | |
| 68 os.environ['PATH'] = os.environ['PATH'] + ":{:s}:{:s}".format(TRINITY_BASE_DIR,TRINITY_BASE_DIR+"/util") | |
| 69 # print "Now the PATH env variable is:\n\t{:s}".format(os.environ['PATH']) | |
| 63 | 70 |
| 64 | 71 |
| 65 def stop_err( msg ): | 72 def stop_err( msg ): |
| 66 sys.stderr.write( "%s\n" % msg ) | 73 sys.stderr.write( "%s\n" % msg ) |
| 67 sys.exit() | 74 sys.exit() |
| 77 | 84 |
| 78 # If one needs to silence stdout | 85 # If one needs to silence stdout |
| 79 #args.append( ">" ) | 86 #args.append( ">" ) |
| 80 #args.append( "/dev/null" ) | 87 #args.append( "/dev/null" ) |
| 81 print "The TRINITY_BASE_DIR is:\n\t{:s}".format(TRINITY_BASE_DIR) | 88 print "The TRINITY_BASE_DIR is:\n\t{:s}".format(TRINITY_BASE_DIR) |
| 89 print "The PATH env variable is:\n\t{:s}".format(os.environ['PATH']) | |
| 82 | 90 |
| 83 args[0] = "".join([TRINITY_BASE_DIR, '/', args[0]]); | 91 args[0] = "".join([TRINITY_BASE_DIR, '/', args[0]]); |
| 84 | 92 |
| 85 cmdline = " ".join(args) | 93 cmdline = " ".join(args) |
| 86 | 94 |
