# Path: abtools/log.py
# def setup_logging(logfile, print_log_location=True, debug=False):
# def get_logger(name=None):
# def add_stream_handler(logger):
# def make_dir(d):
# 
# Path: abtools/mongodb.py
# def get_connection(ip='localhost', port=27017, user=None, password=None):
# def get_db(db, ip='localhost', port=27017, user=None, password=None):
# def get_collections(db, collection=None, prefix=None, suffix=None):
# def rename_collection(db, collection, new_name):
# def update(field, value, db, collection, match=None):
# def unset(db, collection, field, match=None):
# def mongoimport(json, database,
#                 ip='localhost', port=27017,
#                 user=None, password=None,
#                 delim='_', delim1=None, delim2=None,
#                 delim_occurance=1, delim1_occurance=1, delim2_occurance=1):
# def index(db, collection, fields, directions=None, desc=False, background=False):
# def remove_padding(db, collection, field='padding'):
# def _get_import_collections(jsons, delim, delim_occurance,
#                             delim1, delim1_occurance,
#                             delim2, delim2_occurance):
# def _print_mongoimport_info(logger):
# def _print_remove_padding():


import os
import sys
import uuid
import time
import shelve
import urllib
import sqlite3
import tempfile
import argparse
import subprocess as sp
import multiprocessing as mp
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from StringIO import StringIO
from collections import Counter
from pymongo import MongoClient
from abtools import log, mongodb
from abstar.core.germline import get_germlines
                        If not provided, no plot will be made.")
    parser.add_argument('-C', '--chain', dest='chain', default='heavy', choices=['heavy', 'kappa', 'lambda'],
                        help="Select the antibody chain to analyze. \
                        Options are 'heavy', 'kappa', and 'lambda'. \
                        Default is 'heavy'.")
    parser.add_argument('-s', '--species', dest='species', default='human', choices=['human', 'mouse', 'macaque'],
                        help="Species of the sequence data. Choices are 'human', 'mouse', and 'macaque'. \
                        Default is 'human'.")
    parser.add_argument('--debug', dest='debug', action='store_true', default=False,
                        help="If set, will run in debug mode.")
    return parser



class Args(object):
    """docstring for Args"""
    def __init__(self, output=None, temp=None, log=None,
        db=None, collection=None, ip='localhost', port=27017,
        user=None, password=None,
        var_plot=None, div_plot=None, join_plot=None,
        cdr3_plot=None, heatmap=False, isotype_plot=False, chain='heavy',
        debug=False):
        super(Args, self).__init__()

        if not all([output, temp, db]):
            print('\nERROR: --output, --temp and --database are all required options.\n')
            sys.exit(1)

        self.output = output
        self.temp = temp

# Path: abtools/log.py
# def setup_logging(logfile, print_log_location=True, debug=False):
# def get_logger(name=None):
# def add_stream_handler(logger):
# def make_dir(d):
# 
# Path: abtools/mongodb.py
# def get_connection(ip='localhost', port=27017, user=None, password=None):
# def get_db(db, ip='localhost', port=27017, user=None, password=None):
# def get_collections(db, collection=None, prefix=None, suffix=None):
# def rename_collection(db, collection, new_name):
# def update(field, value, db, collection, match=None):
# def unset(db, collection, field, match=None):
# def mongoimport(json, database,
#                 ip='localhost', port=27017,
#                 user=None, password=None,
#                 delim='_', delim1=None, delim2=None,
#                 delim_occurance=1, delim1_occurance=1, delim2_occurance=1):
# def index(db, collection, fields, directions=None, desc=False, background=False):
# def remove_padding(db, collection, field='padding'):
# def _get_import_collections(jsons, delim, delim_occurance,
#                             delim1, delim1_occurance,
#                             delim2, delim2_occurance):
# def _print_mongoimport_info(logger):
# def _print_remove_padding():


# Path: abtools/_stats.py
import os
import sys
import uuid
import time
import shelve
import urllib
import sqlite3
import tempfile
import argparse
import subprocess as sp
import multiprocessing as mp
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from StringIO import StringIO
from collections import Counter
from pymongo import MongoClient
from abtools import log, mongodb
from abstar.core.germline import get_germlines

                        If not provided, no plot will be made.")
    parser.add_argument('-C', '--chain', dest='chain', default='heavy', choices=['heavy', 'kappa', 'lambda'],
                        help="Select the antibody chain to analyze. \
                        Options are 'heavy', 'kappa', and 'lambda'. \
                        Default is 'heavy'.")
    parser.add_argument('-s', '--species', dest='species', default='human', choices=['human', 'mouse', 'macaque'],
                        help="Species of the sequence data. Choices are 'human', 'mouse', and 'macaque'. \
                        Default is 'human'.")
    parser.add_argument('--debug', dest='debug', action='store_true', default=False,
                        help="If set, will run in debug mode.")
    return parser



class Args(object):
    """docstring for Args"""
    def __init__(self, output=None, temp=None, log=None,
        db=None, collection=None, ip='localhost', port=27017,
        user=None, password=None,
        var_plot=None, div_plot=None, join_plot=None,
        cdr3_plot=None, heatmap=False, isotype_plot=False, chain='heavy',
        debug=False):
        super(Args, self).__init__()

        if not all([output, temp, db]):
            print('\nERROR: --output, --temp and --database are all required options.\n')
            sys.exit(1)

        self.output = output
        self.temp = temp

        self.log = log