from SemiBin.main import generate_data_single
import os
import pytest
import logging
import pandas as pd

def test_generate_data_coassembly():
    logger = logging.getLogger('SemiBin')
    logger.setLevel(logging.INFO)
    sh = logging.StreamHandler()
    sh.setFormatter(logging.Formatter('%(asctime)s - %(message)s'))
    logger.addHandler(sh)

    os.makedirs('output_coassembly',exist_ok=True)
    generate_data_single(bams=['test/coassembly_sample_data/input.sorted1.bam',
                               'test/coassembly_sample_data/input.sorted2.bam',
                               'test/coassembly_sample_data/input.sorted3.bam',
                               'test/coassembly_sample_data/input.sorted4.bam',
                               'test/coassembly_sample_data/input.sorted5.bam'],
                         num_process=1,
                         logger=logger,
                         output='output_coassembly',
                         handle='test/coassembly_sample_data/input.fasta',
                         binned_short=False,
                         must_link_threshold=4000
                         )

    data = pd.read_csv('output_coassembly/data.csv',index_col=0)
    data_split = pd.read_csv('output_coassembly/data_split.csv',index_col=0)

    assert data.shape == (40,141)
    assert data_split.shape == (80,141)
[((8, 13, 8, 41), 'logging.getLogger', 'logging.getLogger', ({(8, 31, 8, 40): '"""SemiBin"""'}, {}), "('SemiBin')", False, 'import logging\n'), ((10, 9, 10, 32), 'logging.StreamHandler', 'logging.StreamHandler', ({}, {}), '()', False, 'import logging\n'), ((14, 4, 14, 50), 'os.makedirs', 'os.makedirs', (), '', False, 'import os\n'), ((15, 4, 26, 26), 'SemiBin.main.generate_data_single', 'generate_data_single', (), '', False, 'from SemiBin.main import generate_data_single\n'), ((28, 11, 28, 64), 'pandas.read_csv', 'pd.read_csv', (), '', True, 'import pandas as pd\n'), ((29, 17, 29, 76), 'pandas.read_csv', 'pd.read_csv', (), '', True, 'import pandas as pd\n'), ((11, 20, 11, 66), 'logging.Formatter', 'logging.Formatter', ({(11, 38, 11, 65): '"""%(asctime)s - %(message)s"""'}, {}), "('%(asctime)s - %(message)s')", False, 'import logging\n')]