#!/usr/bin/env python
# -*- coding: utf-8
"""Takes collections id and generates an extensive summary based on what is available
in the profile and contigs database."""

import sys

import anvio
import anvio.terminal as terminal
import anvio.summarizer as summarizer

from anvio.errors import ConfigError, FilesNPathsError


__author__ = "A. Murat Eren"
__copyright__ = "Copyright 2015, The anvio Project"
__credits__ = []
__license__ = "GPL 3.0"
__version__ = anvio.__version__
__maintainer__ = "A. Murat Eren"
__email__ = "a.murat.eren@gmail.com"


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


if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(description='A script to generate summaries for a given list of splts')

    parser.add_argument(*anvio.A('profile-db'), **anvio.K('profile-db'))
    parser.add_argument(*anvio.A('contigs-db'), **anvio.K('contigs-db'))
    parser.add_argument(*anvio.A('collection-name'), **anvio.K('collection-name'))
    parser.add_argument(*anvio.A('output-dir'), **anvio.K('output-dir'))
    parser.add_argument(*anvio.A('list-collections'), **anvio.K('list-collections'))
    parser.add_argument(*anvio.A('quick-summary'), **anvio.K('quick-summary'))
    parser.add_argument(*anvio.A('debug'), **anvio.K('debug'))

    args = parser.parse_args()

    try:
        summary = summarizer.Summarizer(args)
        summary.process()
    except ConfigError, e:
        print e
        sys.exit(-1)
    except FilesNPathsError, e:
        print e
        sys.exit(-2)
