# 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():


from collections import Counter
from StringIO import StringIO
from abtools import log, mongodb
import itertools
import math
import multiprocessing as mp
import os
import random
import sqlite3
import subprocess as sp
import sys
import tempfile
import time
import urllib
import uuid
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
    import argparse
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#


from __future__ import print_function







def parse_args():
    parser = argparse.ArgumentParser("Compares two or more antibody repertoires.")
    parser.add_argument('-o', '--output', dest='output', required=True,
                        help="Output directory for figure and data files. Required.")
    parser.add_argument('-l', '--log', dest='log',
                        help="Location for the log file. \
                        If not provided, log will be written to <output>/abcompare.log")
    parser.add_argument('-d', '--database', dest='db', required=True,
                        help="Name of the MongoDB database to query. Required.")
    parser.add_argument('-1', '--collection1', dest='collection1', default=None,
                        help="Name of the first MongoDB collection to query for comparison. \
                        If -1 and -2 are not provided, all collections in the given database will be processed iteratively.")
    parser.add_argument('-2', '--collection2', dest='collection2', default=None,
                        help="Name of the second MongoDB collection to query for comparison. \

# 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/_compare.py
from collections import Counter
from StringIO import StringIO
from abtools import log, mongodb
import itertools
import math
import multiprocessing as mp
import os
import random
import sqlite3
import subprocess as sp
import sys
import tempfile
import time
import urllib
import uuid
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
    import argparse

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#


from __future__ import print_function







def parse_args():
    parser = argparse.ArgumentParser("Compares two or more antibody repertoires.")
    parser.add_argument('-o', '--output', dest='output', required=True,
                        help="Output directory for figure and data files. Required.")
    parser.add_argument('-l', '--log', dest='log',
                        help="Location for the log file. \
                        If not provided, log will be written to <output>/abcompare.log")
    parser.add_argument('-d', '--database', dest='db', required=True,
                        help="Name of the MongoDB database to query. Required.")
    parser.add_argument('-1', '--collection1', dest='collection1', default=None,
                        help="Name of the first MongoDB collection to query for comparison. \
                        If -1 and -2 are not provided, all collections in the given database will be processed iteratively.")
    parser.add_argument('-2', '--collection2', dest='collection2', default=None,
                        help="Name of the second MongoDB collection to query for comparison. \

                        If not provided, the collection provided by -1 will be iteratively compared with all other collections in the database. \