super(InMemoryRefReader, self).__init__()
self._chroms = {}
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 contig_name in self._chroms:
raise ValueError("Duplicate chromosome={} detect".format(contig_name))
if not bases:
raise ValueError(
"Bases must contain at least one base, but got "{}"".format(bases))
end = start + len(bases)
self._chroms[contig_name] = _InMemoryChromosome(start, end, bases)
contigs.append(
reference_pb2.ContigInfo(
name=contig_name, n_bases=end, pos_in_fasta=i))