Cost: O(1) - Returns a view on the underlying Seq
422026
@Nonnull
  public List<E> toList() {
    return underlying == null ? Collections.emptyList() : underlying.toList();
  }
517990
def _cost_method(self, *args, **kwargs):
        

        cost_val = np.sum(np.abs(self.weights * self._linear.op(args[0])))

        if 'verbose' in kwargs and kwargs['verbose']:
            print(' - L1 NORM (X):', cost_val)

        return cost_val
13410
def count(self, view, include=None):
        
        return self._get(self._build_url(self.endpoint.count(id=view, include=include)))
18670
def _iop(self, operation, other, *allowed):
		
		
		f = self._field
		
		if self._combining:  # We are a field-compound query fragment, e.g. (Foo.bar & Foo.baz).
			return reduce(self._combining,
					(q._iop(operation, other, *allowed) for q in f))  # pylint:disable=protected-access
		
		# Optimize this away in production; diagnosic aide.
		if __debug__ and _complex_safety_check(f, {operation} | set(allowed)):  # pragma: no cover
			raise NotImplementedError("{self!r} does not allow {op} comparison.".format(
					self=self, op=operation))
		
		def _t(o):
			for value in o:
				yield None if value is None else f.transformer.foreign(value, (f, self._document))
		
		other = other if len(other) > 1 else other[0]
		values = list(_t(other))
		
		return Filter({self._name: {operation: values}})
314309
def _tobytes(self):
        
        if not self._has_view:
            # fast path optimization
            if len(self._deque) == 0:
                return b""
            elif len(self._deque) == 1:
                # no copy
                return self._deque[0]
            else:
                return b"".join(self._deque)
        else:
            tmp = [x.tobytes() if isinstance(x, memoryview) else x
                   for x in self._deque]
            return b"".join(tmp)
926207
def _slice(self, view):
        
        if self._data is not None:
            return self._data[view]
        return self._proxy.get_view(self.id, view)
405608
def peek(self, size: int) -> memoryview:
        
        assert size > 0
        try:
            is_memview, b = self._buffers[0]
        except IndexError:
            return memoryview(b"")

        pos = self._first_pos
        if is_memview:
            return typing.cast(memoryview, b[pos : pos + size])
        else:
            return memoryview(b)[pos : pos + size]
863295
def calculate_oobatake_dS(seq, temp):
    

    seq = ssbio.protein.sequence.utils.cast_to_str(seq)

    dS = 0
    temp += 273.15
    T0 = 298.15
    dCp_sum = _sum_of_dCp(seq)
    for aa in seq:
        S0 = oobatake_dictionary[aa]['dS']
        dS += S0
    return dS + dCp_sum * math.log(temp / T0)
214164
def get_sequence(self, chrom, start, end, strand=None):
            
        # Check if we have an index_dir
        if not self.index_dir:
            print("Index dir is not defined!")
            sys.exit()

        # retrieve all information for this specific sequence
        fasta_file = self.fasta_file[chrom]
        index_file = self.index_file[chrom]
        line_size = self.line_size[chrom]
        total_size = self.size[chrom]

        #print fasta_file, index_file, line_size, total_size
        if start > total_size:
            raise ValueError(
                    "Invalid start {0}, greater than sequence length {1} of {2}!".format(start, total_size, chrom))
        
        if start < 0:
            raise ValueError("Invalid start, < 0!")
        
        if end > total_size:
            raise ValueError(
                    "Invalid end {0}, greater than sequence length {1} of {2}!".format(end, total_size, chrom))


        index = open(index_file, "rb")
        fasta = open(fasta_file)
        seq = self._read(index, fasta, start, end, line_size)
        index.close()
        fasta.close()

        if strand and strand == "-":
            seq = rc(seq)
        return seq
1160313
def _inc(self, val):
        """"""
        assert(len(val) == self.sequence_length)
        return self.sequence_string[(self.sequence_string.index(val)+1) % len(self.sequence_string)]
892392
def sequence_molecular_weight(seq):
    
    if 'X' in seq:
        warnings.warn(_nc_warning_str, NoncanonicalWarning)
    return sum(
        [residue_mwt[aa] * n for aa, n in Counter(seq).items()]) + water_mass
58097
def get_one(seq, default=None, skip_string_iter=True):
    
    if skip_string_iter and isinstance(seq, (str, unicode, bytes, bytearray)):
        return seq
    if not seq:
        return ''
    try:
        return next(iter(seq))
    except TypeError:
        # not hasattr __iter__/__getitem__
        return default
35115
def get_one(self, qry, tpl):
        '''  '''
        self.cur.execute(qry + ' LIMIT 1', tpl)
        result = self.cur.fetchone()
        # unpack tuple if it has only
        # one element
        # TODO unpack results
        if type(result) is tuple and len(result) == 1:
            result = result[0]
        return result
357804
def peek_step(self, val: ArrayValue,
                  sn: "DataNode") -> Tuple[Value, "DataNode"]:
        
        try:
            return (val[val.index(self.parse_value(sn))], sn)
        except ValueError:
            return None, sn
647087
def get_encoded_seq_len(self, seq_len: int) -> int:
        
        return int(ceil(seq_len / self.pool_stride))
863531
function viewToBuffer(view) {
  const buf = Buffer.from(view.buffer);

  if (view.byteLength !== view.buffer.byteLength) {
    return buf.slice(view.byteOffset, view.byteOffset + view.byteLength);
  }

  return buf;
}
290755
def peekView(self, newLength):
        
        # Note: In Python 2.7, memoryviews can't be written to
        # by the struct module. (BUG)
        return memoryview(self.buf)[self.offset:self.offset + newLength]