@classmethod
def encode(cls, bytes_encoded):
    """
        encodes a DNA bytes string using 2 bits per base. N (and other ambiguous nucleotides)
        are randomized

        :param bytes bytes_encoded: a bytes string containing A, C, G, T nucleotides.
        :return int: encoded sequence
        """
    encoded = 0
    for character in bytes_encoded:
        encoded <<= 2
        encoded += cls.encoding_map[character]
    return encoded
