# Path: abstar/core/abstar.py
#     STR_TYPES = [str, ]
#     STR_TYPES = [str, unicode]
# def parse_arguments(print_help=False):
#     def __init__(self, project_dir=None, input=None, output=None, log=None, temp=None,
#                  sequences=None, chunksize=500, output_type=['json', ], assigner='blastn',
#                  merge=False, pandaseq_algo='simple_bayesian', use_test_data=False,
#                  parquet=False, nextseq=False, uid=0, isotype=False, pretty=False, num_cores=0,
#                  basespace=False, cluster=False, padding=True, raw=False, json_keys=None,
#                  debug=False, germ_db='human', receptor='bcr', gzip=False):
# def validate_args(args):
# def make_directories(args):
# def _make_direc(d, cluster):
# def make_merge_dir(args):
# def setup_logging(log_dir, debug):
# def log_options(input_dir, output_dir, temp_dir, args):
# def list_files(d, log=False):
# def build_output_base(output_types):
# def concat_outputs(input_file, temp_output_file_dicts, output_dir, args):
# def concat_logs(input_file, logs, log_dir, log_type):
# def clear_temp_files(temp_files):
# def download_files(input_dir):
# def merge_reads(input_dir, args):
# def format_check(input_list):
# def _get_format(in_file):
# def split_file(f, fmt, temp_dir, args):
# def print_input_file_info(f, fmt):
# def log_job_stats(total_seqs, good_seq_counts, start_time, end_time):
# def print_job_stats(total_seqs, good_seq_counts, start_time, end_time):
# def run_abstar(seq_file, output_dir, log_dir, file_format, arg_dict):
# def process_sequences(sequences, args):
# def run_jobs(files, output_dir, log_dir, file_format, args):
# def _run_jobs_singlethreaded(files, output_dir, log_dir, file_format, args):
# def _run_jobs_via_multiprocessing(files, output_dir, log_dir, file_format, args):
# def monitor_mp_jobs(results):
# def _run_jobs_via_celery(files, output_dir, log_dir, file_format, args):
# def monitor_celery_jobs(results):
# def update_progress(finished, jobs, failed=None):
# def run(*args, **kwargs):
# def run_standalone(args):
# def main(args):
# class Args(object):


import os
import sys
from Bio import SeqIO
from abutils.core.sequence import Sequence
from ..core import abstar
#!usr/env/python
# filename: test_integration.py






def test_api_integration_bcr_1k():
    test_data = os.path.abspath('abstar/test_data/test_1k.fasta')
    with open(test_data, 'r') as f:
        test_seqs = [Sequence(s) for s in SeqIO.parse(f, 'fasta')]
    seqs = abstar.run(*test_seqs)
    assert len(seqs) == 999


def test_api_integration_bcr_hiv_bnab_hcs():
    test_data = os.path.abspath('abstar/test_data/test_hiv_bnab_hcs.fasta')
    with open(test_data, 'r') as f:
        test_seqs = [Sequence(s) for s in SeqIO.parse(f, 'fasta')]
    seqs = abstar.run(*test_seqs)
    assert len(seqs) == 221


def test_api_integration_bcr_hiv_bnab_lcs():
    test_data = os.path.abspath('abstar/test_data/test_hiv_bnab_lcs.fasta')
    with open(test_data, 'r') as f:
        test_seqs = [Sequence(s) for s in SeqIO.parse(f, 'fasta')]

# Path: abstar/core/abstar.py
#     STR_TYPES = [str, ]
#     STR_TYPES = [str, unicode]
# def parse_arguments(print_help=False):
#     def __init__(self, project_dir=None, input=None, output=None, log=None, temp=None,
#                  sequences=None, chunksize=500, output_type=['json', ], assigner='blastn',
#                  merge=False, pandaseq_algo='simple_bayesian', use_test_data=False,
#                  parquet=False, nextseq=False, uid=0, isotype=False, pretty=False, num_cores=0,
#                  basespace=False, cluster=False, padding=True, raw=False, json_keys=None,
#                  debug=False, germ_db='human', receptor='bcr', gzip=False):
# def validate_args(args):
# def make_directories(args):
# def _make_direc(d, cluster):
# def make_merge_dir(args):
# def setup_logging(log_dir, debug):
# def log_options(input_dir, output_dir, temp_dir, args):
# def list_files(d, log=False):
# def build_output_base(output_types):
# def concat_outputs(input_file, temp_output_file_dicts, output_dir, args):
# def concat_logs(input_file, logs, log_dir, log_type):
# def clear_temp_files(temp_files):
# def download_files(input_dir):
# def merge_reads(input_dir, args):
# def format_check(input_list):
# def _get_format(in_file):
# def split_file(f, fmt, temp_dir, args):
# def print_input_file_info(f, fmt):
# def log_job_stats(total_seqs, good_seq_counts, start_time, end_time):
# def print_job_stats(total_seqs, good_seq_counts, start_time, end_time):
# def run_abstar(seq_file, output_dir, log_dir, file_format, arg_dict):
# def process_sequences(sequences, args):
# def run_jobs(files, output_dir, log_dir, file_format, args):
# def _run_jobs_singlethreaded(files, output_dir, log_dir, file_format, args):
# def _run_jobs_via_multiprocessing(files, output_dir, log_dir, file_format, args):
# def monitor_mp_jobs(results):
# def _run_jobs_via_celery(files, output_dir, log_dir, file_format, args):
# def monitor_celery_jobs(results):
# def update_progress(finished, jobs, failed=None):
# def run(*args, **kwargs):
# def run_standalone(args):
# def main(args):
# class Args(object):


# Path: abstar/tests/test_integration.py
import os
import sys
from Bio import SeqIO
from abutils.core.sequence import Sequence
from ..core import abstar

#!usr/env/python
# filename: test_integration.py






def test_api_integration_bcr_1k():
    test_data = os.path.abspath('abstar/test_data/test_1k.fasta')
    with open(test_data, 'r') as f:
        test_seqs = [Sequence(s) for s in SeqIO.parse(f, 'fasta')]
    seqs = abstar.run(*test_seqs)
    assert len(seqs) == 999


def test_api_integration_bcr_hiv_bnab_hcs():
    test_data = os.path.abspath('abstar/test_data/test_hiv_bnab_hcs.fasta')
    with open(test_data, 'r') as f:
        test_seqs = [Sequence(s) for s in SeqIO.parse(f, 'fasta')]
    seqs = abstar.run(*test_seqs)
    assert len(seqs) == 221


def test_api_integration_bcr_hiv_bnab_lcs():
    test_data = os.path.abspath('abstar/test_data/test_hiv_bnab_lcs.fasta')
    with open(test_data, 'r') as f:
        test_seqs = [Sequence(s) for s in SeqIO.parse(f, 'fasta')]

    seqs = abstar.run(*test_seqs)