class_docstr: An `IndexedFastaReader` getting its bases from an in-memory data structure.
  
  An `InMemoryFastaReader` provides the same API as `IndexedFastaReader` but
  doesn't fetch its data from an on-disk FASTA file but rather fetches the bases
  from an in-memory cache containing (chromosome, start, bases) tuples.
  
  In particular, the `query(Range(chrom, start, end))` operation fetches bases
  from the tuple where `chrom` == chromosome, and then from the bases where the
  first base of bases starts at start. If start > 0, then the bases string is
  assumed to contain bases starting from that position in the region. For
  example, the record ('1', 10, 'ACGT') implies that
  `query(ranges.make_range('1', 11, 12))` will return the base 'C', as the 'A'
  base is at position 10. This makes it straightforward to cache a small region
  of a full chromosome without having to store the entire chromosome sequence in
  memory (potentially big!).
docstr: Initializes an InMemoryFastaReader using data from chromosomes.
  
  Args:
    chromosomes: list[tuple]. The chromosomes we are caching in memory as a
      list of tuples. Each tuple must be exactly three elements in length,
      containing (chromosome name [str], start [int], bases [str]).
  
  Raises:
    ValueError: If any of the chromosomes tuples are invalid.
docstr_tok: ["Initializes","an","InMemoryFastaReader","using","data","from","chromosomes",".","Args",":","chromosomes",":","list","[","tuple","]",".","The","chromosomes","we","are","caching","in","memory","as","a","list","of","tuples",".","Each","tuple","must","be","exactly","three","elements","in","length",",","containing","(","chromosome","name","[","str","]",",","start","[","int","]",",","bases","[","str","]",")",".","Raises",":","ValueError",":","If","any","of","the","chromosomes","tuples","are","invalid","."]
code: def __init__(self, chromosomes):
      """Initializes an InMemoryFastaReader using data from chromosomes.
  
      Args:
        chromosomes: list[tuple]. The chromosomes we are caching in memory as a
          list of tuples. Each tuple must be exactly three elements in length,
          containing (chromosome name [str], start [int], bases [str]).
  
      Raises:
        ValueError: If any of the chromosomes tuples are invalid.
      """
      super(InMemoryFastaReader, self).__init__()
  
      ref_seqs = []
      contigs = []
      for i, (contig_name, start, bases) in enumerate(chromosomes):
          if start < 0:
              raise ValueError(
                  "start={} must be >= for chromosome={}".format(
                      start, contig_name
                  )
              )
          if not bases:
              raise ValueError(
                  'Bases must contain at least one base, but got "{}"'.format(
                      bases
                  )
              )
  
          end = start + len(bases)
          ref_seqs.append(
              reference_pb2.ReferenceSequence(
                  region=ranges.make_range(contig_name, start, end),
                  bases=bases,
              )
          )
          contigs.append(
              reference_pb2.ContigInfo(
                  name=contig_name, n_bases=end, pos_in_fasta=i
              )
          )
  
      self._reader = reference.InMemoryFastaReader.create(
          contigs, ref_seqs
      )
      self.header = RefFastaHeader(contigs=self._reader.contigs)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import six
  from etils import epath
  from third_party.nucleus.io import genomics_reader
  from third_party.nucleus.io.python import reference
  from third_party.nucleus.protos import fasta_pb2
  from third_party.nucleus.protos import reference_pb2
  from third_party.nucleus.util import ranges
label_desc: Use image node_id 1 to create a new InMemoryFastaReader object from inherited base classes: genomics_reader with example: obj = InMemoryFastaReader(chromosomes)