INNER CODE UNIT · Python
__len__
Gabaldonlab/redundans · bin/FastaIndex.py:149
def __len__(self):
"""How many records are there?"""
return len(self.id2stats)
def __iter__(self):
"""Iterate over the keys."""
for seqid in self.id2stats:
yield seqid
def __getitem__(self, key, start=None, stop=None, name=None, seqonly=False):
"""x.__getitem__(y) <==> x[y]"""
if key not in self.id2stats:
raise KeyError
# get offset info
size, offset, linebases, linebytes = self.id2stats[key][:4]
# compute bytes to fetch
linediff = linebytes - linebases
seqid = key