annotate dotplot_runner.py @ 3:fcc56a8fc3a0 draft

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