# Path: circlator/clean.py
# class Error (Exception): pass
# class Cleaner:
#     def __init__(self,
#         infile,
#         outprefix,
#         min_contig_length=2000,
#         min_contig_percent_match=95,
#         nucmer_diagdiff=25,
#         nucmer_min_id=95,
#         nucmer_min_length=500,
#         nucmer_breaklen=500,
#         keepfile=None,
#         verbose=False
#     ):
#     def _get_contigs_to_keep(self, filename):
#     def _remove_small_contigs(self, infile, outfile, keep=None):
#     def _run_nucmer(self, infile, outfile):
#     def _load_nucmer_hits(self, infile):
#     def _contains(self, hit):
#     def _containing_contigs(self, hits):
#     def _get_containing_contigs(self, hits_dict):
#     def _get_all_containing(self, containing_contigs, name, exclude=None, max_depth=10):
#     def _expand_containing_using_transitivity(self, containing_contigs):
#     def _collapse_list_of_sets(self, sets):
#     def _get_identical_contigs(self, hits_dict):
#     def _longest_contig(self, contig_set, contig_lengths):
#     def _remove_identical_contigs(self, containing_contigs, contig_lengths):
#     def _clean_contigs(self, infile, outfile, containing_contigs, replaced_contigs):
#     def _write_log(self, outfile, prefix, all_contigs, small_removed, containing_contigs, replaced_contigs):
#     def run(self):


import unittest
import filecmp
import os
import pymummer
from circlator import clean
        self.assertEqual(expected_all, got_all)
        os.unlink(got_out)


    def test_load_nucmer_hits(self):
        '''test _load_nucmer_hits'''
        cleaner = clean.Cleaner('infile', 'outprefix')
        expected_lengths = {'contig1': 1000, 'contig2': 1002, 'contig3': 960, 'contig4': 540}
        hits = [
            '\t'.join(['1', '410', '1', '410', '410', '410', '100.00', '1000', '960', '1', '1', 'contig1', 'contig3']),
            '\t'.join(['481', '960', '481', '960', '480', '480', '100.00', '1002', '960', '1', '1', 'contig2', 'contig3']),
            '\t'.join(['481', '780', '241', '540', '300', '300', '100.00', '1002', '540', '1', '1', 'contig2', 'contig4']),
            '\t'.join(['1', '410', '1', '410', '410', '410', '100.00', '960', '1000', '1', '1', 'contig3', 'contig1']),
        ]
        hits = [pymummer.alignment.Alignment(x) for x in hits]

        expected_hits = {
            'contig3': [hits[0], hits[1]],
            'contig4': [hits[2]],
            'contig1': [hits[3]],
        }

        coords_file = os.path.join(data_dir, 'clean_test_load_nucmer_hits.coords')
        got_lengths, got_hits = cleaner._load_nucmer_hits(coords_file)
        self.assertEqual(expected_lengths, got_lengths)
        self.assertEqual(expected_hits, got_hits)


    def test_contains(self):
        '''test _contains'''

# Path: circlator/clean.py
# class Error (Exception): pass
# class Cleaner:
#     def __init__(self,
#         infile,
#         outprefix,
#         min_contig_length=2000,
#         min_contig_percent_match=95,
#         nucmer_diagdiff=25,
#         nucmer_min_id=95,
#         nucmer_min_length=500,
#         nucmer_breaklen=500,
#         keepfile=None,
#         verbose=False
#     ):
#     def _get_contigs_to_keep(self, filename):
#     def _remove_small_contigs(self, infile, outfile, keep=None):
#     def _run_nucmer(self, infile, outfile):
#     def _load_nucmer_hits(self, infile):
#     def _contains(self, hit):
#     def _containing_contigs(self, hits):
#     def _get_containing_contigs(self, hits_dict):
#     def _get_all_containing(self, containing_contigs, name, exclude=None, max_depth=10):
#     def _expand_containing_using_transitivity(self, containing_contigs):
#     def _collapse_list_of_sets(self, sets):
#     def _get_identical_contigs(self, hits_dict):
#     def _longest_contig(self, contig_set, contig_lengths):
#     def _remove_identical_contigs(self, containing_contigs, contig_lengths):
#     def _clean_contigs(self, infile, outfile, containing_contigs, replaced_contigs):
#     def _write_log(self, outfile, prefix, all_contigs, small_removed, containing_contigs, replaced_contigs):
#     def run(self):


# Path: circlator/tests/clean_test.py
import unittest
import filecmp
import os
import pymummer
from circlator import clean

        self.assertEqual(expected_all, got_all)
        os.unlink(got_out)


    def test_load_nucmer_hits(self):
        '''test _load_nucmer_hits'''
        cleaner = clean.Cleaner('infile', 'outprefix')
        expected_lengths = {'contig1': 1000, 'contig2': 1002, 'contig3': 960, 'contig4': 540}
        hits = [
            '\t'.join(['1', '410', '1', '410', '410', '410', '100.00', '1000', '960', '1', '1', 'contig1', 'contig3']),
            '\t'.join(['481', '960', '481', '960', '480', '480', '100.00', '1002', '960', '1', '1', 'contig2', 'contig3']),
            '\t'.join(['481', '780', '241', '540', '300', '300', '100.00', '1002', '540', '1', '1', 'contig2', 'contig4']),
            '\t'.join(['1', '410', '1', '410', '410', '410', '100.00', '960', '1000', '1', '1', 'contig3', 'contig1']),
        ]
        hits = [pymummer.alignment.Alignment(x) for x in hits]

        expected_hits = {
            'contig3': [hits[0], hits[1]],
            'contig4': [hits[2]],
            'contig1': [hits[3]],
        }

        coords_file = os.path.join(data_dir, 'clean_test_load_nucmer_hits.coords')
        got_lengths, got_hits = cleaner._load_nucmer_hits(coords_file)
        self.assertEqual(expected_lengths, got_lengths)
        self.assertEqual(expected_hits, got_hits)


    def test_contains(self):
        '''test _contains'''

        cleaner = clean.Cleaner('infile', 'outprefix')