# 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/report.py
# class Error (Exception): pass
# def header_line():
# def _samtools_depths_at_known_snps_all_wild(sequence_meta, contig_name, cluster, variant_list):
# def _report_lines_for_one_contig(cluster, contig_name, ref_cov_per_contig, pymummer_variants):
# def report_lines(cluster):
# 
# 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):


from ariba import flag, report, summary_cluster_variant
                nuc_to_depth = dict(zip(nucleotides, depths))
                total_depth = sum(depths)
                var_depth = nuc_to_depth.get(var_nucleotide, 0)
                percent_depth = round(100 * var_depth / total_depth, 1)
            except:
                return None

            return data_dict['known_var_change'], percent_depth
        else:
            return None


    @staticmethod
    def _get_nonsynonymous_var(data_dict):
        '''if data_dict has a non synonymous variant, return string:
        ref_name.change. Otherwise return None'''
        has_nonsyn = SummaryCluster._has_nonsynonymous(data_dict)

        if has_nonsyn == 'no':
            return None
        elif data_dict['known_var_change'] == data_dict['ref_ctg_change'] == '.' == data_dict['ref_ctg_effect']:
            raise Error('Unexpected data in ariba summary... \n' + str(data_dict) + '\n... known_var_change, ref_ctg_change, ref_ctg_effect all equal to ".", but has a non synonymous change. Something is inconsistent. Cannot continue')
        else:
            if '.' not in [data_dict['known_var_change'], data_dict['ref_ctg_change']] and \
              data_dict['known_var_change'] != data_dict['ref_ctg_change']:
                raise Error('Unexpected data in ariba summary... \n' + str(data_dict) + '\n... known_var_change != ref_ctg_change. Cannot continue')

            var_group = 'novel', None

            if data_dict['known_var'] == '1' and data_dict['known_var_change'] != '.':

# 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/report.py
# class Error (Exception): pass
# def header_line():
# def _samtools_depths_at_known_snps_all_wild(sequence_meta, contig_name, cluster, variant_list):
# def _report_lines_for_one_contig(cluster, contig_name, ref_cov_per_contig, pymummer_variants):
# def report_lines(cluster):
# 
# 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/summary_cluster.py
from ariba import flag, report, summary_cluster_variant

                nuc_to_depth = dict(zip(nucleotides, depths))
                total_depth = sum(depths)
                var_depth = nuc_to_depth.get(var_nucleotide, 0)
                percent_depth = round(100 * var_depth / total_depth, 1)
            except:
                return None

            return data_dict['known_var_change'], percent_depth
        else:
            return None


    @staticmethod
    def _get_nonsynonymous_var(data_dict):
        '''if data_dict has a non synonymous variant, return string:
        ref_name.change. Otherwise return None'''
        has_nonsyn = SummaryCluster._has_nonsynonymous(data_dict)

        if has_nonsyn == 'no':
            return None
        elif data_dict['known_var_change'] == data_dict['ref_ctg_change'] == '.' == data_dict['ref_ctg_effect']:
            raise Error('Unexpected data in ariba summary... \n' + str(data_dict) + '\n... known_var_change, ref_ctg_change, ref_ctg_effect all equal to ".", but has a non synonymous change. Something is inconsistent. Cannot continue')
        else:
            if '.' not in [data_dict['known_var_change'], data_dict['ref_ctg_change']] and \
              data_dict['known_var_change'] != data_dict['ref_ctg_change']:
                raise Error('Unexpected data in ariba summary... \n' + str(data_dict) + '\n... known_var_change != ref_ctg_change. Cannot continue')

            var_group = 'novel', None

            if data_dict['known_var'] == '1' and data_dict['known_var_change'] != '.':

                var_change = data_dict['known_var_change']