# Path: deepcpg/data/hdf.py
# def _ls(item, recursive=False, groups=False, level=0):
# def ls(filename, group='/', recursive=False, groups=False,
#        regex=None, nb_key=None, must_exist=True):
# def write_data(data, filename):
# def hnames_to_names(hnames):
# def reader(data_files, names, batch_size=128, nb_sample=None, shuffle=False,
#            loop=False):
# def _to_dict(data):
# def read_from(reader, nb_sample=None):
# def read(data_files, names, nb_sample=None, batch_size=1024, *args, **kwargs):
# 
# Path: deepcpg/data/fasta.py
# def read_chromo(filenames, chromo):
#     """Read DNA sequence of chromosome `chromo`.
# 
#     Parameters
#     ----------
#     filenames: list
#         List of FASTA files.
#     chromo: str
#         Chromosome that is read.
# 
#     Returns
#     -------
#     str
#         DNA sequence of chromosome `chromo`.
#     """
#     filename = select_file_by_chromo(filenames, chromo)
#     if not filename:
#         raise ValueError('DNA file for chromosome "%s" not found!' % chromo)
# 
#     fasta_seqs = read_file(filename)
#     if len(fasta_seqs) != 1:
#         raise ValueError('Single sequence expected in file "%s"!' % filename)
#     return fasta_seqs[0].seq
# 
# Path: deepcpg/data/dna.py
# CHAR_TO_INT = OrderedDict([('A', 0), ('T', 1), ('G', 2), ('C', 3), ('N', 4)])


from glob import glob
from numpy import testing as npt
from deepcpg.data import hdf, CPG_NAN
from deepcpg.data.fasta import read_chromo
from deepcpg.data.dna import CHAR_TO_INT
import os
import numpy as np





class TestMake(object):

    def setup_class(self):
        self.data_path = os.path.join(
            os.path.dirname(os.path.realpath(__file__)),
            'data')
        self.data_files = glob(os.path.join(self.data_path, 'c*.h5'))

        names = ['chromo', 'pos',
                 '/inputs/dna',
                 '/inputs/cpg/BS27_4_SER/dist',
                 '/inputs/cpg/BS27_4_SER/state',
                 '/inputs/cpg/BS28_2_SER/dist',
                 '/inputs/cpg/BS28_2_SER/state',
                 '/inputs/annos/exons',
                 '/inputs/annos/CGI',
                 '/outputs/cpg/BS27_4_SER',
                 '/outputs/cpg/BS28_2_SER',
                 '/outputs/cpg_stats/mean',
                 '/outputs/cpg_stats/var',
                 '/outputs/cpg_stats/cat_var',
                 '/outputs/cpg_stats/cat2_var',
                 '/outputs/cpg_stats/diff',
                 '/outputs/cpg_stats/mode',
                 ]

# Path: deepcpg/data/hdf.py
# def _ls(item, recursive=False, groups=False, level=0):
# def ls(filename, group='/', recursive=False, groups=False,
#        regex=None, nb_key=None, must_exist=True):
# def write_data(data, filename):
# def hnames_to_names(hnames):
# def reader(data_files, names, batch_size=128, nb_sample=None, shuffle=False,
#            loop=False):
# def _to_dict(data):
# def read_from(reader, nb_sample=None):
# def read(data_files, names, nb_sample=None, batch_size=1024, *args, **kwargs):
# 
# Path: deepcpg/data/fasta.py
# def read_chromo(filenames, chromo):
#     """Read DNA sequence of chromosome `chromo`.
# 
#     Parameters
#     ----------
#     filenames: list
#         List of FASTA files.
#     chromo: str
#         Chromosome that is read.
# 
#     Returns
#     -------
#     str
#         DNA sequence of chromosome `chromo`.
#     """
#     filename = select_file_by_chromo(filenames, chromo)
#     if not filename:
#         raise ValueError('DNA file for chromosome "%s" not found!' % chromo)
# 
#     fasta_seqs = read_file(filename)
#     if len(fasta_seqs) != 1:
#         raise ValueError('Single sequence expected in file "%s"!' % filename)
#     return fasta_seqs[0].seq
# 
# Path: deepcpg/data/dna.py
# CHAR_TO_INT = OrderedDict([('A', 0), ('T', 1), ('G', 2), ('C', 3), ('N', 4)])


# Path: tests/integration_tests/data/test_data_values.py
from glob import glob
from numpy import testing as npt
from deepcpg.data import hdf, CPG_NAN
from deepcpg.data.fasta import read_chromo
from deepcpg.data.dna import CHAR_TO_INT
import os
import numpy as np






class TestMake(object):

    def setup_class(self):
        self.data_path = os.path.join(
            os.path.dirname(os.path.realpath(__file__)),
            'data')
        self.data_files = glob(os.path.join(self.data_path, 'c*.h5'))

        names = ['chromo', 'pos',
                 '/inputs/dna',
                 '/inputs/cpg/BS27_4_SER/dist',
                 '/inputs/cpg/BS27_4_SER/state',
                 '/inputs/cpg/BS28_2_SER/dist',
                 '/inputs/cpg/BS28_2_SER/state',
                 '/inputs/annos/exons',
                 '/inputs/annos/CGI',
                 '/outputs/cpg/BS27_4_SER',
                 '/outputs/cpg/BS28_2_SER',
                 '/outputs/cpg_stats/mean',
                 '/outputs/cpg_stats/var',
                 '/outputs/cpg_stats/cat_var',
                 '/outputs/cpg_stats/cat2_var',
                 '/outputs/cpg_stats/diff',
                 '/outputs/cpg_stats/mode',
                 ]

        self.data = hdf.read(self.data_files, names)