annotate SMART/Java/Python/plot.py @ 31:0ab839023fe4

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
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 """
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
33 Plot the data from the data files
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
34 """
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
35
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
36 import os, re, math
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
37 from optparse import OptionParser
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
38 from SMART.Java.Python.structure.TranscriptContainer import TranscriptContainer
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
39 from SMART.Java.Python.misc.RPlotter import RPlotter
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
40 from SMART.Java.Python.misc.Progress import Progress
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
41 from commons.core.utils.FileUtils import FileUtils
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
42
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
43 class Plot(object):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
44
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
45 def __init__(self, verbosity):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
46 self.verbosity = verbosity
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
47 self.keep = False
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
48
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
49 def keepTmpFiles(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
50 self.keep = boolean
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
51
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
52 def setShape(self, shape):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
53 self.shape = shape
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
54
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
55 def setInputFileName(self, fileName, format):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
56 self.parser = TranscriptContainer(fileName, format, self.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
57
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
58 def setXData(self, tag, default):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
59 self.x = tag
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
60 self.xDefault = default
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
61
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
62 def setYData(self, tag, default):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
63 self.y = tag
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
64 self.yDefault = default
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
65
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
66 def setZData(self, tag, default):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
67 self.z = tag
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
68 self.zDefault = default
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
69
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
70 def setNbBars(self, nbBars):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
71 self.nbBars = nbBars
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
72
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
73 def setOutputFileName(self, fileName):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
74 self.outputFileName = fileName
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
75
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
76 def setRegression(self, regression):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
77 self.regression = regression
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
78
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
79 def setLog(self, log):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
80 self.log = log
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
81
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
82 def createPlotter(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
83 self.plotter = RPlotter(self.outputFileName, self.verbosity, self.keep)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
84 if self.shape == "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
85 self.plotter.setBarplot(True)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
86 elif self.shape == "line":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
87 pass
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
88 elif self.shape == "points":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
89 self.plotter.setPoints(True)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
90 elif self.shape == "heatPoints":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
91 self.plotter.setHeatPoints(True)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
92 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
93 raise Exception("Do not understand shape '%s'\n" % (self.shape))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
94
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
95 self.plotter.setLog(self.log)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
96 self.plotter.setRegression(self.regression)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
97
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
98 def getValues(self, transcript):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
99 x = transcript.getTagValue(self.x)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
100 y = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
101 z = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
102 if self.y != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
103 y = transcript.getTagValue(self.y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
104 if self.z != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
105 z = transcript.getTagValue(self.z)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
106 if x == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
107 if self.xDefault != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
108 x = self.xDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
109 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
110 raise Exception("Error! Transcript %s do not have the x-tag %s\n" % (transcript, self.x))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
111 if self.y != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
112 if y == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
113 if self.yDefault != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
114 y = self.yDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
115 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
116 raise Exception("Error! Transcript %s do not have the y-tag %s\n" % (transcript, self.y))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
117 if self.z != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
118 if z == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
119 if self.zDefault != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
120 z = self.zDefault
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
121 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
122 raise Exception("Error! Transcript %s do not have the z-tag %s\n" % (transcript, self.z))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
123 x = float(x)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
124 if self.y != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
125 y = float(y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
126 if self.z != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
127 z = float(z)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
128 return (x, y, z)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
129
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
130 def correctPointsToBarplot(self, line):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
131 minValue = int(math.floor(min(line.keys())))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
132 maxValue = int(math.ceil(max(line.keys())))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
133 step = (maxValue - minValue) / self.nbBars
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
134 values = dict([i * step + minValue, 0] for i in range(0, self.nbBars))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
135 top = (self.nbBars - 1) * step + minValue
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
136 for key, value in line.iteritems():
18
94ab73e8a190 Uploaded
m-zytnicki
parents: 6
diff changeset
137 divisor = float(maxValue - minValue) * self.nbBars
94ab73e8a190 Uploaded
m-zytnicki
parents: 6
diff changeset
138 tmpMinValue = top
94ab73e8a190 Uploaded
m-zytnicki
parents: 6
diff changeset
139 if divisor != 0:
94ab73e8a190 Uploaded
m-zytnicki
parents: 6
diff changeset
140 tmpMinValue = min(top, int(math.floor((key - minValue) / divisor)))
94ab73e8a190 Uploaded
m-zytnicki
parents: 6
diff changeset
141 newKey = tmpMinValue * step + minValue
6
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
142 values[newKey] += value
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
143 return values
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
144
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
145 def parseFile(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
146 line = {}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
147 heatLine = {}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
148
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
149 cpt = 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
150 for transcript in self.parser.getIterator():
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
151 x, y, z = self.getValues(transcript)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
152 name = transcript.name
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
153 if name == "unnamed transcript":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
154 name = "transcript %d" % (cpt)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
155 cpt += 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
156 if self.shape in ("points", "heatPoints"):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
157 line[name] = (x, y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
158 if self.shape == "heatPoints":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
159 heatLine[name] = z
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
160 if self.shape == "line":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
161 line[x] = y
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
162 if self.shape == "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
163 line[x] = line.get(x, 0) + 1
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
164 if self.shape == "barplot":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
165 line = self.correctPointsToBarplot(line)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
166 self.plotter.setXLabel(self.x)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
167 if self.y != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
168 self.plotter.setYLabel(self.y)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
169 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
170 self.plotter.setYLabel("Count")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
171 self.plotter.addLine(line)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
172 if self.shape == "heatPoints":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
173 self.plotter.addHeatLine(heatLine)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
174 self.plotter.plot()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
175
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
176 def close(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
177 if self.regression:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
178 print self.plotter.getCorrelationData()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
179 if self.shape == "points":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
180 rho = self.plotter.getSpearmanRho()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
181 if rho == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
182 print "Cannot compute Spearman rho."
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
183 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
184 print "Spearman rho: %f" % (rho)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
185
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
186 def run(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
187 self.createPlotter()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
188 self.parseFile()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
189 self.close()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
190
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
191
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
192 if __name__ == "__main__":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
193
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
194 # parse command line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
195 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
196
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
197 parser = OptionParser(description = description)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
198 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
199 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
200 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
201 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
202 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
203 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
204 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
205 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
206 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
207 parser.add_option("-s", "--shape", dest="shape", action="store", default="barplot", type="string", help="shape of the plot [format: choice (barplot, line, points, heatPoints)]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
208 parser.add_option("-n", "--nbBars", dest="nbBars", action="store", default=2, type="int", help="number of bars in barplot [format: int]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
209 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
210 parser.add_option("-r", "--regression", dest="regression", action="store_true", default=False, help="plot regression line (in 'points' format) [format: bool]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
211 parser.add_option("-l", "--log", dest="log", action="store", default="y", type="string", help="use log on x- or y-axis (write 'x', 'y' or 'xy') [format: string]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
212 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
213 (options, args) = parser.parse_args()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
214
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
215 plot = Plot(options.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
216 plot.setInputFileName(options.inputFileName, options.format)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
217 plot.setOutputFileName(options.outputFileName)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
218 plot.setXData(options.x, options.xDefault)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
219 plot.setYData(options.y, options.yDefault)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
220 plot.setZData(options.z, options.zDefault)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
221 plot.setShape(options.shape)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
222 plot.setNbBars(options.nbBars)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
223 plot.setRegression(options.regression)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
224 plot.setLog(options.log)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
225 plot.keepTmpFiles(options.keep)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
226 plot.run()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
227