# Path: deepcpg/data/feature_extractor.py
# class KnnCpgFeatureExtractor(object):
# class IntervalFeatureExtractor(object):
# class KmersFeatureExtractor(object):
#     def __init__(self, k=1):
#     def extract(self, x, y, ys):
#     def __larger_equal(self, x, y):
#     def join_intervals(s, e):
#     def index_intervals(x, ys, ye):
#     def extract(self, x, ys, ye):
#     def __init__(self, kmer_len, nb_char=4):
#     def __call__(self, seqs):
# 
# Path: deepcpg/data/dna.py
# CHAR_TO_INT = OrderedDict([('A', 0), ('T', 1), ('G', 2), ('C', 3), ('N', 4)])
# INT_TO_CHAR = {v: k for k, v in CHAR_TO_INT.items()}
# def get_alphabet(special=False, reverse=False):
# def char_to_int(seq):
# def int_to_char(seq, join=True):
# def int_to_onehot(seqs, dim=4):
# def onehot_to_int(seqs, axis=-1):


import numpy as np
import numpy.testing as npt
import six
from deepcpg.data import feature_extractor as fe
from deepcpg.data import dna
        result = f(x, ys, ye)
        npt.assert_array_equal(result, expect)

        x = [-1, 2, 2, 3, 4, 8, 15, 16]
        expect = [-1, 0, 0, -1, 1, 1, 2, -1]
        result = f(x, ys, ye)
        npt.assert_array_equal(result, expect)

    def test_extract(self):
        ys = [2, 4, 12, 17]
        ye = [2, 8, 15, 18]
        e = fe.IntervalFeatureExtractor()

        x = [-1, 2, 2, 3, 4, 8, 15, 16]
        expect = [False, True, True, False, True, True, True, False]
        result = e.extract(x, ys, ye)
        npt.assert_array_equal(result, expect)


class TestKmersFeatureExtractor(object):

    def _translate_seqs(self, seqs):
        if not isinstance(seqs, list):
            seqs = [seqs]
        _seqs = np.array([dna.char_to_int(seq) for seq in seqs], dtype=np.int32)
        return _seqs

    def _kmer_idx(self, kmer):
        idx = 0
        for i, c in enumerate(kmer):

# Path: deepcpg/data/feature_extractor.py
# class KnnCpgFeatureExtractor(object):
# class IntervalFeatureExtractor(object):
# class KmersFeatureExtractor(object):
#     def __init__(self, k=1):
#     def extract(self, x, y, ys):
#     def __larger_equal(self, x, y):
#     def join_intervals(s, e):
#     def index_intervals(x, ys, ye):
#     def extract(self, x, ys, ye):
#     def __init__(self, kmer_len, nb_char=4):
#     def __call__(self, seqs):
# 
# Path: deepcpg/data/dna.py
# CHAR_TO_INT = OrderedDict([('A', 0), ('T', 1), ('G', 2), ('C', 3), ('N', 4)])
# INT_TO_CHAR = {v: k for k, v in CHAR_TO_INT.items()}
# def get_alphabet(special=False, reverse=False):
# def char_to_int(seq):
# def int_to_char(seq, join=True):
# def int_to_onehot(seqs, dim=4):
# def onehot_to_int(seqs, axis=-1):


# Path: tests/deepcpg/data/test_feature_extractor.py
import numpy as np
import numpy.testing as npt
import six
from deepcpg.data import feature_extractor as fe
from deepcpg.data import dna

        result = f(x, ys, ye)
        npt.assert_array_equal(result, expect)

        x = [-1, 2, 2, 3, 4, 8, 15, 16]
        expect = [-1, 0, 0, -1, 1, 1, 2, -1]
        result = f(x, ys, ye)
        npt.assert_array_equal(result, expect)

    def test_extract(self):
        ys = [2, 4, 12, 17]
        ye = [2, 8, 15, 18]
        e = fe.IntervalFeatureExtractor()

        x = [-1, 2, 2, 3, 4, 8, 15, 16]
        expect = [False, True, True, False, True, True, True, False]
        result = e.extract(x, ys, ye)
        npt.assert_array_equal(result, expect)


class TestKmersFeatureExtractor(object):

    def _translate_seqs(self, seqs):
        if not isinstance(seqs, list):
            seqs = [seqs]
        _seqs = np.array([dna.char_to_int(seq) for seq in seqs], dtype=np.int32)
        return _seqs

    def _kmer_idx(self, kmer):
        idx = 0
        for i, c in enumerate(kmer):

            idx += dna.CHAR_TO_INT[c] * 4**i