def retrieve(self, start, end, minreadq): """ Returns reads fully overlapping [start,end) """ # start at end going backwards, for efficiency idx = self._bufend reads = [] while True: idx = (idx - 1) % len(self._buffer) # for efficiency, do a quick test first if self._buffer[idx].pos <= start: ##DEBUG #rstart0, rend0 = pruned_ref_start_end(self._buffer[idx], minreadq) rstart, rend = platypusutils.pruned_ref_start_end( self._buffer[idx], minreadq, 0) #assert rstart0 == rstart #assert rend0 == rend if rend <= start: # it is theoretically possible that subsequent reads, that start leftward of # the current read, do still fully overlap [start,end), even though the current # read is disjoint with [start,end). In practice we will miss very few indel # errors this way, as long error indels tend to occur in long tandems, and # errors outside tandems are short. break if rstart <= start and rend >= end: reads.append(self._buffer[idx]) if idx == self._bufend: break return reads
def retrieve(self, start, end, minreadq): """ Returns reads fully overlapping [start,end) """ # start at end going backwards, for efficiency idx = self._bufend reads = [] while True: idx = (idx - 1) % len(self._buffer) # for efficiency, do a quick test first if self._buffer[idx].pos <= start: ##DEBUG #rstart0, rend0 = pruned_ref_start_end(self._buffer[idx], minreadq) rstart, rend = platypusutils.pruned_ref_start_end(self._buffer[idx], minreadq, 0) #assert rstart0 == rstart #assert rend0 == rend if rend <= start: # it is theoretically possible that subsequent reads, that start leftward of # the current read, do still fully overlap [start,end), even though the current # read is disjoint with [start,end). In practice we will miss very few indel # errors this way, as long error indels tend to occur in long tandems, and # errors outside tandems are short. break if rstart <= start and rend >= end: reads.append( self._buffer[idx] ) if idx == self._bufend: break return reads
def enter(self, read, minAnchor): ##DEBUG #pos0, end0 = pruned_ref_start_end( read, self.minReadQ, minAnchor ) pos, end = platypusutils.pruned_ref_start_end( read, self.minReadQ, minAnchor ) #assert pos0 == pos #assert end0 == end if end - pos > self.covbuflen: # read too long return self.covbuf[pos % self.covbuflen] += 1 self.covbuf[end % self.covbuflen] -= 1
def enter(self, read, minAnchor): ##DEBUG #pos0, end0 = pruned_ref_start_end( read, self.minReadQ, minAnchor ) pos, end = platypusutils.pruned_ref_start_end(read, self.minReadQ, minAnchor) #assert pos0 == pos #assert end0 == end if end - pos > self.covbuflen: # read too long return self.covbuf[pos % self.covbuflen] += 1 self.covbuf[end % self.covbuflen] -= 1