def _iupac_ambiguous_equal(ambig_base, unambig_base):
    """
    Tests two bases for equality, accounting for IUPAC ambiguous DNA

    ambiguous base may be IUPAC ambiguous, unambiguous must be one of ACGT
    """
    iupac_translation = {
        'A': 'A',
        'C': 'C',
        'G': 'G',
        'T': 'T',
        'U': 'U',
        'R': 'AG',
        'Y': 'CT',
        'S': 'GC',
        'W': 'AT',
        'K': 'GT',
        'M': 'AC',
        'B': 'CGT',
        'D': 'AGT',
        'H': 'ACT',
        'V': 'ACG',
        'N': 'ACGT',
        '-': '-'
    }
    for i in (ambig_base, unambig_base):
        if not len(i) == 1:
            raise ValueError("only one base may be passed.")

    return unambig_base.upper() in iupac_translation[ambig_base.upper()]
def _iupac_ambiguous_equal ( ambig_base , unambig_base ) : iupac_translation = { 'A' : 'A' , 'C' : 'C' , 'G' : 'G' , 'T' : 'T' , 'U' : 'U' , 'R' : 'AG' , 'Y' : 'CT' , 'S' : 'GC' , 'W' : 'AT' , 'K' : 'GT' , 'M' : 'AC' , 'B' : 'CGT' , 'D' : 'AGT' , 'H' : 'ACT' , 'V' : 'ACG' , 'N' : 'ACGT' , '-' : '-' } for i in ( ambig_base , unambig_base ) : if not len ( i ) == 1 : raise ValueError ( "only one base may be passed." ) return unambig_base . upper ( ) in iupac_translation [ ambig_base . upper ( ) ]
Tests two bases for equality, accounting for IUPAC ambiguous DNA

    ambiguous base may be IUPAC ambiguous, unambiguous must be one of ACGT