Split genome into chunks of fixed size (save the last one).

def split_genome(genome, chunk_size=10000):
    """Split genome into chunks of fixed size (save the last one).
    """

    chunks = []
    from Bio import SeqIO
    with open(genome) as handle:
        for record in SeqIO.parse(handle, "fasta"):
            sequence = record.seq
            n = len(sequence)
            chunks += [str(sequence[i:min(i + chunk_size, n)])
                       for i in range(0, n, chunk_size)]
    return np.array(chunks)