Encodes a ``sequence``.

        Args:
            sequence (str): String ``sequence`` to encode.

        Returns:
            torch.Tensor: Encoding of the ``sequence``.
321704
def encode(self, sequence):
        
        sequence = super().encode(sequence)
        sequence = self.tokenize(sequence)
        vector = [self.stoi.get(token, self.unknown_index) for token in sequence]
        if self.append_eos:
            vector.append(self.eos_index)
        return torch.tensor(vector)
217948
def GetEncoding(self):
        ''''''
        if self.encoding:
            vals = string.split(self.encoding, ',')
            if len(vals) > 2:
                try:
                    return charset_table[int(vals[2])]
                except KeyError:
                    pass
        return None
736528
def _add_sequence(self, sequence):
        
        if sequence.identity not in self._sequences.keys():
            self._sequences[sequence.identity] = sequence
        else:
            raise ValueError("{} has already been defined".format(sequence.identity))
543865
def sequence(self):
        
        self.open()
        seq = lvm_vg_get_seqno(self.handle)
        self.close()
        return seq
963828
def normalizeSequence(sequence, considerDimensions=None):
  
  seq = np.array(sequence).astype('float64')
  nSampleDim = seq.shape[1]

  if considerDimensions is None:
    considerDimensions = range(nSampleDim)

  for dim in considerDimensions:
    seq[:, dim] = (seq[:, dim] - np.mean(seq[:, dim])) / np.std(seq[:, dim])

  sequence = seq.tolist()
  return sequence
819060
def get_chain_sequence_string(self, chain_id, use_seqres_sequences_if_possible, raise_Exception_if_not_found = True):
        ''''''
        chain_pair = self.get_annotated_chain_sequence_string(chain_id, use_seqres_sequences_if_possible, raise_Exception_if_not_found = raise_Exception_if_not_found)
        if chain_pair:
            return chain_pair[1]
        return None
1302497
def encode(self, label):
        
        label = super().encode(label)

        return torch.tensor(self.stoi.get(label, self.unknown_index))
958728
def sequences_to_string(self):
        
        return {k: ''.join(self.states[v]) for (k, v) in self.sequences.items()}
1252211
def seqs_to_stream(seqs, ih):
    
    if ih == '_input_as_multiline_string':
        recs = FastaFinder(seqs.split('\n'))
    elif ih == '_input_as_string':
        recs = FastaFinder(open(seqs))
    elif ih == '_input_as_seqs':
        recs = [['>'+str(i), s] for i, s in enumerate(seqs)]
    elif ih == '_input_as_lines':
        recs = FastaFinder(seqs)
    else:
        raise TypeError, "Unknown input handler %s" % ih
    return recs
829299
def mask_sequence(seq, gaps):
    
    seq = [i.upper() for i in seq]
    for gap in gaps:
        for i in range(gap[0] - 1, gap[1]):
            seq[i] = seq[i].lower()
    return ''.join(seq)
492441
public static int utf8EncodedLength(@Nullable CharSequence sequence) {
		if (StringUtils.isEmpty(sequence)) {
			return 0;
		}
		return Utf8.encodedLength(sequence);
	}
1299613
def sequence(self):
        
        seq = [x.mol_code for x in self._monomers]
        return ' '.join(seq)
1079404
def chunk_sequence(sequence, chunk_length):
    """"""
    for index in range(0, len(sequence), chunk_length):
        yield sequence[index:index + chunk_length]
355791
def set_sequence_from_str(self, sequence):
        
        self._qsequences = [QKeySequence(s) for s in sequence.split(', ')]
        self.update_warning()
1339857
def _output(cls,
            tensors: Sequence[tf.Tensor],
            dtypes: Sequence[tf.DType]) -> Sequence[tf.Tensor]:
        ''''''
        outputs = []
        for tensor, dtype in zip(tensors, dtypes):
            tensor = tensor[0]
            if tensor.dtype != dtype:
                tensor = tf.cast(tensor, dtype)
            outputs.append(tensor)
        return tuple(outputs)
329380
def filter_sequences(self, seq_type):
        
        return DictList(x for x in self.sequences if isinstance(x, seq_type))
394493
def sequence_type(seq):
    '''

    '''
    if isinstance(seq, coral.DNA):
        material = 'dna'
    elif isinstance(seq, coral.RNA):
        material = 'rna'
    elif isinstance(seq, coral.Peptide):
        material = 'peptide'
    else:
        raise ValueError('Input was not a recognized coral.sequence object.')
    return material