requires the following input format: seq score cdist cons cdist = distance to center, cons = conservation value
count_compare takes two default dictionaries (defaultdict objects), a and b, each with default factory “lambda: 0” and key-value pairs that specify the counts (value) of each sequence (key), and returns a new dictionary whose values are tuples (value_a,value_b), the values from a and b.
Reverse complements: if rc=True, count_seqs will count reverse complements as the same sequence and use the alphabetically prior sequence as the key. if rc=False, reverse complements will be treated as different sequences. If you have already ensured that the keys meet this condition, you should use rc=False, but rc=True is also safe.
note: defaultdict is in the collections module of the standard library
count_seqs takes as input an iterable that yields sequences, and then returns the counts of each sequence as a defaultdict (similar to dict, can be recast as dict type).
Sorting: Use dictSort to sort, if needed.
Reverse complements: if rc=True, count_seqs will count reverse complements as the same sequence and use the alphabetically prior sequence as the key. if rc=False, reverse complements will be treated as different sequences.
returns the alphabetically prior of seq1 and seq2 if they are the same or we fail to order, return seq1
if ignore_case=True, we apply str.upper to each letter
returns the reverse complement of a sequence