# Path: circlator/assembly.py
# class Error (Exception): pass
# class Assembly:
#     def __init__(self, path, assembler):
#     def _file_exists(filename):
#     def _set_filenames(self):
#     def get_contigs(self):
#     def _circular_contigs_from_spades_before_3_6_1(cls, fastg_file):
#     def _spades_contigs_paths_to_dict(cls, filename):
#     def _circular_edges_to_edge_numbers_dict(cls, circular_edges):
#     def _circular_contigs_from_spades_after_3_6_1(assembly_graph_fastg, contigs_paths):
#     def _circular_contigs_from_canu_gfa(gfa_file):
#     def circular_contigs(self):


import unittest
import shutil
import filecmp
import copy
import os
import pyfastaq
from circlator import assembly
        '''Test _circular_contigs_from_spades_before_3_6_1'''
        fastg_file = os.path.join(data_dir, 'assembly_test_circular_contigs_from_spades_before_3_6_1.fastg')
        got = assembly.Assembly._circular_contigs_from_spades_before_3_6_1(fastg_file)
        expected = {'NODE_1_length_5_cov_42.42_ID_1'}
        self.assertEqual(expected, got)


    def test_spades_contigs_paths_to_dict(self):
        '''Test _spades_contigs_paths_to_dict'''
        contigs_paths = os.path.join(data_dir, 'assembly_test_spades_contigs_paths_to_dict.contigs.paths')
        expected = {
            "NODE_1_length_86545_cov_16.2519_ID_2261": "1-,2+",
            "NODE_1_length_86545_cov_16.2519_ID_2261'": "2-,1+",
            "NODE_2_length_22106_cov_99.9797_ID_2263": "4+,10-,11+,10+,9-,5-,3+,5-",
            "NODE_2_length_22106_cov_99.9797_ID_2263'": "5+,3-,5+,9+,10-,11-,10+,4-",
            "NODE_3_length_21556_cov_27.4797_ID_2265": "6+",
            "NODE_3_length_21556_cov_27.4797_ID_2265'": "6-",
            "NODE_4_length_16761_cov_36.4471_ID_2267": "7+",
            "NODE_4_length_16761_cov_36.4471_ID_2267'": "7-",
            "NODE_5_length_8134_cov_20.6513_ID_2269": "14+",
            "NODE_5_length_8134_cov_20.6513_ID_2269'": "14-",
            "NODE_6_length_6712_cov_6.68474_ID_2271": "15+",
            "NODE_6_length_6712_cov_6.68474_ID_2271'": "15-",
            "NODE_7_length_4806_cov_3.33747_ID_2273": "13+",
            "NODE_7_length_4806_cov_3.33747_ID_2273'": "13-",
            "NODE_8_length_4566_cov_19.8709_ID_2275": "12+",
            "NODE_8_length_4566_cov_19.8709_ID_2275'": "12-",
            "NODE_9_length_3068_cov_67.4016_ID_2277": "8+",
            "NODE_9_length_3068_cov_67.4016_ID_2277'": "8-",
        }

# Path: circlator/assembly.py
# class Error (Exception): pass
# class Assembly:
#     def __init__(self, path, assembler):
#     def _file_exists(filename):
#     def _set_filenames(self):
#     def get_contigs(self):
#     def _circular_contigs_from_spades_before_3_6_1(cls, fastg_file):
#     def _spades_contigs_paths_to_dict(cls, filename):
#     def _circular_edges_to_edge_numbers_dict(cls, circular_edges):
#     def _circular_contigs_from_spades_after_3_6_1(assembly_graph_fastg, contigs_paths):
#     def _circular_contigs_from_canu_gfa(gfa_file):
#     def circular_contigs(self):


# Path: circlator/tests/assembly_test.py
import unittest
import shutil
import filecmp
import copy
import os
import pyfastaq
from circlator import assembly

        '''Test _circular_contigs_from_spades_before_3_6_1'''
        fastg_file = os.path.join(data_dir, 'assembly_test_circular_contigs_from_spades_before_3_6_1.fastg')
        got = assembly.Assembly._circular_contigs_from_spades_before_3_6_1(fastg_file)
        expected = {'NODE_1_length_5_cov_42.42_ID_1'}
        self.assertEqual(expected, got)


    def test_spades_contigs_paths_to_dict(self):
        '''Test _spades_contigs_paths_to_dict'''
        contigs_paths = os.path.join(data_dir, 'assembly_test_spades_contigs_paths_to_dict.contigs.paths')
        expected = {
            "NODE_1_length_86545_cov_16.2519_ID_2261": "1-,2+",
            "NODE_1_length_86545_cov_16.2519_ID_2261'": "2-,1+",
            "NODE_2_length_22106_cov_99.9797_ID_2263": "4+,10-,11+,10+,9-,5-,3+,5-",
            "NODE_2_length_22106_cov_99.9797_ID_2263'": "5+,3-,5+,9+,10-,11-,10+,4-",
            "NODE_3_length_21556_cov_27.4797_ID_2265": "6+",
            "NODE_3_length_21556_cov_27.4797_ID_2265'": "6-",
            "NODE_4_length_16761_cov_36.4471_ID_2267": "7+",
            "NODE_4_length_16761_cov_36.4471_ID_2267'": "7-",
            "NODE_5_length_8134_cov_20.6513_ID_2269": "14+",
            "NODE_5_length_8134_cov_20.6513_ID_2269'": "14-",
            "NODE_6_length_6712_cov_6.68474_ID_2271": "15+",
            "NODE_6_length_6712_cov_6.68474_ID_2271'": "15-",
            "NODE_7_length_4806_cov_3.33747_ID_2273": "13+",
            "NODE_7_length_4806_cov_3.33747_ID_2273'": "13-",
            "NODE_8_length_4566_cov_19.8709_ID_2275": "12+",
            "NODE_8_length_4566_cov_19.8709_ID_2275'": "12-",
            "NODE_9_length_3068_cov_67.4016_ID_2277": "8+",
            "NODE_9_length_3068_cov_67.4016_ID_2277'": "8-",
        }

        got = assembly.Assembly._spades_contigs_paths_to_dict(contigs_paths)