# Path: circlator/assemble.py
# class Error (Exception): pass
# class Assembler:
#     def __init__(self,
#       reads,
#       outdir,
#       threads=1,
#       spades_kmers=None,
#       careful=True,
#       only_assembler=True,
#       verbose=False,
#       spades_use_first_success=False,
#       assembler='spades',
#       genomeSize=100000, # only matters for Canu if correcting reads (which we're not)
#       data_type='pacbio-corrected',
#     ):
#     def _build_spades_kmers(self, kmers):
#     def _make_spades_command(self, kmer, outdir):
#     def _make_canu_command(self, outdir, out_name):
#     def run_spades_once(self, kmer, outdir):
#     def run_spades(self, stop_at_first_success=False):
#     def _rename_canu_contigs(cls, infile, outfile):
#     def run_canu(self):
#     def run(self):


import unittest
import filecmp
import os
import shutil
import pyfastaq
from circlator import assemble
        with self.assertRaises(assemble.Error):
            self.assembler._build_spades_kmers('41,spam')


    def test_make_spades_command(self):
        '''test _make_spades_command'''
        cmd_start = ' '.join([
            self.assembler.spades.exe(),
            '-s', os.path.join(data_dir, 'assemble_test.dummy_reads.fa'),
        ])

        self.assertEqual(cmd_start + ' -o out -t 1 -k 41 --careful --only-assembler', self.assembler._make_spades_command(41, 'out'))
        self.assertEqual(cmd_start + ' -o out -t 1 -k 43 --careful --only-assembler', self.assembler._make_spades_command(43, 'out'))
        self.assertEqual(cmd_start + ' -o out2 -t 1 -k 41 --careful --only-assembler', self.assembler._make_spades_command(41, 'out2'))

        self.assembler.careful = False
        self.assertEqual(cmd_start + ' -o out -t 1 -k 41 --only-assembler', self.assembler._make_spades_command(41, 'out'))
        self.assembler.careful = True

        self.assembler.only_assembler = False
        self.assertEqual(cmd_start + ' -o out -t 1 -k 41 --careful', self.assembler._make_spades_command(41, 'out'))
        self.assembler.only_assembler = True

        self.assembler.threads = 2
        self.assertEqual(cmd_start + ' -o out -t 2 -k 41 --careful --only-assembler', self.assembler._make_spades_command(41, 'out'))


    def test_make_canu_command(self):
        '''test _make_canu_command'''
        tmp_assemble_dir = 'tmp.assemble_test'

# Path: circlator/assemble.py
# class Error (Exception): pass
# class Assembler:
#     def __init__(self,
#       reads,
#       outdir,
#       threads=1,
#       spades_kmers=None,
#       careful=True,
#       only_assembler=True,
#       verbose=False,
#       spades_use_first_success=False,
#       assembler='spades',
#       genomeSize=100000, # only matters for Canu if correcting reads (which we're not)
#       data_type='pacbio-corrected',
#     ):
#     def _build_spades_kmers(self, kmers):
#     def _make_spades_command(self, kmer, outdir):
#     def _make_canu_command(self, outdir, out_name):
#     def run_spades_once(self, kmer, outdir):
#     def run_spades(self, stop_at_first_success=False):
#     def _rename_canu_contigs(cls, infile, outfile):
#     def run_canu(self):
#     def run(self):


# Path: circlator/tests/assemble_test.py
import unittest
import filecmp
import os
import shutil
import pyfastaq
from circlator import assemble

        with self.assertRaises(assemble.Error):
            self.assembler._build_spades_kmers('41,spam')


    def test_make_spades_command(self):
        '''test _make_spades_command'''
        cmd_start = ' '.join([
            self.assembler.spades.exe(),
            '-s', os.path.join(data_dir, 'assemble_test.dummy_reads.fa'),
        ])

        self.assertEqual(cmd_start + ' -o out -t 1 -k 41 --careful --only-assembler', self.assembler._make_spades_command(41, 'out'))
        self.assertEqual(cmd_start + ' -o out -t 1 -k 43 --careful --only-assembler', self.assembler._make_spades_command(43, 'out'))
        self.assertEqual(cmd_start + ' -o out2 -t 1 -k 41 --careful --only-assembler', self.assembler._make_spades_command(41, 'out2'))

        self.assembler.careful = False
        self.assertEqual(cmd_start + ' -o out -t 1 -k 41 --only-assembler', self.assembler._make_spades_command(41, 'out'))
        self.assembler.careful = True

        self.assembler.only_assembler = False
        self.assertEqual(cmd_start + ' -o out -t 1 -k 41 --careful', self.assembler._make_spades_command(41, 'out'))
        self.assembler.only_assembler = True

        self.assembler.threads = 2
        self.assertEqual(cmd_start + ' -o out -t 2 -k 41 --careful --only-assembler', self.assembler._make_spades_command(41, 'out'))


    def test_make_canu_command(self):
        '''test _make_canu_command'''
        tmp_assemble_dir = 'tmp.assemble_test'

        assembler = assemble.Assembler(