INNER CODE UNIT · Python
_faidx
Gabaldonlab/redundans · bin/FastaIndex.py:55
_faidx = _fasta+ext
# symlink faidx if faidx exists and linked fasta is older than its faidx
if os.path.isfile(_faidx) and os.stat(_fasta).st_mtime < os.stat(_faidx).st_mtime:
symlink(_faidx, self.faidx)
# create new index if no .fai, .fai loading failed or .fai younger than .fasta
if not os.path.isfile(self.faidx) or not self._load_fai() or \
os.stat(self.fasta).st_mtime > os.stat(self.faidx).st_mtime:
self._generate_index()
# links
self.get = self.get_fasta
# init storage
self.base2rc= {"A": "T", "T": "A", "C": "G", "G": "C",
"a": "t", "t": "a", "c": "g", "g": "c",
"N": "N", "n": "n"}
# Calculate total counts
counts = []
#Select first index, as it includes contig length
base_stats = [self.id2stats[stats][0] for stats in self.id2stats]