# Path: kipoiseq/utils.py
# DNA = ("A", "C", "G", "T")


from typing import Any
from kipoiseq.utils import DNA
from copy import deepcopy
from six import string_types
import numpy as np
    """
    # Req: all alphabets have the same length
    if isinstance(neutral_alphabet, str):
        neutral_alphabet = [neutral_alphabet]

    nchar = len(alphabet[0])
    for l in (*alphabet,  *neutral_alphabet):
        assert len(l) == nchar
    assert len(seq) % nchar == 0  # since we are using striding

    alphabet_dict = _get_alphabet_dict(alphabet)
    for l in neutral_alphabet:
        alphabet_dict[l] = -1
    # current performance bottleneck
    return np.array([alphabet_dict[seq[(i * nchar):((i + 1) * nchar)]] for i in range(len(seq) // nchar)])


def token2one_hot(tokens, alphabet_size=4, neutral_value=.25, dtype=None):
    """
    Note: everything out of the alphabet is transformed into `np.zeros(alphabet_size)`
    """
    arr = np.zeros((len(tokens), alphabet_size), dtype=dtype)

    tokens_range = np.arange(len(tokens), dtype=int)
    arr[tokens_range[tokens >= 0], tokens[tokens >= 0]] = 1
    if neutral_value != 0:
        arr[tokens_range[tokens < 0], :] = neutral_value
    return arr



# Path: kipoiseq/utils.py
# DNA = ("A", "C", "G", "T")


# Path: kipoiseq/transforms/functional.py
from typing import Any
from kipoiseq.utils import DNA
from copy import deepcopy
from six import string_types
import numpy as np

    """
    # Req: all alphabets have the same length
    if isinstance(neutral_alphabet, str):
        neutral_alphabet = [neutral_alphabet]

    nchar = len(alphabet[0])
    for l in (*alphabet,  *neutral_alphabet):
        assert len(l) == nchar
    assert len(seq) % nchar == 0  # since we are using striding

    alphabet_dict = _get_alphabet_dict(alphabet)
    for l in neutral_alphabet:
        alphabet_dict[l] = -1
    # current performance bottleneck
    return np.array([alphabet_dict[seq[(i * nchar):((i + 1) * nchar)]] for i in range(len(seq) // nchar)])


def token2one_hot(tokens, alphabet_size=4, neutral_value=.25, dtype=None):
    """
    Note: everything out of the alphabet is transformed into `np.zeros(alphabet_size)`
    """
    arr = np.zeros((len(tokens), alphabet_size), dtype=dtype)

    tokens_range = np.arange(len(tokens), dtype=int)
    arr[tokens_range[tokens >= 0], tokens[tokens >= 0]] = 1
    if neutral_value != 0:
        arr[tokens_range[tokens < 0], :] = neutral_value
    return arr



def one_hot(seq, alphabet=DNA, neutral_alphabet=['N'], neutral_value=.25, dtype=None):