0
|
1 import sys, os, subprocess
|
|
2
|
|
3 TRINITY_BASE_DIR = ""
|
|
4 if os.environ.has_key('TRINITY_HOME'):
|
|
5 TRINITY_BASE_DIR = os.environ['TRINITY_HOME'];
|
|
6 else:
|
|
7 sys.stderr.write("You must set the environmental variable TRINITY_BASE_DIR to the base installation directory of Trinity before running this");
|
|
8 sys.exit(1)
|
|
9
|
|
10 usage= "usage: " + " $counts_matrix" + " $dispersion"
|
|
11
|
|
12 if len(sys.argv)<2:
|
|
13 print "Require atleast two parameters"
|
|
14 else:
|
|
15 print "All good- command going ahead"
|
|
16 print " "
|
|
17
|
|
18 def run_command(cmd):
|
|
19 print "The command used: " + cmd
|
|
20 pipe=subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
|
|
21 pipe.wait()
|
|
22 ret= pipe.returncode
|
|
23 if ret:
|
|
24 print "command died: " + str(ret)
|
|
25 print pipe.stderr.readlines()
|
|
26 sys.exit(1)
|
|
27 else:
|
|
28 return
|
|
29 print " "
|
|
30
|
|
31 countmatrix= "counts_matrix"
|
|
32
|
|
33 cmd= "cp " + sys.argv[1] + " " + countmatrix
|
|
34 run_command(cmd)
|
|
35
|
|
36 cmd= TRINITY_BASE_DIR + "/Analysis/DifferentialExpression/run_DE_analysis.pl "+ " --matrix "+ countmatrix + " --method edgeR " + " --output edgeR_results "+ " --dispersion " + sys.argv[2] + " --tar_gz_outdir"
|
|
37
|
|
38 run_command(cmd)
|
|
39
|
|
40 sys.exit(0)
|