INNER CODE UNIT · Python
FastaIndex
Gabaldonlab/redundans · bin/FastaIndex.py:28
class FastaIndex(object):
"""Facilitate Fasta index (.fai) operations compatible
with samtools faidx (http://www.htslib.org/doc/faidx.html).
"""
def __init__(self, handle, verbose=0, log=sys.stderr):
""" """
ext = ".fai"
self.verbose = verbose
self.log = log.write
self.genomeSize = 0
self.whitespaces_in_headers = False
# guess handle
if type(handle) is str and os.path.isfile(handle):
handle = open(handle)
if type(handle) is TextIOWrapper:
if handle.name.endswith(('.gz','.bz')):
raise Exception("Compressed files are currently not supported!")
self.handle = handle