annotate Bubblebeam_For_SAINT_wrapper.py @ 29:f7b1fe03fb5b draft default tip

Uploaded
author bornea
date Fri, 29 Jan 2016 09:39:22 -0500
parents cb7223752458
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23
cb7223752458 Uploaded
bornea
parents:
diff changeset
1 #######################################################################################
cb7223752458 Uploaded
bornea
parents:
diff changeset
2 # Python-code: Bubblebeam wrapper
cb7223752458 Uploaded
bornea
parents:
diff changeset
3 # Author: Adam L Borne
cb7223752458 Uploaded
bornea
parents:
diff changeset
4 # Contributers: Paul A Stewart, Brent Kuenzi
cb7223752458 Uploaded
bornea
parents:
diff changeset
5 #######################################################################################
cb7223752458 Uploaded
bornea
parents:
diff changeset
6 # This program runs the R script that generates a bubble plot. Python script simply
cb7223752458 Uploaded
bornea
parents:
diff changeset
7 # handles arguments and interacts with Galaxy.
cb7223752458 Uploaded
bornea
parents:
diff changeset
8 #######################################################################################
cb7223752458 Uploaded
bornea
parents:
diff changeset
9 # Copyright (C) Adam Borne.
cb7223752458 Uploaded
bornea
parents:
diff changeset
10 # Permission is granted to copy, distribute and/or modify this document
cb7223752458 Uploaded
bornea
parents:
diff changeset
11 # under the terms of the GNU Free Documentation License, Version 1.3
cb7223752458 Uploaded
bornea
parents:
diff changeset
12 # or any later version published by the Free Software Foundation;
cb7223752458 Uploaded
bornea
parents:
diff changeset
13 # with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
cb7223752458 Uploaded
bornea
parents:
diff changeset
14 # A copy of the license is included in the section entitled "GNU
cb7223752458 Uploaded
bornea
parents:
diff changeset
15 # Free Documentation License".
cb7223752458 Uploaded
bornea
parents:
diff changeset
16 #######################################################################################
cb7223752458 Uploaded
bornea
parents:
diff changeset
17 ## REQUIRED INPUT ##
cb7223752458 Uploaded
bornea
parents:
diff changeset
18
cb7223752458 Uploaded
bornea
parents:
diff changeset
19 # 1) list_file: SaintExpress output file.
cb7223752458 Uploaded
bornea
parents:
diff changeset
20 # 2) prey_file: Prey file listing gene name, sequence legnth, and gene id.
cb7223752458 Uploaded
bornea
parents:
diff changeset
21 # 3) crapome: Crapome file can be created at http://crapome.org. (default = "None")
cb7223752458 Uploaded
bornea
parents:
diff changeset
22 # 4) color: Fill color of the bubbles, if set to crapome it shades based on crapome
cb7223752458 Uploaded
bornea
parents:
diff changeset
23 # potential. (default = "Red")
cb7223752458 Uploaded
bornea
parents:
diff changeset
24 # 5) cutoff: Lower limit saint score for generating bubble plot. (default = 0.8)
cb7223752458 Uploaded
bornea
parents:
diff changeset
25 # 6) mq_sc: MQ for MaxQuant data and SC for Scaffold data.
cb7223752458 Uploaded
bornea
parents:
diff changeset
26 # 7) inc_file: List of uniprot ids to be used exclusively. (default = "None")
cb7223752458 Uploaded
bornea
parents:
diff changeset
27 # 8) exc_file: List of uniprot ids to be excluded from plot. (default = "None")
cb7223752458 Uploaded
bornea
parents:
diff changeset
28 #######################################################################################
cb7223752458 Uploaded
bornea
parents:
diff changeset
29
cb7223752458 Uploaded
bornea
parents:
diff changeset
30
cb7223752458 Uploaded
bornea
parents:
diff changeset
31 import os
cb7223752458 Uploaded
bornea
parents:
diff changeset
32 import sys
cb7223752458 Uploaded
bornea
parents:
diff changeset
33 import time
cb7223752458 Uploaded
bornea
parents:
diff changeset
34
cb7223752458 Uploaded
bornea
parents:
diff changeset
35
cb7223752458 Uploaded
bornea
parents:
diff changeset
36 list_file = sys.argv[1]
cb7223752458 Uploaded
bornea
parents:
diff changeset
37 prey_file = sys.argv[2]
cb7223752458 Uploaded
bornea
parents:
diff changeset
38 crapome = sys.argv[3]
cb7223752458 Uploaded
bornea
parents:
diff changeset
39 color = sys.argv[4]
cb7223752458 Uploaded
bornea
parents:
diff changeset
40 label = sys.argv[5]
cb7223752458 Uploaded
bornea
parents:
diff changeset
41 cutoff = sys.argv[6]
cb7223752458 Uploaded
bornea
parents:
diff changeset
42 mq_sc = sys.argv[7]
cb7223752458 Uploaded
bornea
parents:
diff changeset
43 inc_file = sys.argv[8]
cb7223752458 Uploaded
bornea
parents:
diff changeset
44 exc_file = sys.argv[9]
cb7223752458 Uploaded
bornea
parents:
diff changeset
45 output_file_name = sys.argv[10]
cb7223752458 Uploaded
bornea
parents:
diff changeset
46 bub_zoom_NSAF = sys.argv[11]
cb7223752458 Uploaded
bornea
parents:
diff changeset
47 bub_zoom_SAINT = sys.argv[12]
cb7223752458 Uploaded
bornea
parents:
diff changeset
48 bub_SAINT = sys.argv[13]
cb7223752458 Uploaded
bornea
parents:
diff changeset
49 bub_NSAF = sys.argv[14]
cb7223752458 Uploaded
bornea
parents:
diff changeset
50 ins_path = sys.argv[15]
cb7223752458 Uploaded
bornea
parents:
diff changeset
51
cb7223752458 Uploaded
bornea
parents:
diff changeset
52 if crapome == "None":
cb7223752458 Uploaded
bornea
parents:
diff changeset
53 crapome = "FALSE"
cb7223752458 Uploaded
bornea
parents:
diff changeset
54
cb7223752458 Uploaded
bornea
parents:
diff changeset
55
cb7223752458 Uploaded
bornea
parents:
diff changeset
56 if label == "false":
cb7223752458 Uploaded
bornea
parents:
diff changeset
57 label = "FALSE"
cb7223752458 Uploaded
bornea
parents:
diff changeset
58 elif label == "true":
cb7223752458 Uploaded
bornea
parents:
diff changeset
59 label = "TRUE"
cb7223752458 Uploaded
bornea
parents:
diff changeset
60
29
f7b1fe03fb5b Uploaded
bornea
parents: 23
diff changeset
61 cmd = (r"Rscript "+ str(ins_path) + r"/bubbles_v9_NSAF_natural_log.R " + str(list_file) + r" "
23
cb7223752458 Uploaded
bornea
parents:
diff changeset
62 + str(prey_file) + r" " + str(crapome) + r" " + str(color) + r" " + str(label) + r" "
29
f7b1fe03fb5b Uploaded
bornea
parents: 23
diff changeset
63 + str(cutoff) + r" " + str(mq_sc) + r" " + str(inc_file) + r" " + str(exc_file))
23
cb7223752458 Uploaded
bornea
parents:
diff changeset
64 os.system(cmd)
cb7223752458 Uploaded
bornea
parents:
diff changeset
65 time.sleep(3)
cb7223752458 Uploaded
bornea
parents:
diff changeset
66
cb7223752458 Uploaded
bornea
parents:
diff changeset
67 open('./output.txt')
cb7223752458 Uploaded
bornea
parents:
diff changeset
68 os.rename('output.txt', str(output_file_name))
cb7223752458 Uploaded
bornea
parents:
diff changeset
69
cb7223752458 Uploaded
bornea
parents:
diff changeset
70 open('./bubble_zoom_NSAF.png')
cb7223752458 Uploaded
bornea
parents:
diff changeset
71 os.rename('bubble_zoom_NSAF.png', str(bub_zoom_NSAF))
cb7223752458 Uploaded
bornea
parents:
diff changeset
72
cb7223752458 Uploaded
bornea
parents:
diff changeset
73 open('./bubble_zoom_SAINT.png')
cb7223752458 Uploaded
bornea
parents:
diff changeset
74 os.rename('bubble_zoom_SAINT.png', str(bub_zoom_SAINT))
cb7223752458 Uploaded
bornea
parents:
diff changeset
75
cb7223752458 Uploaded
bornea
parents:
diff changeset
76 open('./bubble_SAINT.png')
cb7223752458 Uploaded
bornea
parents:
diff changeset
77 os.rename('bubble_SAINT.png', str(bub_SAINT))
cb7223752458 Uploaded
bornea
parents:
diff changeset
78
cb7223752458 Uploaded
bornea
parents:
diff changeset
79 open('./bubble_NSAF.png')
cb7223752458 Uploaded
bornea
parents:
diff changeset
80 os.rename('bubble_NSAF.png', str(bub_NSAF))