# Path: alfpy/word_distance.py
# def geometric_mean(values):
#     def pwdist_euclid_squared(self, seq1idx, seq2idx):
#     def pwdist_euclid_norm(self, seq1idx, seq2idx):
#     def pwdist_euclid_seqlen1(self, seq1idx, seq2idx):
#     def pwdist_euclid_seqlen2(self, seq1idx, seq2idx):
#     def __angle_cos(self, seq1idx, seq2idx):
#     def pwdist_angle_cos_diss(self, seq1idx, seq2idx):
#     def pwdist_angle_cos_evol(self, seq1idx, seq2idx):
#     def pwdist_manhattan(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_add(self, seq1idx, seq2idx):
#     def pwdist_chebyshev(self, seq1idx, seq2idx):
#     def pwdist_braycurtis(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_mult(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_mult1(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_mult2(self, seq1idx, seq2idx):
#     def pwdist_kld(self, seq1idx, seq2idx):
#     def pwdist_jsd(self, seq1idx, seq2idx):
#         def entropy(p, q):
#     def pwdist_google(self, seq1idx, seq2idx):
#     def pwdist_lcc(self, seq1idx, seq2idx):
#     def pwdist_canberra(self, seq1idx, seq2idx):
#     def pwdist_minkowski(self, seq1idx, seq2idx, p=2):
# def main():
# class Distance(distance.Distance):
#         _P = x + 0.0000001
#         _Q = y + 0.0000001
#         _M = 0.5 * (_P + _Q)
# 
# Path: alfpy/utils/distmatrix.py
# def create(id_list, distance):
# def read_highcharts_matrix(id_list, data):
#     def __init__(self, id_list, data):
#     def normalize(self):
#     def __iter__(self):
#     def writer(self, handle, f, decimal_places):
#     def display(self, f="phylip", decimal_places=7):
#     def write_to_file(self, handle, f="phylip", decimal_places=7):
#     def highcharts(self):
#     def format(self, decimal_places=7):
#     def min(self):
#     def max(self):
#     def is_zero(self):
#     def __repr__(self):
# class Matrix():


import numpy as np
import os
import unittest
from alfpy import word_distance
from alfpy.utils import distmatrix
from . import utils
        self.assertEqual(result, "\n".join(exp))

    def test_write_to_file_pairwise_decimal3(self):
        oh = open(self.output_filename, 'w')
        self.matrix.write_to_file(oh, 'pairwise', 3)
        oh.close()
        fh = open(self.output_filename)
        result = fh.read()
        fh.close()
        os.remove(self.output_filename)
        exp = [
            "seq1\tseq2\t0.353",
            "seq1\tseq3\t0.355",
            "seq2\tseq3\t0.295\n"
        ]
        self.assertEqual(result, "\n".join(exp))

    def test_iter(self):
        exp = [(0, 1, 'seq1', 'seq2', 0.35315869999999999),
               (0, 2, 'seq1', 'seq3', 0.35509332999999998),
               (1, 2, 'seq2', 'seq3', 0.29539399999999999)]
        self.assertEqual(list(self.matrix), exp)

    def test_create_matrix(self):
        l = [[3, 6, 4, 1, 3, 4, 3, 0, 1, 1, 6, 4, 5, 0, 3, 4],
             [0, 3, 0, 3, 0, 0, 0, 2, 9, 0, 3, 3, 0, 6, 3, 6],
             [9, 0, 0, 3, 0, 0, 0, 2, 6, 0, 3, 3, 0, 3, 3, 3]]
        vector = np.array(l)
        dist = word_distance.Distance(vector, 'minkowski')
        id_list = ['seq1', 'seq2', 'seq3']

# Path: alfpy/word_distance.py
# def geometric_mean(values):
#     def pwdist_euclid_squared(self, seq1idx, seq2idx):
#     def pwdist_euclid_norm(self, seq1idx, seq2idx):
#     def pwdist_euclid_seqlen1(self, seq1idx, seq2idx):
#     def pwdist_euclid_seqlen2(self, seq1idx, seq2idx):
#     def __angle_cos(self, seq1idx, seq2idx):
#     def pwdist_angle_cos_diss(self, seq1idx, seq2idx):
#     def pwdist_angle_cos_evol(self, seq1idx, seq2idx):
#     def pwdist_manhattan(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_add(self, seq1idx, seq2idx):
#     def pwdist_chebyshev(self, seq1idx, seq2idx):
#     def pwdist_braycurtis(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_mult(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_mult1(self, seq1idx, seq2idx):
#     def pwdist_diff_abs_mult2(self, seq1idx, seq2idx):
#     def pwdist_kld(self, seq1idx, seq2idx):
#     def pwdist_jsd(self, seq1idx, seq2idx):
#         def entropy(p, q):
#     def pwdist_google(self, seq1idx, seq2idx):
#     def pwdist_lcc(self, seq1idx, seq2idx):
#     def pwdist_canberra(self, seq1idx, seq2idx):
#     def pwdist_minkowski(self, seq1idx, seq2idx, p=2):
# def main():
# class Distance(distance.Distance):
#         _P = x + 0.0000001
#         _Q = y + 0.0000001
#         _M = 0.5 * (_P + _Q)
# 
# Path: alfpy/utils/distmatrix.py
# def create(id_list, distance):
# def read_highcharts_matrix(id_list, data):
#     def __init__(self, id_list, data):
#     def normalize(self):
#     def __iter__(self):
#     def writer(self, handle, f, decimal_places):
#     def display(self, f="phylip", decimal_places=7):
#     def write_to_file(self, handle, f="phylip", decimal_places=7):
#     def highcharts(self):
#     def format(self, decimal_places=7):
#     def min(self):
#     def max(self):
#     def is_zero(self):
#     def __repr__(self):
# class Matrix():


# Path: tests/test_distmatrix.py
import numpy as np
import os
import unittest
from alfpy import word_distance
from alfpy.utils import distmatrix
from . import utils

        self.assertEqual(result, "\n".join(exp))

    def test_write_to_file_pairwise_decimal3(self):
        oh = open(self.output_filename, 'w')
        self.matrix.write_to_file(oh, 'pairwise', 3)
        oh.close()
        fh = open(self.output_filename)
        result = fh.read()
        fh.close()
        os.remove(self.output_filename)
        exp = [
            "seq1\tseq2\t0.353",
            "seq1\tseq3\t0.355",
            "seq2\tseq3\t0.295\n"
        ]
        self.assertEqual(result, "\n".join(exp))

    def test_iter(self):
        exp = [(0, 1, 'seq1', 'seq2', 0.35315869999999999),
               (0, 2, 'seq1', 'seq3', 0.35509332999999998),
               (1, 2, 'seq2', 'seq3', 0.29539399999999999)]
        self.assertEqual(list(self.matrix), exp)

    def test_create_matrix(self):
        l = [[3, 6, 4, 1, 3, 4, 3, 0, 1, 1, 6, 4, 5, 0, 3, 4],
             [0, 3, 0, 3, 0, 0, 0, 2, 9, 0, 3, 3, 0, 6, 3, 6],
             [9, 0, 0, 3, 0, 0, 0, 2, 6, 0, 3, 3, 0, 3, 3, 3]]
        vector = np.array(l)
        dist = word_distance.Distance(vector, 'minkowski')
        id_list = ['seq1', 'seq2', 'seq3']

        matrix = distmatrix.create(id_list, dist)