INNER CODE UNIT · Python
_load_fai
Gabaldonlab/redundans · bin/FastaIndex.py:130
def _load_fai(self):
"""Load stats from faidx file.
Return False if .fai is wrongly formatted.
"""
self.id2stats = {}
for l in open(self.faidx):
ldata = l[:-1].split('\t')
if len(ldata)<9:
self.whitespaces_in_headers = False
return
rid = ldata[0]
stats = list(map(int, ldata[1:]))
self.id2stats[rid] = stats
# update genomeSize
self.genomeSize += stats[0]
if len(rid.split())>1:
self.whitespaces_in_headers = True
return True