def iteratorFromExtension(filename):
    '''
    Get a sequence file iterator 
    Based on the file's extension
    '''
    ext = filename.split(".")[-1]
    if ext in ["fasta", "fa"]:
        return fastaIterator
    elif ext in ["fastq", "fq", "txt"]:
        return fastqIterator
    raise Exception, "Unknown file extension %s for file %s" % (ext,filename)
dataset/ETHPy150Open jgurtowski/ectools/seqio.py/iteratorFromExtension/original