class_docstr: ACTG strings to ints and back. Optionally chunks bases into single ids.
  
  To use a different character set, subclass and set BASES to the char set. UNK
  and PAD must not appear in the char set, but can also be reset.
  
  Uses 'N' as an unknown base.
class_docstr_tok: ["ACTG","strings","to","ints","and","back",".","Optionally","chunks","bases","into","single","ids",".","To","use","a","different","character","set",",","subclass","and","set","BASES","to","the","char","set",".","UNK","and","PAD","must","not","appear","in","the","char","set",",","but","can","also","be","reset",".","Uses","'N","'","as","an","unknown","base","."]
code: def encode(self, s):
      bases = list(s)
      extra = len(bases) % self._chunk_size
      if extra > 0:
          pad = [self.PAD] * (self._chunk_size - extra)
          bases.extend(pad)
      assert (len(bases) % self._chunk_size) == 0
      num_chunks = len(bases) // self._chunk_size
      ids = []
      for chunk_idx in range(num_chunks):
          start_idx = chunk_idx * self._chunk_size
          end_idx = start_idx + self._chunk_size
          chunk = tuple(bases[start_idx:end_idx])
          if chunk not in self._tokens_to_ids:
              raise ValueError("Unrecognized token %s" % chunk)
          ids.append(self._tokens_to_ids[chunk])
      return ids
  
file_path: tensor2tensor/tensor2tensor/data_generators/dna_encoder.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  from six.moves import range
  from tensor2tensor.data_generators import text_encoder
label_desc: Use image node_id 4 for calling the DNAEncoder obj's underlying member method code with example usage: obj.encode(s) and returns: ids