annotate dotplot_runner.py @ 5:dc2aed283637 draft

Uploaded
author bornea
date Fri, 29 Jan 2016 10:14:36 -0500
parents a0b4bcf67972
children
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
4
a0b4bcf67972 Uploaded
bornea
parents: 1
diff changeset
29 FDR1 = sys.argv[2]
a0b4bcf67972 Uploaded
bornea
parents: 1
diff changeset
30 FDR2 = sys.argv[3]
a0b4bcf67972 Uploaded
bornea
parents: 1
diff changeset
31 spec_max = sys.argv[4]
a0b4bcf67972 Uploaded
bornea
parents: 1
diff changeset
32 os.rename(sys.argv[1], "saint_input.txt")
a0b4bcf67972 Uploaded
bornea
parents: 1
diff changeset
33 ins_path = sys.argv[9]
a0b4bcf67972 Uploaded
bornea
parents: 1
diff changeset
34
a0b4bcf67972 Uploaded
bornea
parents: 1
diff changeset
35
1
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
36 dirs_list = []
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
37 for (dirpath, dirnames, filename) in os.walk(str(ins_path)):
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
38 dirs_list.extend(dirnames)
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
39 break
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
40 if r"Dotplot_Release" in dirs_list:
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
41 pass
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
42 else:
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
43 cmd = r"tar -xvf /Dotplot_Release.tar.gz " + str(ins_path) + "/Dotplot_Release.tar.gz"
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
44 os.system(cmd)
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
45
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
46
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
47 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
48 r" -t " + str(FDR2) + " -m " + str(spec_max))
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
49 os.system(cmd)
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
50
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
51 cmd1 = r"cp -a ./Output_saint_input/. ."
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
52 os.system(cmd1)
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
53
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
54 os.rename("saint_input.txt", str(sys.argv[1]))
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
55 os.rename('dotplot.pdf', str(sys.argv[5]))
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
56 os.rename('bait2bait.pdf', str(sys.argv[6]))
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
57 os.rename('estimated.pdf', str(sys.argv[7]))
7e98f893e9ae Uploaded
bornea
parents:
diff changeset
58 os.rename('stats.pdf', str(sys.argv[8]))