# 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/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):


import pyfastaq
from ariba import report, flag
        first_line = True

        for line in f:
            line = line.rstrip()

            if first_line:
                expected_first_line = '#' + '\t'.join(report.columns)
                if line != expected_first_line:
                    pyfastaq.utils.close(f)
                    raise Error('Error reading report file. Expected first line of file is\n' + expected_first_line + '\nbut got:\n' + line)
                first_line = False
            else:
                line_dict = ReportFilter._report_line_to_dict(line)
                if line_dict is None:
                    pyfastaq.utils.close(f)
                    raise Error('Error reading report file at this line:\n' + line)
                ref_name = line_dict['ref_name']
                ctg_name = line_dict['ctg']
                if ref_name not in report_dict:
                    report_dict[ref_name] = {}
                if ctg_name not in report_dict[ref_name]:
                    report_dict[ref_name][ctg_name] = []

                report_dict[ref_name][ctg_name].append(line_dict)

        pyfastaq.utils.close(f)
        return report_dict


    @staticmethod

# 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/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_filter.py
import pyfastaq
from ariba import report, flag

        first_line = True

        for line in f:
            line = line.rstrip()

            if first_line:
                expected_first_line = '#' + '\t'.join(report.columns)
                if line != expected_first_line:
                    pyfastaq.utils.close(f)
                    raise Error('Error reading report file. Expected first line of file is\n' + expected_first_line + '\nbut got:\n' + line)
                first_line = False
            else:
                line_dict = ReportFilter._report_line_to_dict(line)
                if line_dict is None:
                    pyfastaq.utils.close(f)
                    raise Error('Error reading report file at this line:\n' + line)
                ref_name = line_dict['ref_name']
                ctg_name = line_dict['ctg']
                if ref_name not in report_dict:
                    report_dict[ref_name] = {}
                if ctg_name not in report_dict[ref_name]:
                    report_dict[ref_name][ctg_name] = []

                report_dict[ref_name][ctg_name].append(line_dict)

        pyfastaq.utils.close(f)
        return report_dict


    @staticmethod

    def _flag_passes_filter(flag, exclude_flags):