cogent3.core.alphabet.bytes_to_array#
- class bytes_to_array(chars: bytes, dtype: type[unsignedinteger], delete: bytes | None = None, dest: bytes | None = None)#
wrapper around convert_alphabet. It defines a linear mapping from provided characters to uint8. The resulting object is callable, taking a bytes object and returning a numpy array.
Methods
__call__(seq)Call self as a function.
- __init__(chars: bytes, dtype: type[unsignedinteger], delete: bytes | None = None, dest: bytes | None = None) None#
- Parameters:
- chars
series of characters in the source alphabet
- delete
characters to be deleted from the result
- dest
destination bytes that
charsare mapped to. If None (the default), usesbytes(bytearray(range(len(chars))))and requirescharsto be unique. If provided, must have the same length aschars; duplicates incharsare permitted so callers can collapse multiple source characters (eg case variants) onto the same index.
Methods
__init__(chars, dtype[, delete, dest])