#!/usr/bin/env python

# Copyright 2013, Institute for Bioninformatics and Evolutionary Studies
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import os
import logging
from optparse import OptionParser


def run(loglevel):
    from ARC import App
    app = App()
    return app.start(loglevel)

VERSION = 'v1.1.4-beta 2016-03-28'


def main():
    #
    # Parse options
    #
    parser = OptionParser()
    parser.add_option(
        "-d", "--debug",
        action="store_true", dest="debug", default=False,
        help="Turn on debug output")
    parser.add_option(
        "-p", "--profile",
        action="store_true", dest="profile", default=False,
        help="Turn on profiling")
    parser.add_option(
        "-c", "--config",
        type="string", dest="config", default='ARC_config.txt',
        help="Specify the ARC config file.  The default is ARC_config.txt in the working directory")
    parser.add_option(
        "-v", "--version",
        action="store_true", dest="version", default=False,
        help="Print version and exit.")

    (options, args) = parser.parse_args()

    if options.debug:
        loglevel = logging.DEBUG
    else:
        loglevel = logging.INFO
    print "ARC Version: ", VERSION
    if options.version:
        sys.exit()

    #Try to import required modules (before they are needed anywhere)
    try:
        from Bio import SeqIO
    except ImportError, e:
        print "Error: Biopython not available, please install it before using ARC (http://biopython.org)."
        sys.exit()

    lib_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../')
    if lib_path not in sys.path:
        sys.path.insert(0, lib_path)

    from ARC import App
    app = App()

    if options.profile:
        import cProfile
        cProfile.runctx('app.start(loglevel, configfile=options.config)', globals(), locals())
        return 255
    else:
        return app.start(loglevel, configfile=options.config)

if __name__ == "__main__":
    main()

5eb52a2d7cd00ff96bbd2f2408e396bc4ae8dc93
#!/usr/bin/env python

# Copyright 2013, Institute for Bioninformatics and Evolutionary Studies
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import os
import logging
from optparse import OptionParser


def run(loglevel):
    from ARC import App
    app = App()
    return app.start(loglevel)

VERSION = 'v1.1.4-beta 2016-03-28'


def main():
    #
    # Parse options
    #
    parser = OptionParser()
    parser.add_option(
        "-d", "--debug",
        action="store_true", dest="debug", default=False,
        help="Turn on debug output")
    parser.add_option(
        "-p", "--profile",
        action="store_true", dest="profile", default=False,
        help="Turn on profiling")
    parser.add_option(
        "-c", "--config",
        type="string", dest="config", default='ARC_config.txt',
        help="Specify the ARC config file.  The default is ARC_config.txt in the working directory")
    parser.add_option(
        "-v", "--version",
        action="store_true", dest="version", default=False,
        help="Print version and exit.")

    (options, args) = parser.parse_args()

    if options.debug:
        loglevel = logging.DEBUG
    else:
        loglevel = logging.INFO
    print "ARC Version: ", VERSION
    if options.version:
        sys.exit()

    #Try to import required modules (before they are needed anywhere)
    try:
        from Bio import SeqIO
    except ImportError, e:
        print "Error: Biopython not available, please install it before using ARC (http://biopython.org)."
        sys.exit()

    lib_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../')
    if lib_path not in sys.path:
        sys.path.insert(0, lib_path)

    from ARC import App
    app = App()

    if options.profile:
        import cProfile
        cProfile.runctx('app.start(loglevel, configfile=options.config)', globals(), locals())
        return 255
    else:
        return app.start(loglevel, configfile=options.config)

if __name__ == "__main__":
    main()
