annotate SMART/Java/Python/plotTranscriptList.py @ 44:5f796c5c579f

Uploaded
author m-zytnicki
date Wed, 18 Sep 2013 08:32:38 -0400
parents 769e306b7933
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
1 #! /usr/bin/env python
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
2 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
3 # Copyright INRA-URGI 2009-2010
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
4 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
5 # This software is governed by the CeCILL license under French law and
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
6 # abiding by the rules of distribution of free software. You can use,
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
7 # modify and/ or redistribute the software under the terms of the CeCILL
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
8 # license as circulated by CEA, CNRS and INRIA at the following URL
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
9 # "http://www.cecill.info".
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
10 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
11 # As a counterpart to the access to the source code and rights to copy,
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
12 # modify and redistribute granted by the license, users are provided only
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
13 # with a limited warranty and the software's author, the holder of the
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
14 # economic rights, and the successive licensors have only limited
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
15 # liability.
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
16 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
17 # In this respect, the user's attention is drawn to the risks associated
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
18 # with loading, using, modifying and/or developing or reproducing the
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
19 # software by the user in light of its specific status of free software,
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
20 # that may mean that it is complicated to manipulate, and that also
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
21 # therefore means that it is reserved for developers and experienced
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
22 # professionals having in-depth computer knowledge. Users are therefore
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
23 # encouraged to load and test the software's suitability as regards their
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
24 # requirements in conditions enabling the security of their systems and/or
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
25 # data to be ensured and, more generally, to use and operate it in the
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
26 # same conditions as regards security.
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
27 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
28 # The fact that you are presently reading this means that you have had
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
29 # knowledge of the CeCILL license and that you accept its terms.
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
30 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
31 """
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
32 Plot the data from the data files
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
33 """
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
34 import sys
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
35 import math
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
36 from optparse import OptionParser
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
37 from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
38 from SMART.Java.Python.misc.RPlotter import RPlotter
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
39
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
40
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
41 class PlotTranscriptList(object):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
42
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
43 def __init__(self, verbosity = 0):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
44 self.inputFileName = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
45 self.format = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
46 self.x = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
47 self.y = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
48 self.z = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
49 self.xDefault = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
50 self.yDefault = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
51 self.zDefault = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
52 self.xLabel = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
53 self.yLabel = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
54 self.shape = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
55 self.bucket = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
56 self.keep = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
57 self.log = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
58 self.verbosity = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
59
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
60
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
61 def setPlotter(self, outputFileName, keep, log, xLabel, yLabel):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
62 self.plotter = RPlotter(outputFileName, self.verbosity, keep)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
63 if self.shape != "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
64 self.plotter.setLog(log)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
65 self.plotter.setXLabel(xLabel)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
66 self.plotter.setYLabel(yLabel)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
67
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
68
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
69 def setShape(self, shape):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
70 if self.shape == "line":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
71 pass
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
72 elif shape == "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
73 self.plotter.setBarplot(True)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
74 elif shape == "points":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
75 self.plotter.setPoints(True)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
76 elif shape == "heatPoints":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
77 self.plotter.setHeatPoints(True)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
78 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
79 sys.exit("Do not understand shape '%s'" % (shape))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
80
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
81
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
82 def setInput(self, inputFileName, format):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
83 self.parser = TranscriptContainer(inputFileName, format, self.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
84
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
85
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
86 def getValues(self, transcript):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
87 x, y, z = None, None, None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
88 x = transcript.getTagValue(self.x)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
89 if self.y != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
90 y = transcript.getTagValue(self.y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
91 if self.z != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
92 z = transcript.getTagValue(self.z)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
93 if x == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
94 if self.xDefault != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
95 x = self.xDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
96 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
97 sys.exit("Error! Transcript %s do not have the x-tag %s" % (transcript, self.x))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
98 if y == None and self.shape != "line" and self.shape != "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
99 if self.yDefault != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
100 y = self.yDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
101 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
102 sys.exit("Error! Transcript %s do not have the y-tag %s" % (transcript, self.y))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
103 if self.z != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
104 if z == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
105 if self.zDefault != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
106 z = self.zDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
107 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
108 sys.exit("Error! Transcript %s do not have the z-tag %s" % (transcript, self.z))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
109 x = float(x)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
110 if self.y != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
111 y = float(y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
112 if self.z != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
113 z = float(z)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
114 return (x, y, z)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
115
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
116
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
117 def readFile(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
118 cpt = 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
119 line = {}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
120 heatLine = {}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
121 for transcript in self.parser.getIterator():
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
122 x, y, z = self.getValues(transcript)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
123
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
124 name = transcript.name
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
125 if name == "unnamed transcript":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
126 name = "transcript %d" % (cpt)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
127 cpt += 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
128 if self.shape == "points":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
129 line[name] = (x, y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
130 elif self.shape == "heatPoints":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
131 line[name] = (x, y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
132 heatLine[name] = z
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
133 elif self.shape == "line" or self.shape == "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
134 if x not in line:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
135 line[x] = 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
136 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
137 line[x] += 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
138 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
139 sys.exit("Do not understand shape '%s'" % (self.shape))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
140 return line, heatLine
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
141
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
142
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
143 def putLineInBuckets(self, line):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
144 tmpLine = line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
145 line = {}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
146 for key, value in tmpLine.iteritems():
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
147 line[int(key / float(self.bucket)) * self.bucket] = value
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
148 return line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
149
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
150
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
151 def clusterInBarplot(self, line):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
152 nbZeros = 0
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
153 minValue = min(line.keys())
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
154 maxValue = max(line.keys())
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
155 if self.log != "":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
156 if minValue == 0:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
157 minValue = 1000000000
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
158 for value in line:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
159 if value < minValue:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
160 if value == 0:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
161 nbZeros += 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
162 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
163 minValue = value
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
164 minValue = math.log(minValue)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
165 maxValue = math.log(maxValue)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
166 bucketSize = (maxValue - minValue) / self.bucket
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
167 tmpLine = line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
168 line = {}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
169 for i in range(int(self.bucket) + 1):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
170 line[i * bucketSize + minValue] = 0
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
171 for key, value in tmpLine.iteritems():
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
172 if self.log != "" and key != 0:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
173 key = math.log(key)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
174 bucketKey = int((key - minValue) / bucketSize) * bucketSize + minValue
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
175 if self.log == "" or key != 0:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
176 line[bucketKey] += value
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
177 # if self.log != "":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
178 # tmpLine = line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
179 # line = {}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
180 # for key, value in tmpLine.iteritems():
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
181 # line[math.exp(key)] = value
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
182 print "%d zeros have been removed" % (nbZeros)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
183 return line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
184
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
185
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
186 def getSpearmanRho(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
187 rho = self.plotter.getSpearmanRho()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
188 if rho == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
189 print "Cannot compute Spearman rho."
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
190 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
191 print "Spearman rho: %f" % (rho)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
192
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
193
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
194 def run(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
195 line, heatLine = self.readFile()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
196
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
197 if self.shape == "line" and self.bucket != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
198 line = self.putLineInBuckets(line)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
199 if self.shape == "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
200 line = self.clusterInBarplot(line)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
201
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
202 if self.shape == "points" or self.shape == "barplot" or self.shape == "line":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
203 self.plotter.addLine(line)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
204 elif self.shape == "heatPoints":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
205 self.plotter.addLine(line)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
206 self.plotter.addHeatLine(heatLine)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
207 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
208 sys.exit("Do not understand shape '%s'" % (self.shape))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
209
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
210 self.plotter.plot()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
211
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
212 if self.shape == "points" or self.shape == "heatPoints":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
213 self.getSpearmanRho()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
214
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
215
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
216
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
217 if __name__ == "__main__":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
218
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
219 # parse command line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
220 description = "Plot v1.0.2: Plot some information from a list of transcripts. [Category: Visualization]"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
221
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
222 parser = OptionParser(description = description)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
223 parser.add_option("-i", "--input",dest="inputFileName", action="store", type="string", help="input file [compulsory] [format: file in transcript format given by -f]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
224 parser.add_option("-f", "--format",dest="format", action="store",type="string", help="format of the input [compulsory] [format: transcript file format]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
225 parser.add_option("-x", "--x",dest="x",action="store", type="string", help="tag for the x value [format: string]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
226 parser.add_option("-y", "--y",dest="y",action="store", type="string", help="tag for the y value [format: string]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
227 parser.add_option("-z", "--z",dest="z", action="store", default=None,type="string", help="tag for the z value [format: string]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
228 parser.add_option("-X", "--xDefault",dest="xDefault",action="store", default=None,type="float",help="value for x when tag is not present [format: float]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
229 parser.add_option("-Y", "--yDefault",dest="yDefault",action="store",default=None,type="float",help="value for y when tag is not present [format: float]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
230 parser.add_option("-Z", "--zDefault",dest="zDefault", action="store",default=None,type="float",help="value for z when tag is not present [format: float]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
231 parser.add_option("-n", "--xLabel",dest="xLabel",action="store",default="",type="string", help="label on the x-axis [format: string] [default: ]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
232 parser.add_option("-m", "--yLabel",dest="yLabel",action="store",default="", type="string", help="label on the y-axis [format: string] [default: ]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
233 parser.add_option("-o", "--output",dest="outputFileName",action="store",type="string", help="output file names [format: output file in PNG format]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
234 parser.add_option("-s", "--shape",dest="shape",action="store", type="string", help="shape of the plot [format: choice (barplot, line, points, heatPoints)]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
235 parser.add_option("-b", "--bucket",dest="bucket",action="store",default=None,type="float",help="bucket size (for the line plot) [format: int] [default: 1]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
236 parser.add_option("-k", "--keep",dest="keep",action="store_true", default=False, help="keep temporary files [format: bool]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
237 parser.add_option("-l", "--log",dest="log",action="store",default="",type="string", help="use log on x- or y-axis (write 'x', 'y' or 'xy') [format: string] [default: ]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
238 parser.add_option("-v", "--verbosity",dest="verbosity",action="store",default=1, type="int",help="trace level [format: int]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
239 (options, args) = parser.parse_args()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
240
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
241 plotTranscriptList = PlotTranscriptList(options.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
242 plotTranscriptList.x = options.x
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
243 plotTranscriptList.y = options.y
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
244 plotTranscriptList.z = options.z
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
245 plotTranscriptList.xDefault = options.xDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
246 plotTranscriptList.yDefault = options.yDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
247 plotTranscriptList.zDefault = options.zDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
248 plotTranscriptList.shape = options.shape
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
249 plotTranscriptList.bucket = options.bucket
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
250 plotTranscriptList.log = options.log
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
251 plotTranscriptList.setPlotter(options.outputFileName, options.keep, options.log, options.xLabel, options.yLabel)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
252 plotTranscriptList.setShape(options.shape)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
253 plotTranscriptList.setInput(options.inputFileName, options.format)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
254 plotTranscriptList.run()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
255