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

import sys

import anvio
import anvio.terminal as terminal

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


__author__ = "A. Murat Eren"
__copyright__ = "Copyright 2016, The anvio Project"
__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


def main(args):
    cogs = COGs(args)
    cogs.process()


if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(description='Run NCBI COGs on stuff.')

    parser.add_argument(*anvio.A('contigs-db'), **anvio.K('contigs-db'))
    parser.add_argument(*anvio.A('cog-data-dir'), **anvio.K('cog-data-dir'))
    parser.add_argument(*anvio.A('num-threads'), **anvio.K('num-threads'))
    parser.add_argument(*anvio.A('sensitive'), **anvio.K('sensitive'))
    parser.add_argument(*anvio.A('temporary-dir-path'), **anvio.K('temporary-dir-path'))

    parser.add_argument('--search-with', default='diamond', metavar="PROGRAM",
                        help="What program to use for database searching. The default is 'diamond',\
                              but you can also use NCBI's 'blastp' if you like.")

    args = parser.parse_args()

    try:
        main(args)
    except ConfigError as e:
        print(e)
        sys.exit(-1)
    except FilesNPathsError as e:
        print(e)
        sys.exit(-1)
