#!/opt/anaconda1anaconda2anaconda3/bin/python
# -*- coding: utf-8

import sys

import anvio
import anvio.terminal as terminal

from anvio.errors import ConfigError, FilesNPathsError
from anvio.cogs import COGsSetup


__author__ = "Developers of anvi'o (see AUTHORS.txt)"
__copyright__ = "Copyleft 2015-2018, the Meren Lab (http://merenlab.org/)"
__license__ = "GPL 3.0"
__version__ = anvio.__version__
__maintainer__ = "A. Murat Eren"
__email__ = "a.murat.eren@gmail.com"


run = terminal.Run()
progress = terminal.Progress()
pp = terminal.pretty_print

if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(description='Download COG data from the NCBI')
    parser.add_argument('--cog-data-dir', default=None, type=str, help="The directory for COG data to be stored. If you leave it\
                        as is without specifying anything, the default destination for the data directory will be used to set things\
                        up. The advantage of it is that everyone will be using a single data directory, but then you may need\
                        superuser privileges to do it. Using this parameter you can choose the location of the data directory somewhere\
                        you like. However, when it is time to run COGs, you will need to remember that path and provide it to the program.")
    parser.add_argument('--reset', default=False, action="store_true", help="This program by default attempts to use previously\
                        downloaded files in your COGs data directory if there are any. If something is wrong for some reason you\
                        can use this to tell anvi'o to remove everything, and start over.")
    parser.add_argument(*anvio.A('just-do-it'), **anvio.K('just-do-it'))
    parser.add_argument(*anvio.A('num-threads'), **anvio.K('num-threads'))


    args = anvio.get_args(parser)

    try:
        setup = COGsSetup(args)
        setup.create()
    except ConfigError as e:
        print(e)
        sys.exit(-1)
    except FilesNPathsError as e:
        print(e)
        sys.exit(-1)
