Mercurial > repos > yufei-luo > s_mart
comparison SMART/Java/Python/CompareOverlappingSmallQuery.py @ 46:169d364ddd91
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 30 Sep 2013 03:19:26 -0400 |
parents | 44d5973c188c |
children | 2ac71607aa60 |
comparison
equal
deleted
inserted
replaced
45:e454402ba9d9 | 46:169d364ddd91 |
---|---|
72 self.invert = False | 72 self.invert = False |
73 self.antisense = False | 73 self.antisense = False |
74 self.collinear = False | 74 self.collinear = False |
75 self.pcOverlapQuery = False | 75 self.pcOverlapQuery = False |
76 self.pcOverlapRef = False | 76 self.pcOverlapRef = False |
77 self.minOverlap = False | |
78 self.included = False | |
79 self.including = False | |
80 self.bins = {} | 77 self.bins = {} |
81 self.overlaps = {} | 78 self.overlaps = {} |
82 self.notOverlapping = False | 79 self.notOverlapping = False |
83 | 80 |
84 def setReferenceFile(self, fileName, format): | 81 def setReferenceFile(self, fileName, format): |
107 self.antisense = boolean | 104 self.antisense = boolean |
108 | 105 |
109 def setMinPercentOverlap(self, pcOverlapQuery, pcOverlapRef): | 106 def setMinPercentOverlap(self, pcOverlapQuery, pcOverlapRef): |
110 self.pcOverlapQuery = pcOverlapQuery | 107 self.pcOverlapQuery = pcOverlapQuery |
111 self.pcOverlapRef = pcOverlapRef | 108 self.pcOverlapRef = pcOverlapRef |
112 | |
113 def setMinOverlap(self, minOverlap): | |
114 self.minOverlap = minOverlap | |
115 | |
116 def setInclude(self, included, including): | |
117 self.included = included | |
118 self.including = including | |
119 | 109 |
120 def includeNotOverlapping(self, boolean): | 110 def includeNotOverlapping(self, boolean): |
121 self.notOverlapping = boolean | 111 self.notOverlapping = boolean |
122 | 112 |
123 def loadQuery(self): | 113 def loadQuery(self): |
143 return False | 133 return False |
144 if self.collinear and queryTranscript.getDirection() != refTranscript.getDirection(): | 134 if self.collinear and queryTranscript.getDirection() != refTranscript.getDirection(): |
145 return False | 135 return False |
146 if self.antisense and queryTranscript.getDirection() == refTranscript.getDirection(): | 136 if self.antisense and queryTranscript.getDirection() == refTranscript.getDirection(): |
147 return False | 137 return False |
148 if self.included and not refTranscript.include(queryTranscript): | |
149 return False | |
150 if self.including and not queryTranscript.include(refTranscript): | |
151 return False | |
152 querySize = queryTranscript.getSize() | 138 querySize = queryTranscript.getSize() |
153 if self.pcOverlapQuery and not queryTranscript.overlapWithExon(refTranscript, int(querySize * self.pcOverlapQuery / 100.0)): | 139 if self.pcOverlapQuery and not queryTranscript.overlapWithExon(refTranscript, int(querySize * self.pcOverlapQuery / 100.0)): |
154 return False | 140 return False |
155 refSize = refTranscript.getSize() | 141 refSize = refTranscript.getSize() |
156 if self.pcOverlapRef and not queryTranscript.overlapWithExon(refTranscript, int(refSize * self.pcOverlapRef / 100.0)): | 142 if self.pcOverlapRef and not queryTranscript.overlapWithExon(refTranscript, int(refSize * self.pcOverlapRef / 100.0)): |
157 return False | |
158 if self.minOverlap and not queryTranscript.overlapWithExon(refTranscript, self.minOverlap): | |
159 return False | 143 return False |
160 return True | 144 return True |
161 | 145 |
162 def _alterTranscript(self, transcript, type): | 146 def _alterTranscript(self, transcript, type): |
163 if type == REFERENCE: | 147 if type == REFERENCE: |
235 parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") | 219 parser.add_option("-o", "--output", dest="outputFileName", action="store", type="string", help="output file [format: output file in GFF3 format]") |
236 parser.add_option("-O", "--notOverlapping", dest="notOverlapping", action="store_true", default=False, help="also output not overlapping data [format: bool] [default: false]") | 220 parser.add_option("-O", "--notOverlapping", dest="notOverlapping", action="store_true", default=False, help="also output not overlapping data [format: bool] [default: false]") |
237 parser.add_option("-d", "--distance", dest="distance", action="store", default=0, type="int", help="accept some distance between query and reference [format: int]") | 221 parser.add_option("-d", "--distance", dest="distance", action="store", default=0, type="int", help="accept some distance between query and reference [format: int]") |
238 parser.add_option("-c", "--collinear", dest="collinear", action="store_true", default=False, help="provide collinear features [format: bool] [default: false]") | 222 parser.add_option("-c", "--collinear", dest="collinear", action="store_true", default=False, help="provide collinear features [format: bool] [default: false]") |
239 parser.add_option("-a", "--antisense", dest="antisense", action="store_true", default=False, help="provide antisense features [format: bool] [default: false]") | 223 parser.add_option("-a", "--antisense", dest="antisense", action="store_true", default=False, help="provide antisense features [format: bool] [default: false]") |
240 parser.add_option("-m", "--minOverlap", dest="minOverlap", action="store", default=False, type="int", help="min. #nt overlap [format: bool] [default: false]") | |
241 parser.add_option("-p", "--pcOverlapQuery", dest="pcOverlapQuery", action="store", default=False, type="int", help="min. % overlap of the query [format: bool] [default: false]") | 224 parser.add_option("-p", "--pcOverlapQuery", dest="pcOverlapQuery", action="store", default=False, type="int", help="min. % overlap of the query [format: bool] [default: false]") |
242 parser.add_option("-P", "--pcOverlapRef", dest="pcOverlapRef", action="store", default=False, type="int", help="min. % overlap of the reference [format: bool] [default: false]") | 225 parser.add_option("-P", "--pcOverlapRef", dest="pcOverlapRef", action="store", default=False, type="int", help="min. % overlap of the reference [format: bool] [default: false]") |
243 parser.add_option("-k", "--included", dest="included", action="store_true", default=False, help="provide query elements which are nested in reference elements [format: bool] [default: false]") | |
244 parser.add_option("-K", "--including", dest="including", action="store_true", default=False, help="provide query elements in which reference elements are nested [format: bool] [default: false]") | |
245 parser.add_option("-x", "--exclude", dest="exclude", action="store_true", default=False, help="invert the match [format: bool] [default: false]") | 226 parser.add_option("-x", "--exclude", dest="exclude", action="store_true", default=False, help="invert the match [format: bool] [default: false]") |
246 parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") | 227 parser.add_option("-v", "--verbosity", dest="verbosity", action="store", default=1, type="int", help="trace level [format: int]") |
247 (options, args) = parser.parse_args() | 228 (options, args) = parser.parse_args() |
248 | 229 |
249 cosq = CompareOverlappingSmallQuery(options.verbosity) | 230 cosq = CompareOverlappingSmallQuery(options.verbosity) |
253 cosq.includeNotOverlapping(options.notOverlapping) | 234 cosq.includeNotOverlapping(options.notOverlapping) |
254 cosq.setDistance(options.distance) | 235 cosq.setDistance(options.distance) |
255 cosq.setCollinear(options.collinear) | 236 cosq.setCollinear(options.collinear) |
256 cosq.setAntisense(options.antisense) | 237 cosq.setAntisense(options.antisense) |
257 cosq.setMinPercentOverlap(options.pcOverlapQuery, options.pcOverlapRef) | 238 cosq.setMinPercentOverlap(options.pcOverlapQuery, options.pcOverlapRef) |
258 cosq.setMinOverlap(options.minOverlap) | |
259 cosq.setInclude(options.included, options.including) | |
260 cosq.setInvert(options.exclude) | 239 cosq.setInvert(options.exclude) |
261 cosq.run() | 240 cosq.run() |