# Path: alfpy/word_d2.py
# class Distance:
#     def __init__(self, vector_list):
#     def pwdist_d2(self, seqidx1, seqidx2):
#     def pwdist_d2_squareroot(self, seqidx1, seqidx2):
#     def set_disttype(self, disttype):
# def main():
# 
# Path: alfpy/word_pattern.py
# class Pattern:
#     def __init__(self, pat_list, occr_list, pos_list=None):
#     def _alfree_format(self):
#     def _teiresias_format(self):
#     def format(self, formattype=None):
#     def reduce_alphabet(self, alphabet_dict):
#     def merge_revcomp(self):
#         def revcomp(s):
#     def __repr__(self):
#     def __str__(self):
# def _create_wordpattern(seq_list, k):
# def _create_wordpattern_positions(seq_list, k):
# def create(seq_list, word_size=1, wordpos=False):
# def create_from_fasta(handle, word_size=1, wordpos=False):
# def create_from_bigfasta(filename, k=1):
# def run_teiresias(input_filename, w=2, l=2, k=2, output_filename=None):
# def read(handle):
# def main():
# 
# Path: alfpy/word_vector.py
# class Counts:
# class Bools(Counts):
# class Freqs(Counts):
# class FreqsStd(Freqs):
# class WeightModel:
# class CountsWeight(Counts):
# class FreqsWeight(Freqs):
# class WordModel:
# class EqualFreqs(WordModel):
# class EquilibriumFreqs(WordModel):
# class Composition(Counts):
#     def __init__(self, seq_lengths, patterns):
#     def _get_counts_occurrence(seq_count, patterns):
#     def __getitem__(self, seqidx):
#     def __str__(self):
#     def format(self, decimal_places=3):
#     def __init__(self, seq_lengths, patterns):
#     def __init__(self, seq_lengths, patterns):
#     def __relative_freqs(self):
#     def __init__(self, seq_lengths, patterns, freqmodel):
#     def __overlaps(self, freqmodel):
#     def __standardize_freqs(self, freqmodel):
#     def __init__(self, char_weights, wtype='content'):
#     def content(self, vector, patterns):
#     def __init__(self, seq_lengths, patterns, weightmodel):
#     def __init__(self, seq_lengths, patterns, weightmodel):
#     def probabilities(self, word):
#     def overlap_capability(self, word):
#     def var(self, word, seq_len, word_len=None, overlap_capability=None,
#             word_probs=None):
#     def __init__(self, alphabet_size):
#     def probabilities(self, word):
#     def __init__(self, equilibrium_frequencies):
#     def probabilities(self, word):
#     def __init__(self, seq_lengths, patterns, patterns1, patterns2):
#     def __check_patlen(self):
#     def __markov_chain_freqs(self, seqnum, seqlen, patnum, patlen, pattern):
#     def __composition(self, seqnum, seqlen):
# def _read_charval_file(handle):
# def main():
# 
# 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 unittest
from alfpy import word_d2
from alfpy import word_pattern
from alfpy import word_vector
from alfpy.utils import distmatrix
from . import utils
        ]
        self.assertEqual(matrix.format(), "\n".join(exp))

    def test_counts_from1_to1(self):
        dist = word_d2.Distance([self.counts[0]])
        matrix = distmatrix.create(self.pep_records.id_list, dist)
        exp = [
            '   4',
            'seq1       0 37 57 140',
            'seq2       37 0 28 137',
            'seq3       57 28 0 111',
            'seq4       140 137 111 0'
        ]
        self.assertEqual(matrix.format(decimal_places=0), "\n".join(exp))

    def test_freqs_from1_to4_d2_squareroot(self):
        dist = word_d2.Distance(self.freqs)
        dist.set_disttype('d2_squareroot')
        matrix = distmatrix.create(self.pep_records.id_list, dist)
        exp = [
            "   4",
            "seq1       0.0000000 0.1770847 0.2394063 0.3194113",
            "seq2       0.1770847 0.0000000 0.1933073 0.3011969",
            "seq3       0.2394063 0.1933073 0.0000000 0.2950560",
            "seq4       0.3194113 0.3011969 0.2950560 0.0000000"

        ]
        self.assertEqual(matrix.format(), "\n".join(exp))

    def test_set_disttype_throws_exception(self):

# Path: alfpy/word_d2.py
# class Distance:
#     def __init__(self, vector_list):
#     def pwdist_d2(self, seqidx1, seqidx2):
#     def pwdist_d2_squareroot(self, seqidx1, seqidx2):
#     def set_disttype(self, disttype):
# def main():
# 
# Path: alfpy/word_pattern.py
# class Pattern:
#     def __init__(self, pat_list, occr_list, pos_list=None):
#     def _alfree_format(self):
#     def _teiresias_format(self):
#     def format(self, formattype=None):
#     def reduce_alphabet(self, alphabet_dict):
#     def merge_revcomp(self):
#         def revcomp(s):
#     def __repr__(self):
#     def __str__(self):
# def _create_wordpattern(seq_list, k):
# def _create_wordpattern_positions(seq_list, k):
# def create(seq_list, word_size=1, wordpos=False):
# def create_from_fasta(handle, word_size=1, wordpos=False):
# def create_from_bigfasta(filename, k=1):
# def run_teiresias(input_filename, w=2, l=2, k=2, output_filename=None):
# def read(handle):
# def main():
# 
# Path: alfpy/word_vector.py
# class Counts:
# class Bools(Counts):
# class Freqs(Counts):
# class FreqsStd(Freqs):
# class WeightModel:
# class CountsWeight(Counts):
# class FreqsWeight(Freqs):
# class WordModel:
# class EqualFreqs(WordModel):
# class EquilibriumFreqs(WordModel):
# class Composition(Counts):
#     def __init__(self, seq_lengths, patterns):
#     def _get_counts_occurrence(seq_count, patterns):
#     def __getitem__(self, seqidx):
#     def __str__(self):
#     def format(self, decimal_places=3):
#     def __init__(self, seq_lengths, patterns):
#     def __init__(self, seq_lengths, patterns):
#     def __relative_freqs(self):
#     def __init__(self, seq_lengths, patterns, freqmodel):
#     def __overlaps(self, freqmodel):
#     def __standardize_freqs(self, freqmodel):
#     def __init__(self, char_weights, wtype='content'):
#     def content(self, vector, patterns):
#     def __init__(self, seq_lengths, patterns, weightmodel):
#     def __init__(self, seq_lengths, patterns, weightmodel):
#     def probabilities(self, word):
#     def overlap_capability(self, word):
#     def var(self, word, seq_len, word_len=None, overlap_capability=None,
#             word_probs=None):
#     def __init__(self, alphabet_size):
#     def probabilities(self, word):
#     def __init__(self, equilibrium_frequencies):
#     def probabilities(self, word):
#     def __init__(self, seq_lengths, patterns, patterns1, patterns2):
#     def __check_patlen(self):
#     def __markov_chain_freqs(self, seqnum, seqlen, patnum, patlen, pattern):
#     def __composition(self, seqnum, seqlen):
# def _read_charval_file(handle):
# def main():
# 
# 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_word_d2.py
import unittest
from alfpy import word_d2
from alfpy import word_pattern
from alfpy import word_vector
from alfpy.utils import distmatrix
from . import utils

        ]
        self.assertEqual(matrix.format(), "\n".join(exp))

    def test_counts_from1_to1(self):
        dist = word_d2.Distance([self.counts[0]])
        matrix = distmatrix.create(self.pep_records.id_list, dist)
        exp = [
            '   4',
            'seq1       0 37 57 140',
            'seq2       37 0 28 137',
            'seq3       57 28 0 111',
            'seq4       140 137 111 0'
        ]
        self.assertEqual(matrix.format(decimal_places=0), "\n".join(exp))

    def test_freqs_from1_to4_d2_squareroot(self):
        dist = word_d2.Distance(self.freqs)
        dist.set_disttype('d2_squareroot')
        matrix = distmatrix.create(self.pep_records.id_list, dist)
        exp = [
            "   4",
            "seq1       0.0000000 0.1770847 0.2394063 0.3194113",
            "seq2       0.1770847 0.0000000 0.1933073 0.3011969",
            "seq3       0.2394063 0.1933073 0.0000000 0.2950560",
            "seq4       0.3194113 0.3011969 0.2950560 0.0000000"

        ]
        self.assertEqual(matrix.format(), "\n".join(exp))

    def test_set_disttype_throws_exception(self):

        dist = word_d2.Distance(self.freqs)