def iteratePeptides(sequence='', method='trypsin', missed_cleavages=2,
    min_length=4, max_length=40):
    """
    Naive in silico digestion

    Need to add other methods
    """
    if method == 'trypsin':
        cleave_bases = ['K', 'R']
    if method == 'gluc':
        cleave_bases = ['E', 'D']
    if method == 'chromotrypsin':
        cleave_bases = ['R', 'Y', 'W']
    peptide_ids = set((0,))
    peptides = [['', 0, 0, 0, 0]]
    for missed_cleavage in range(1, missed_cleavages + 1):
        peptide_ids.add(missed_cleavage)
        peptides.append(['', 0, 0, 0, missed_cleavage])
    missed = 0
    peptide_id = missed_cleavages
    start = 0
    for position, base in enumerate(sequence):
        for peptide in peptide_ids:
            peptides[peptide][0] += base
            peptides[peptide][2] += 1
        if base in cleave_bases:
            for peptide in list(peptide_ids):
                peptides[peptide][3] += 1
                seq, start, end, missed, allowed_missed = peptides[peptide]
                if missed > allowed_missed:
                    peptide_ids.remove(peptide)
                    if len(seq) > min_length and len(seq) < max_length:
                        pep_seq, start, end, count, missed = peptides[peptide]
                        yield pep_seq, start, end, missed
            peptide_ids.add(peptide_id + 1)
            peptides.append(['', position + 1, position + 1, 0, 0])
            for missed_cleavage in range(1, missed_cleavages + 1):
                peptide_ids.add(peptide_id + 1 + missed_cleavage)
                peptides.append(['', position + 1, position + 1, 0,
                    missed_cleavage])
            peptide_id += missed_cleavages + 1
