def filter_ambiguity(records, percent=0.5):  # , repeats=6)
    """
    Filters out sequences with too much ambiguity as defined by the method
    parameters.

    :type records: list
    :param records: A list of sequences
    :type repeats: int
    :param repeats: Defines the number of repeated N that trigger truncating a
                    sequence.
    :type percent: float
    :param percent: Defines the overall percentage of N in a sequence that
                     will cause the sequence to be filtered out.
    """
    seqs = []
    # Ns = ''.join(['N' for _ in range(repeats)])
    count = 0
    for record in records:
        if record.seq.count('N')/float(len(record)) < percent:
#            pos = record.seq.find(Ns)
#            if pos >= 0:
#                record.seq = Seq(str(record.seq)[:pos])
            seqs.append(record)
        count += 1

    return seqs, count
def filter_ambiguity ( records , percent = 0.5 ) : seqs = [ ] count = 0 for record in records : if record . seq . count ( 'N' ) / float ( len ( record ) ) < percent : seqs . append ( record ) count += 1 return seqs , count
Filters out sequences with too much ambiguity as defined by the method
    parameters.

    :type records: list
    :param records: A list of sequences
    :type repeats: int
    :param repeats: Defines the number of repeated N that trigger truncating a
                    sequence.
    :type percent: float
    :param percent: Defines the overall percentage of N in a sequence that
                     will cause the sequence to be filtered out.