annotate SMART/Java/Python/getDistance.py @ 24:452e051f6562

Deleted selected files
author m-zytnicki
date Mon, 29 Apr 2013 03:28:24 -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 """Get the distance between the transcripts of two lists"""
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
32
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
33 import os
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
34 import sys
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
35 from optparse import OptionParser
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
36 from SMART.Java.Python.structure.TranscriptListsComparator import TranscriptListsComparator
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 from commons.core.writer.Gff3Writer import Gff3Writer
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
40
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
41 class GetDistance(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.verbosity = verbosity
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
45 self.writer = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
46 self.spearman = False
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
47 self.tlc = TranscriptListsComparator(None, self.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
48 self.strands = (0, )
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
49 self.buckets = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
50 self.title = ""
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
51 self.xMin = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
52 self.xMax = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
53 self.proportion = False
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
54 self.outputFileName = None
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
55 self.keep = False
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
56
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
57 def __del__(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
58 pass
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
59
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
60 def setQueryFile(self, fileName, format):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
61 self.transcriptContainer1 = TranscriptContainer(fileName, format, self.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
62
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
63 def setReferenceFile(self, fileName, format):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
64 self.transcriptContainer2 = TranscriptContainer(fileName, format, self.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
65
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
66 def setOutputFile(self, fileName):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
67 self.outputFileName = fileName
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
68
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
69 def setOutputTranscriptFile(self, fileName):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
70 if fileName != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
71 self.writer = Gff3Writer(fileName, self.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
72
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
73 def restrictQueryToStart(self, number):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
74 self.tlc.restrictToStart(self.tlc.QUERY, number)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
75
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
76 def restrictReferenceToStart(self, number):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
77 self.tlc.restrictToStart(self.tlc.REFERENCE, number)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
78
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
79 def restrictQueryToEnd(self, number):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
80 self.tlc.restrictToEnd(self.tlc.QUERY, number)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
81
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
82 def restrictReferenceToEnd(self, number):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
83 self.tlc.restrictToEnd(self.tlc.REFERENCE, number)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
84
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
85 def setAbsolute(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
86 self.tlc.setAbsolute(boolean)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
87
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
88 def setProportion(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
89 self.proportion = boolean
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
90
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
91 def setColinear(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
92 self.tlc.getColinearOnly(boolean)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
93
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
94 def setAntisense(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
95 self.tlc.getAntisenseOnly(boolean)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
96
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
97 def setDistances(self, minDistance, maxDistance):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
98 self.tlc.setMinDistance(minDistance)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
99 self.tlc.setMaxDistance(maxDistance)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
100
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
101 def setStrands(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
102 self.tlc.setStrandedDistance(boolean)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
103 if boolean:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
104 self.strands = (-1, 1)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
105
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
106 def setUpstream(self, number):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
107 self.tlc.setUpstream(self.tlc.REFERENCE, number)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
108
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
109 def setDownstream(self, number):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
110 self.tlc.setDownstream(self.tlc.REFERENCE, number)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
111
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
112 def setBuckets(self, number):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
113 self.buckets = number
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
114
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
115 def setTitle(self, title):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
116 self.title = title
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
117
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
118 def setXValues(self, xMin, xMax):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
119 self.xMin, self.xMax = xMin, xMax
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
120
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
121 def keepTmpValues(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
122 self.keep = boolean
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
123
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
124 def getSpearman(self, boolean):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
125 self.spearman = True
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
126
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
127 def compare(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
128 self.tlc.setInputTranscriptContainer(self.tlc.QUERY, self.transcriptContainer1)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
129 self.tlc.setInputTranscriptContainer(self.tlc.REFERENCE, self.transcriptContainer2)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
130 self.tlc.setOutputWriter(self.writer)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
131 self.distances = self.tlc.compareTranscriptListDistance()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
132
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
133 def checkEmptyDistances(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
134 return (sum([len(self.distances[strand].keys()) for strand in self.strands]) == 0)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
135
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
136 def setPlotterMinusStrand(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
137 if -1 in self.strands:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
138 for x, y in self.distances[-1].iteritems():
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
139 self.distances[-1][x] = -y
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
140
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
141 def setPlotterProportion(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
142 if not self.proportion:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
143 return
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
144 self.nbElements = sum([abs(sum(self.distances[strand].values())) for strand in self.strands])
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
145 for strand in self.strands:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
146 self.distances[strand] = dict([(distance, float(nb) / self.nbElements * 100) for distance, nb in self.distances[strand].iteritems()])
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
147
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
148 def setPlotter(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
149 self.plotter = RPlotter(self.outputFileName, self.verbosity, self.keep)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
150 if self.buckets != None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
151 self.plotter.setBarplot(True)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
152 self.plotter.setFill(0)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
153 self.plotter.setXLabel("distance")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
154 self.plotter.setYLabel("# elements")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
155 if self.proportion:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
156 self.plotter.setYLabel("%% elements (%d in toto)" % (self.nbElements))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
157 self.plotter.setBuckets(self.buckets)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
158 self.plotter.setMinimumX(self.xMin)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
159 self.plotter.setMaximumX(self.xMax)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
160 self.plotter.setTitle(self.title)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
161
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
162 def plot(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
163 if len(self.strands) == 1:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
164 self.distances = {0: self.distances}
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
165 if self.checkEmptyDistances():
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
166 print "No output."
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
167 sys.exit()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
168 self.setPlotterMinusStrand()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
169 self.setPlotterProportion()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
170 if self.outputFileName == None:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
171 return
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
172 self.setPlotter()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
173 for strand in self.strands:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
174 self.plotter.addLine(self.distances[strand])
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
175 self.plotter.plot()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
176
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
177 def printSpearman(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
178 if self.spearman:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
179 print "Spearman's rho: %.5f" % (self.plotter.getSpearmanRho())
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
180
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
181 def run(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
182 self.compare()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
183 self.plot()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
184 self.printSpearman()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
185
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
186 if __name__ == "__main__":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
187
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
188 # parse command line
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
189 description = "Get Distance v1.0.3: Compute the distance of a set of transcript with respect to a reference set. [Category: Visualization]"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
190
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
191 parser = OptionParser(description = description)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
192 parser.add_option("-i", "--input1", dest="inputFileName1", action="store", type="string", help="input file 1 [compulsory] [format: file in transcript format given by -f]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
193 parser.add_option("-f", "--format1", dest="format1", action="store", type="string", help="format of file 1 [compulsory] [format: transcript file format]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
194 parser.add_option("-j", "--input2", dest="inputFileName2", action="store", type="string", help="input file 2 [compulsory] [format: file in transcript format given by -g]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
195 parser.add_option("-g", "--format2", dest="format2", action="store", type="string", help="format of file 2 [compulsory] [format: transcript file format]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
196 parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="plot output file [format: output file in PNG format]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
197 parser.add_option("-O", "--outputDistances", dest="outputDistances", action="store", default=None, type="string", help="output file containing the distance for each element of the query [format: output file in GFF3 format] [default: None]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
198 parser.add_option("-c", "--colinear", dest="colinear", action="store_true", default=False, help="only consider features on the same strand [format: bool] [default: false]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
199 parser.add_option("-a", "--antisense", dest="antisense", action="store_true", default=False, help="only consider features on the opposite strand [format: bool] [default: false]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
200 parser.add_option("-b", "--absolute", dest="absolute", action="store_true", default=False, help="give the absolute value of the distance [format: bool] [default: false]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
201 parser.add_option("-p", "--proportion", dest="proportion", action="store_true", default=False, help="give the proportion on the y-axis instead of the number of distances [format: bool] [default: false]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
202 parser.add_option("-s", "--start1", dest="start1", action="store", default=None, type="int", help="only consider the n first 5' nucleotides for list 1 [format: int]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
203 parser.add_option("-S", "--start2", dest="start2", action="store", default=None, type="int", help="only consider the n first 5' nucleotides for list 2 [format: int]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
204 parser.add_option("-e", "--end1", dest="end1", action="store", default=None, type="int", help="only consider the n last 3' nucleotides for list 1 [format: int]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
205 parser.add_option("-E", "--end2", dest="end2", action="store", default=None, type="int", help="only consider the n last 3' nucleotides for list 2 [format: int]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
206 parser.add_option("-m", "--minDistance", dest="minDistance", action="store", default=None, type="int", help="minimum distance considered between two transcripts [format: int] [default: None]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
207 parser.add_option("-M", "--maxDistance", dest="maxDistance", action="store", default=1000, type="int", help="maximum distance considered between two transcripts [format: int] [default: 1000]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
208 parser.add_option("-5", "--fivePrime", dest="fivePrime", action="store_true", default=False, help="consider the elements from list 1 which are upstream of elements of list 2 [format: bool] [default: False]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
209 parser.add_option("-3", "--threePrime", dest="threePrime", action="store_true", default=False, help="consider the elements from list 1 which are downstream of elements of list 2 [format: bool] [default: False]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
210 parser.add_option("-u", "--buckets", dest="buckets", action="store", default=None, type="int", help="plot histogram instead of line plot with given interval size [format: int] [default: None]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
211 parser.add_option("-2", "--2strands", dest="twoStrands", action="store_true", default=False, help="plot the distributions of each strand separately [format: bool] [default: False]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
212 parser.add_option("-r", "--spearman", dest="spearman", action="store_true", default=False, help="compute Spearman rho [format: bool] [default: False]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
213 parser.add_option("-x", "--xMin", dest="xMin", action="store", default=None, type="int", help="minimum value on the x-axis to plot [format: int] [default: None]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
214 parser.add_option("-X", "--xMax", dest="xMax", action="store", default=None, type="int", help="maximum value on the x-axis to plot [format: int] [default: None]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
215 parser.add_option("-t", "--title", dest="title", action="store", default=None, type="string", help="title for the graph [format: int] [default: None]")
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
216 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
217 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
218 (options, args) = parser.parse_args()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
219
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
220 gd = GetDistance(options.verbosity)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
221 gd.setQueryFile(options.inputFileName1, options.format1)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
222 gd.setReferenceFile(options.inputFileName2, options.format2)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
223 gd.setOutputFile(options.outputFileName)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
224 gd.setOutputTranscriptFile(options.outputDistances)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
225 gd.setColinear(options.colinear)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
226 gd.setAntisense(options.antisense)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
227 gd.setAbsolute(options.absolute)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
228 gd.setProportion(options.proportion)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
229 gd.restrictQueryToStart(options.start1)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
230 gd.restrictReferenceToStart(options.start2)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
231 gd.restrictQueryToEnd(options.end1)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
232 gd.restrictReferenceToEnd(options.end2)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
233 gd.setDistances(options.minDistance, options.maxDistance)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
234 gd.setUpstream(options.fivePrime)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
235 gd.setDownstream(options.threePrime)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
236 gd.setStrands(options.twoStrands)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
237 gd.setBuckets(options.buckets)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
238 gd.setTitle(options.title)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
239 gd.setXValues(options.xMin, options.xMax)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
240 gd.keepTmpValues(options.keep)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
241 gd.run()