annotate EdgeR_differentialExpression_wrapper.py @ 13:8bf618c08b4d draft

Uploaded
author gkumar09
date Wed, 23 Sep 2015 15:24:26 -0400
parents cad1457c50d2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
1 import sys, os, subprocess
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
2
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
3 TRINITY_BASE_DIR = ""
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
4 if os.environ.has_key('TRINITY_HOME'):
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
5 TRINITY_BASE_DIR = os.environ['TRINITY_HOME'];
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
6 else:
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
7 sys.stderr.write("You must set the environmental variable TRINITY_BASE_DIR to the base installation directory of Trinity before running this");
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
8 sys.exit(1)
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
9
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
10 usage= "usage: " + " $counts_matrix" + " $dispersion"
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
11
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
12 if len(sys.argv)<2:
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
13 print "Require atleast two parameters"
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
14 else:
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
15 print "All good- command going ahead"
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
16 print " "
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
17
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
18 def run_command(cmd):
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
19 print "The command used: " + cmd
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
20 pipe=subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
21 pipe.wait()
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
22 ret= pipe.returncode
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
23 if ret:
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
24 print "command died: " + str(ret)
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
25 print pipe.stderr.readlines()
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
26 sys.exit(1)
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
27 else:
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
28 return
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
29 print " "
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
30
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
31 countmatrix= "counts_matrix"
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
32
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
33 cmd= "cp " + sys.argv[1] + " " + countmatrix
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
34 run_command(cmd)
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
35
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
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"
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
37
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
38 run_command(cmd)
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
39
cad1457c50d2 Uploaded
gkumar09
parents:
diff changeset
40 sys.exit(0)