annotate ProHits_DotPlot_Generator.py @ 21:cfac73f960c8 draft

Uploaded
author bornea
date Thu, 14 Apr 2016 16:34:43 -0400
parents 3555f2c0d325
children 63cc1f29a57b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
1 #######################################################################################
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
2 # Python-code: Dotplot Runner
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
3 # Author: Adam L Borne
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
4 # Contributers: Paul A Stewart, Brent Kuenzi
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
5 #######################################################################################
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
6 # This script runs the dotplot program found at http://prohitstools.mshri.on.ca/.
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
7 #######################################################################################
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
8 # Copyright (C) Adam Borne.
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
9 # Permission is granted to copy, distribute and/or modify this document
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
10 # under the terms of the GNU Free Documentation License, Version 1.3
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
11 # or any later version published by the Free Software Foundation;
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
12 # with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
13 # A copy of the license is included in the section entitled "GNU
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
14 # Free Documentation License".
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
15 #######################################################################################
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
16 ## REQUIRED INPUT ##
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
17
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
18 # 1) list_file: SaintExpress output file.
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
19 # 2) FDR1: Primary false discovery rate. (default = 0.01)
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
20 # 3) FDR2: Secondary false discovery rate. (default = 0.025)
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
21 # 4) spec_max: Maximum spectral count. (default = 50)
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
22 #######################################################################################
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
23
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
24 import os
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
25 import sys
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
26
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
27
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
28 FDR1 = sys.argv[2]
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
29 FDR2 = sys.argv[3]
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
30 spec_max = sys.argv[4]
21
cfac73f960c8 Uploaded
bornea
parents: 20
diff changeset
31 os.rename(sys.argv[1], "saint_input.txt")
14
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
32 ins_path = sys.argv[9]
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
33
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
34 dirs_list = []
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
35 for (dirpath, dirnames, filename) in os.walk(str(ins_path)):
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
36 dirs_list.extend(dirnames)
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
37 break
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
38 if r"Dotplot_Release" in dirs_list:
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
39 pass
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
40 else:
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
41 cmd = r"tar -xvf /Dotplot_Release.tar.gz " + str(ins_path) + "/Dotplot_Release.tar.gz"
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
42 os.system(cmd)
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
43
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
44
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
45 cmd = (str(ins_path) + r"Dotplot_Release/dotplot.bash -f saint_input.txt" + r" -c b -s " + str(FDR1) +
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
46 r" -t " + str(FDR2) + " -m " + str(spec_max))
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
47 os.system(cmd)
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
48
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
49 cmd1 = r"cp -a ./Output_saint_input/. ."
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
50 os.system(cmd1)
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
51
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
52 os.rename("saint_input.txt", str(sys.argv[1]))
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
53 os.rename('dotplot.pdf', str(sys.argv[5]))
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
54 os.rename('bait2bait.pdf', str(sys.argv[6]))
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
55 os.rename('estimated.pdf', str(sys.argv[7]))
d458f5c875f1 Uploaded
bornea
parents:
diff changeset
56 os.rename('stats.pdf', str(sys.argv[8]))