comparison APOSTL_Static_Bubblegraph_Generator.py @ 6:66faf09e5e8e draft

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