#!/usr/bin/env python
# -*- coding: utf-8

# Copyright (C) 2010 - 2012, A. Murat Eren
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.

import os
import sys

try:
    import Oligotyping
except ImportError:
    import inspect
    print '''
    Oligotyping package seems to be missing from your PYTHONPATH. Running this may help:
        
        export PYTHONPATH="$PYTHONPATH:%s"

    ''' % (os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0])))
    sys.exit()


from Oligotyping.utils.utils import import_error

try:
    from Oligotyping.lib.oligotyping import Oligotyping
    from Oligotyping.utils.utils import ConfigError
    from Oligotyping.utils import parsers
except ImportError, e:
    import_error(e)
    sys.exit()


if __name__ == '__main__':
    parser = parsers.oligotyping()
    oligotyping = Oligotyping(parser.parse_args())

    try:
        oligotyping.run_all()
    except ConfigError, e:
        print e
        sys.exit()
