comparison analyze_diff_exp_wrapper.py @ 5:dab3b085f23d draft

Adding more debugging statements.
author trinity_ctat
date Mon, 02 Oct 2017 14:39:03 -0400
parents 08f897c2b57e
children 59999c716930
comparison
equal deleted inserted replaced
4:08f897c2b57e 5:dab3b085f23d
57 57
58 def run_command(cmd): 58 def run_command(cmd):
59 # 2017-10-02 59 # 2017-10-02
60 # Cicada Dennis put the subprocess command in a try/except statement. 60 # Cicada Dennis put the subprocess command in a try/except statement.
61 # Errors were going undetected the way it was written previously. 61 # Errors were going undetected the way it was written previously.
62 print "Running command:\n\t" + cmd
62 try: 63 try:
63 pipe = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE) 64 pipe = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
64 cmd_stdout, cmd_stderr = pipe.communicate() 65 cmd_stdout, cmd_stderr = pipe.communicate()
65 except: 66 except:
66 msg = "ERROR while running command:\n\t" + cmd 67 msg = "ERROR while running command:\n\t" + cmd
72 if ret: 73 if ret:
73 print "command died: " + str(ret) 74 print "command died: " + str(ret)
74 sys.stderr.write(cmd_stderr) 75 sys.stderr.write(cmd_stderr)
75 sys.exit(ret) 76 sys.exit(ret)
76 else: 77 else:
77 # Any error output written to stdout instead of stderr, since no error has occurred. 78 # Any error output is written to stdout instead of stderr, since no error has occurred.
78 sys.stderr.write(cmd_stderr) 79 sys.stderr.write(cmd_stderr)
79 return 80 return
80 81
81 print "" 82 print ""
82 Final_tar_gz= "edgeR.tar.gz" 83 Final_tar_gz= "edgeR.tar.gz"
83 run_command("cp "+ sys.argv[1] + " " + Final_tar_gz) 84 run_command("cp "+ sys.argv[1] + " " + Final_tar_gz)
84 run_command("tar -xzvf " + Final_tar_gz) 85 run_command("tar -xvf " + Final_tar_gz)
85 run_command("mv " + "edgeR_results" + "/* ." )
86 86
87 print "" 87 print "Before moving files."
88 run_command("pwd") 88 run_command("pwd")
89 run_command("ls -lad ./*") 89 run_command("ls -lad ./*")
90 print "\nedgeR_results/" 90 print "\nedgeR_results/"
91 run_command("ls -la edgeR_results") 91 run_command("ls -la edgeR_results")
92 print ""
93
94 run_command("mv edgeR_results /* ." )
95
96 print "After moving files."
97 run_command("pwd")
98 run_command("ls -lad ./*")
99 print "\nedgeR_results/"
100 run_command("ls -la edgeR_results")
101 print ""
92 102
93 # run the analyze command 103 # run the analyze command
94 cmd= TRINITY_BASE_DIR + "/Analysis/DifferentialExpression/analyze_diff_expr.pl "+ "--matrix " + Normalized_Matrix + " -P " + Pvalue + " -C " + Cvalue 104 cmd= TRINITY_BASE_DIR + "/Analysis/DifferentialExpression/analyze_diff_expr.pl "+ "--matrix " + Normalized_Matrix + " -P " + Pvalue + " -C " + Cvalue
95 run_command(cmd) 105 run_command(cmd)
96 106