annotate selection.py @ 6:7dc6ce39fb89 default tip

add selection tool
author blanck
date Wed, 29 Apr 2015 10:08:52 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
1 import os
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
2 import sys
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
3 import subprocess
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
4 import shutil
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
5
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
6 def main():
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
7
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
8 input_file=sys.argv[1]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
9 tmp_dir=sys.argv[4]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
10 script_dir=os.path.dirname(os.path.abspath(__file__))
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
11 plot=sys.argv[11]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
12 pdffigures=sys.argv[13]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
13 outputlog=sys.argv[14]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
14 log=sys.argv[15]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
15 user=sys.argv[16]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
16 package=sys.argv[17]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
17
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
18 iFile=open(input_file,'r')
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
19 dataSetLine=iFile.readline()
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
20 dataset=dataSetLine.split("\t")[1]
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
21 iFile.close()
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
22
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
23 if (outputlog=="TRUE"):
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
24 errfile=open(log,'w')
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
25 else:
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
26 errfile=open(os.path.join(tmp_dir,"errfile.log"),'w')
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
27
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
28 retcode=subprocess.call(["Rscript", os.path.join(script_dir,"selection.R"), dataset, sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6], sys.argv[7], sys.argv[8], sys.argv[9], sys.argv[10], sys.argv[11], sys.argv[12],sys.argv[16],package], stdout = errfile, stderr = errfile)
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
29
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
30 if (plot=="TRUE"):
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
31 shutil.copy(os.path.join(tmp_dir,"mpagenomics",user,"Rplots.pdf"), pdffigures)
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
32
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
33 errfile.close()
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
34
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
35 sys.exit(retcode)
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
36
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
37 if __name__ == "__main__":
7dc6ce39fb89 add selection tool
blanck
parents:
diff changeset
38 main()