# Path: hifive/fivec.py
# class FiveC(object):
#     def __init__(self, filename, mode='r', silent=False):
#     def __getitem__(self, key):
#     def __setitem__(self, key, value):
#     def load_data(self, filename):
#     def save(self, out_fname=None):
#     def load(self):
#     def filter_fragments(self, mininteractions=20, mindistance=0, maxdistance=0):
#     def find_distance_parameters(self):
#     def find_probability_fragment_corrections(self, mindistance=0, maxdistance=0, max_iterations=1000,
#                                               minchange=0.0005, learningstep=0.1, precalculate=True, regions=[],
#                                               precorrect=False):
#     def find_express_fragment_corrections(self, mindistance=0, maxdistance=0, iterations=1000, remove_distance=False,
#                                           usereads='cis', regions=[], precorrect=False, logged=True, kr=False):
#     def _find_kr_corrections(self, mindistance=0, maxdistance=0, remove_distance=True, 
#                              usereads='cis', regions=[], precorrect=False, logged=False):
#     def find_binning_fragment_corrections(self, mindistance=0, maxdistance=0, model=['gc', 'len'], num_bins=[10, 10],
#                                           parameters=['even', 'even'], learning_threshold=1.0, max_iterations=100,
#                                           usereads='cis', regions=[], precorrect=False):
#         def find_cor_sums(index, indices, corrections, correction_indices, cor_sums):
#         def find_sigma2(counts, sums, cor_sums, n):
#         def find_ll(counts, sums, cor_sums, n, sigma, sigma2):
#         def temp_ll(x, *args):
#         def temp_ll_grad(x, *args):
#     def find_trans_mean(self):
#     def cis_heatmap(self, region, binsize=0, binbounds=None, start=None, stop=None, startfrag=None, stopfrag=None,
#                     datatype='enrichment', arraytype='full', skipfiltered=False, returnmapping=False,
#                     dynamically_binned=False, minobservations=0, searchdistance=0, expansion_binsize=0,
#                     removefailed=False, image_file=None, **kwargs):
#     def trans_heatmap(self, region1, region2, binsize=1000000, binbounds1=None, start1=None, stop1=None,
#                       startfrag1=None, stopfrag1=None, binbounds2=None, start2=None, stop2=None, startfrag2=None,
#                       stopfrag2=None, datatype='enrichment', arraytype='full', returnmapping=False,
#                       dynamically_binned=False, minobservations=0,  searchdistance=0, expansion_binsize=0,
#                       removefailed=False, skipfiltered=False, image_file=None, **kwargs):
#     def write_heatmap(self, filename, binsize, includetrans=True, datatype='enrichment', arraytype='full',
#                       regions=[], dynamically_binned=False, minobservations=0,  searchdistance=0, expansion_binsize=0,
#                       removefailed=False, format='hdf5'):
#                         Z = rk / v
#                     Z = rk / v
#             M = numpy.sum(counts * cor_sums2 + sums[:, 1] - 2.0 * cor_sums1 * sums[:, 0])
#             N = 1.0 / (n - 1.0) * numpy.sum(2.0 * counts * cor_sums1 - 2.0 * sums[:, 0])
#             O = N / (2.0 * sigma)


import os
import sys
import subprocess
import unittest
import numpy
import h5py
from operator import mul
from hifive import fivec
#!/usr/bin/env python





class FiveCProject(unittest.TestCase):
    def setUp(self):
        self.data_fname = 'test/data/test.fcd'
        self.project_fname = 'test/data/test.fcp'
        self.probability_fname = 'test/data/test_probability.fcp'
        self.express_fname = 'test/data/test_express.fcp'
        self.binning_fname = 'test/data/test_binning.fcp'
        self.raw = h5py.File(self.project_fname, 'r')
        self.probability = fivec.FiveC(self.probability_fname, 'r')

# Path: hifive/fivec.py
# class FiveC(object):
#     def __init__(self, filename, mode='r', silent=False):
#     def __getitem__(self, key):
#     def __setitem__(self, key, value):
#     def load_data(self, filename):
#     def save(self, out_fname=None):
#     def load(self):
#     def filter_fragments(self, mininteractions=20, mindistance=0, maxdistance=0):
#     def find_distance_parameters(self):
#     def find_probability_fragment_corrections(self, mindistance=0, maxdistance=0, max_iterations=1000,
#                                               minchange=0.0005, learningstep=0.1, precalculate=True, regions=[],
#                                               precorrect=False):
#     def find_express_fragment_corrections(self, mindistance=0, maxdistance=0, iterations=1000, remove_distance=False,
#                                           usereads='cis', regions=[], precorrect=False, logged=True, kr=False):
#     def _find_kr_corrections(self, mindistance=0, maxdistance=0, remove_distance=True, 
#                              usereads='cis', regions=[], precorrect=False, logged=False):
#     def find_binning_fragment_corrections(self, mindistance=0, maxdistance=0, model=['gc', 'len'], num_bins=[10, 10],
#                                           parameters=['even', 'even'], learning_threshold=1.0, max_iterations=100,
#                                           usereads='cis', regions=[], precorrect=False):
#         def find_cor_sums(index, indices, corrections, correction_indices, cor_sums):
#         def find_sigma2(counts, sums, cor_sums, n):
#         def find_ll(counts, sums, cor_sums, n, sigma, sigma2):
#         def temp_ll(x, *args):
#         def temp_ll_grad(x, *args):
#     def find_trans_mean(self):
#     def cis_heatmap(self, region, binsize=0, binbounds=None, start=None, stop=None, startfrag=None, stopfrag=None,
#                     datatype='enrichment', arraytype='full', skipfiltered=False, returnmapping=False,
#                     dynamically_binned=False, minobservations=0, searchdistance=0, expansion_binsize=0,
#                     removefailed=False, image_file=None, **kwargs):
#     def trans_heatmap(self, region1, region2, binsize=1000000, binbounds1=None, start1=None, stop1=None,
#                       startfrag1=None, stopfrag1=None, binbounds2=None, start2=None, stop2=None, startfrag2=None,
#                       stopfrag2=None, datatype='enrichment', arraytype='full', returnmapping=False,
#                       dynamically_binned=False, minobservations=0,  searchdistance=0, expansion_binsize=0,
#                       removefailed=False, skipfiltered=False, image_file=None, **kwargs):
#     def write_heatmap(self, filename, binsize, includetrans=True, datatype='enrichment', arraytype='full',
#                       regions=[], dynamically_binned=False, minobservations=0,  searchdistance=0, expansion_binsize=0,
#                       removefailed=False, format='hdf5'):
#                         Z = rk / v
#                     Z = rk / v
#             M = numpy.sum(counts * cor_sums2 + sums[:, 1] - 2.0 * cor_sums1 * sums[:, 0])
#             N = 1.0 / (n - 1.0) * numpy.sum(2.0 * counts * cor_sums1 - 2.0 * sums[:, 0])
#             O = N / (2.0 * sigma)


# Path: test/test_fivec_project.py
import os
import sys
import subprocess
import unittest
import numpy
import h5py
from operator import mul
from hifive import fivec

#!/usr/bin/env python





class FiveCProject(unittest.TestCase):
    def setUp(self):
        self.data_fname = 'test/data/test.fcd'
        self.project_fname = 'test/data/test.fcp'
        self.probability_fname = 'test/data/test_probability.fcp'
        self.express_fname = 'test/data/test_express.fcp'
        self.binning_fname = 'test/data/test_binning.fcp'
        self.raw = h5py.File(self.project_fname, 'r')
        self.probability = fivec.FiveC(self.probability_fname, 'r')

        self.express = fivec.FiveC(self.express_fname, 'r')