def group_unique_sequences(
        allele_reads,
        max_prefix_size=None,
        max_suffix_size=None):
    """
    Given a list of AlleleRead objects, extracts all unique
    (prefix, allele, suffix) sequences and associate each with a list
    of reads that contained that sequence.
    """
    groups = defaultdict(set)
    for r in allele_reads:
        prefix = r.prefix
        allele = r.allele
        suffix = r.suffix
        if max_prefix_size and len(prefix) > max_prefix_size:
            prefix = prefix[-max_prefix_size:]
        if max_suffix_size and len(suffix) > max_suffix_size:
            suffix = suffix[:max_suffix_size]
        key = (prefix, allele, suffix)
        groups[key].add(r)
    return groups
def group_unique_sequences ( allele_reads , max_prefix_size = None , max_suffix_size = None ) : groups = defaultdict ( set ) for r in allele_reads : prefix = r . prefix allele = r . allele suffix = r . suffix if max_prefix_size and len ( prefix ) > max_prefix_size : prefix = prefix [ - max_prefix_size : ] if max_suffix_size and len ( suffix ) > max_suffix_size : suffix = suffix [ : max_suffix_size ] key = ( prefix , allele , suffix ) groups [ key ] . add ( r ) return groups
Given a list of AlleleRead objects, extracts all unique
    (prefix, allele, suffix) sequences and associate each with a list
    of reads that contained that sequence.