Return a range which represents the requested slce
        of the sequence represented by this range.
332685
def __getitem_slice(self, slce):
        
        scaled_indices = (self._step * n for n in slce.indices(self._len))
        start_offset, stop_offset, new_step = scaled_indices
        return newrange(self._start + start_offset,
                        self._start + stop_offset,
                        new_step)
217486
def from_sequence(cls, seq):
        
        args = tuple(islice(seq, 4))
        if len(args) > 3:
            raise ValueError('When creating a Point from sequence, it '
                             'must not have more than 3 items.')
        return cls(*args)
712121
def get_last_sequence(self, cur=None):
        
        sql = 'SELECT sequence FROM {} ORDER BY sequence DESC LIMIT 1;'.format(self.subdomain_table)
        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        db_query_execute(cursor, sql, ())
        last_seq = None
        try:
            last_seq = cursor.fetchone()[0]
        except:
            last_seq = 0
        
        return int(last_seq)
1160829
def slice_on_length(self, data_len, *addSlices):
        '''
        
        '''
        if len(self.ordered_ranges) + len(addSlices) == 0:
            return slice(None,None,None)
        ranges = self.ordered_ranges
        if len(addSlices) > 0:
            ranges = ranges + DimensionRange(*addSlices).ordered_ranges
        return self._combine_lists_of_ranges_on_length(data_len, *ranges)
1079404
def chunk_sequence(sequence, chunk_length):
    """"""
    for index in range(0, len(sequence), chunk_length):
        yield sequence[index:index + chunk_length]
916052
def get_sequence_str(self):
        '''
        
        '''
        sequence = self.get_sequence()
        return '->'.join(e.dst.name for e in sequence)
1106233
function get_sequence(self, weight) {
  if (undefined === self.__sequences__[weight]) {
    self.__sequences__[weight] = [];
  }

  return self.__sequences__[weight];
}
95123
def _get_str_range(self, vals_stats):
        """"""
        minmax = vals_stats[1] # stats minmax
        minval = self.fmtstr.format(minmax[0])
        maxval = self.fmtstr.format(minmax[1])
        return '{A} to {B:6>}'.format(A=minval, B=maxval)
725942
def range(self) -> str:
        """"""
        if FRAGMENT_MISSING in self:
            return '?'

        return '{}_{}'.format(self[FRAGMENT_START], self[FRAGMENT_STOP])
1195673
def get_seq(self,obj,default=None):
        """"""
        if is_sequence(obj):
            return obj
        if is_number(obj): return [obj]
        if obj is None and default is not None:
            log.warning('using default value (%s)'%(default))
            return self.get_seq(default)
        raise ValueError('expected sequence|number but got %s'%(type(obj)))
153722
def _scatter(sequence, n):
  """"""
  chunklen = int(math.ceil(float(len(sequence)) / float(n)))

  return [
    sequence[ i*chunklen : (i+1)*chunklen ] for i in range(n)
  ]
1358480
async def getrange(self, key, start, end):
        
        return await self.execute_command('GETRANGE', key, start, end)
1292129
def seq(self):
        """"""

        if self.sequence_file:
            file_to_load = copy(self.sequence_path)
            log.debug('{}: reading sequence from sequence file {}'.format(self.id, file_to_load))
            tmp_sr = SeqIO.read(file_to_load, 'fasta')
            return tmp_sr.seq

        else:
            if not self._seq:
                log.debug('{}: no sequence stored in memory'.format(self.id))
            else:
                log.debug('{}: reading sequence from memory'.format(self.id))

            return self._seq
270209
def block_ranges(start_block, last_block, step=5):
    

    if last_block is not None and start_block > last_block:
        raise TypeError(
            "Incompatible start and stop arguments.",
            "Start must be less than or equal to stop.")

    return (
        (from_block, to_block - 1)
        for from_block, to_block
        in segment_count(start_block, last_block + 1, step)
    )
1055062
def get_range_start_coord(self,rng):
    
    sys.stderr.write("error unimplemented get_range_start_coord\n")
    sys.exit()
    if rng.chr not in self._chrs: return None
    for l in [self._lines[x-1] for x in self._chrs[rng.chr]]:
      ####
      y = l['rng']
      c = y.cmp(rng)
      if c > 0: return None
      if c == 0:
        x = y.get_payload()
        return [x[1],x[2]] # don't need the name
    return None
1243291
function lrange(start, stop) {
  if(start < 0) start = this._data.length + start;
  if(stop < 0) stop = this._data.length + stop;
  stop++;
  return this._data.slice(start, stop);
}
196985
def sequence_set(self) -> SequenceSet:
        
        try:
            seqset_crit = next(crit for crit in self.all_criteria
                               if isinstance(crit, SequenceSetSearchCriteria))
        except StopIteration:
            return SequenceSet.all()
        else:
            return seqset_crit.seq_set