# Path: ariba/flag.py
# class Error (Exception): pass
# class Flag:
#     def __init__(self, n=0):
#     def set_flag(self, n):
#     def add(self, f):
#     def to_number(self):
#     def __eq__(self, other):
#     def __str__(self):
#     def to_long_string(self):
#     def has(self, s):
#     def to_comma_separated_string(self):
# 
# Path: ariba/summary_cluster.py
# class Error (Exception): pass
# class SummaryCluster:
#     def __init__(self, min_pc_id=90):
#     def __eq__(self, other):
#     def line2dict(cls, line, filename=None):
#     def add_data_dict(self, data_dict):
#     def _pc_id_and_read_depth_of_longest(self):
#     def _has_any_part_of_ref_assembled(self):
#     def _to_cluster_summary_assembled(self):
#     def _has_known_variant(cls, data_dict):
#     def _has_any_known_variant(self):
#     def _has_nonsynonymous(cls, data_dict):
#     def _has_any_nonsynonymous(self):
#     def _has_novel_nonsynonymous(cls, data_dict):
#     def _has_any_novel_nonsynonymous(self):
#     def _to_cluster_summary_has_known_nonsynonymous(self, assembled_summary):
#     def _to_cluster_summary_has_novel_nonsynonymous(self, assembled_summary):
#     def _to_cluster_summary_has_nonsynonymous(self, assembled_summary):
#     def _get_known_noncoding_het_snp(data_dict):
#     def _get_nonsynonymous_var(data_dict):
#     def _has_match(self, assembled_summary):
#     def has_var_groups(self):
#     def column_summary_data(self):
#     def non_synon_variants(self):
#     def known_noncoding_het_snps(self):
#     def _get_all_nonsynon_variants_set(cls, data_dicts):
#     def gather_data(self):
# 
# Path: ariba/summary_cluster_variant.py
# class Error (Exception): pass
# class SummaryClusterVariant:
#     def __init__(self, data_dict):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def _has_nonsynonymous(cls, data_dict):
#     def _filter_depths(cls, ref_base, depths):
#     def _get_is_het_and_percent(cls, data_dict):
#     def _get_nonsynon_variant_data(self, data_dict):


import unittest
import os
from ariba import flag, summary_cluster, summary_cluster_variant
        got = summary_cluster.SummaryCluster._get_all_nonsynon_variants_set(data_dicts)
        self.assertEqual(expected, got)


    def test_gather_data(self):
        '''test gather_data'''
        lines = [
            'ariba_ref1\tref1\t0\t0\t531\t78\tcluster1\t120\t95\t98.42\tctg_name\t279\t24.4\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\tsome free text',
            'ariba_ref1\tref1\t1\t0\t531\t78\tcluster1\t120\t100\t98.33\tctg_name\t279\t24.4\t1\tSNP\tn\tI14L\t1\tI14L\tSNP\t13\t13\tA\t84\t84\tT\t17\tT\t17\tnon_coding1:0:0:I14L:.:foo_bar\tspam eggs',
            'ariba_ref1\tref1\t0\t0\t531\t78\tcluster1\t120\t100\t98.33\tctg_name\t279\t24.4\t1\tSNP\tn\tA14T\t1\tA14T\tSNP\t13\t13\tA\t84\t84\tT\t40\tT,A\t10,30\tnon_coding1:0:0:A14T:id1:foo_bar\tspam eggs',
            'ariba_ref1\tref1\t0\t0\t531\t78\tcluster1\t120\t100\t98.33\tctg_name\t279\t24.4\t1\tSNP\tn\tA14T\t1\tA14T\tSNP\t13\t13\tA\t84\t84\tT\t40\tT,A,G\t20,10,10\tnon_coding1:0:0:A14T:id1:foo_bar\tspam eggs',
        ]

        data_dicts = [summary_cluster.SummaryCluster.line2dict(x) for x in lines]
        cluster = summary_cluster.SummaryCluster()
        for data_dict in data_dicts:
            cluster.add_data_dict(data_dict)

        cluster.gather_data()
        expected_summary = {
            'assembled': 'yes',
            'match': 'yes',
            'ref_seq': 'ref1',
            'pct_id': '98.33',
            'ctg_cov': '24.4',
            'known_var': 'yes',
            'novel_var': 'no',
        }
        self.assertEqual(expected_summary, cluster.summary)


# Path: ariba/flag.py
# class Error (Exception): pass
# class Flag:
#     def __init__(self, n=0):
#     def set_flag(self, n):
#     def add(self, f):
#     def to_number(self):
#     def __eq__(self, other):
#     def __str__(self):
#     def to_long_string(self):
#     def has(self, s):
#     def to_comma_separated_string(self):
# 
# Path: ariba/summary_cluster.py
# class Error (Exception): pass
# class SummaryCluster:
#     def __init__(self, min_pc_id=90):
#     def __eq__(self, other):
#     def line2dict(cls, line, filename=None):
#     def add_data_dict(self, data_dict):
#     def _pc_id_and_read_depth_of_longest(self):
#     def _has_any_part_of_ref_assembled(self):
#     def _to_cluster_summary_assembled(self):
#     def _has_known_variant(cls, data_dict):
#     def _has_any_known_variant(self):
#     def _has_nonsynonymous(cls, data_dict):
#     def _has_any_nonsynonymous(self):
#     def _has_novel_nonsynonymous(cls, data_dict):
#     def _has_any_novel_nonsynonymous(self):
#     def _to_cluster_summary_has_known_nonsynonymous(self, assembled_summary):
#     def _to_cluster_summary_has_novel_nonsynonymous(self, assembled_summary):
#     def _to_cluster_summary_has_nonsynonymous(self, assembled_summary):
#     def _get_known_noncoding_het_snp(data_dict):
#     def _get_nonsynonymous_var(data_dict):
#     def _has_match(self, assembled_summary):
#     def has_var_groups(self):
#     def column_summary_data(self):
#     def non_synon_variants(self):
#     def known_noncoding_het_snps(self):
#     def _get_all_nonsynon_variants_set(cls, data_dicts):
#     def gather_data(self):
# 
# Path: ariba/summary_cluster_variant.py
# class Error (Exception): pass
# class SummaryClusterVariant:
#     def __init__(self, data_dict):
#     def __eq__(self, other):
#     def __hash__(self):
#     def __str__(self):
#     def _has_nonsynonymous(cls, data_dict):
#     def _filter_depths(cls, ref_base, depths):
#     def _get_is_het_and_percent(cls, data_dict):
#     def _get_nonsynon_variant_data(self, data_dict):


# Path: ariba/tests/summary_cluster_test.py
import unittest
import os
from ariba import flag, summary_cluster, summary_cluster_variant

        got = summary_cluster.SummaryCluster._get_all_nonsynon_variants_set(data_dicts)
        self.assertEqual(expected, got)


    def test_gather_data(self):
        '''test gather_data'''
        lines = [
            'ariba_ref1\tref1\t0\t0\t531\t78\tcluster1\t120\t95\t98.42\tctg_name\t279\t24.4\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\t.\tsome free text',
            'ariba_ref1\tref1\t1\t0\t531\t78\tcluster1\t120\t100\t98.33\tctg_name\t279\t24.4\t1\tSNP\tn\tI14L\t1\tI14L\tSNP\t13\t13\tA\t84\t84\tT\t17\tT\t17\tnon_coding1:0:0:I14L:.:foo_bar\tspam eggs',
            'ariba_ref1\tref1\t0\t0\t531\t78\tcluster1\t120\t100\t98.33\tctg_name\t279\t24.4\t1\tSNP\tn\tA14T\t1\tA14T\tSNP\t13\t13\tA\t84\t84\tT\t40\tT,A\t10,30\tnon_coding1:0:0:A14T:id1:foo_bar\tspam eggs',
            'ariba_ref1\tref1\t0\t0\t531\t78\tcluster1\t120\t100\t98.33\tctg_name\t279\t24.4\t1\tSNP\tn\tA14T\t1\tA14T\tSNP\t13\t13\tA\t84\t84\tT\t40\tT,A,G\t20,10,10\tnon_coding1:0:0:A14T:id1:foo_bar\tspam eggs',
        ]

        data_dicts = [summary_cluster.SummaryCluster.line2dict(x) for x in lines]
        cluster = summary_cluster.SummaryCluster()
        for data_dict in data_dicts:
            cluster.add_data_dict(data_dict)

        cluster.gather_data()
        expected_summary = {
            'assembled': 'yes',
            'match': 'yes',
            'ref_seq': 'ref1',
            'pct_id': '98.33',
            'ctg_cov': '24.4',
            'known_var': 'yes',
            'novel_var': 'no',
        }
        self.assertEqual(expected_summary, cluster.summary)


        cluster_vars = [summary_cluster_variant.SummaryClusterVariant(x) for x in data_dicts]