# Path: checkm/common.py
# def checkFileExists(inputFile):
#     """Check if file exists."""
#     if not os.path.exists(inputFile):
#         logger = logging.getLogger('timestamp')
#         logger.error('Input file does not exists: ' + inputFile + '\n')
#         sys.exit(1)
# 
# def reassignStdOut(outFile):
#     """Redirect standard out to a file."""
#     oldStdOut = sys.stdout
#     if(outFile != ''):
#         try:
#             # redirect stdout to a file
#             sys.stdout = open(outFile, 'w')
#         except:
#             logger = logging.getLogger('timestamp')
#             logger.error("Error diverting stdout to file: " + outFile)
#             sys.exit(1)
# 
#     return oldStdOut
# 
# def restoreStdOut(outFile, oldStdOut):
#     """Redirect standard out back to system standard out."""
#     if(outFile != ''):
#         try:
#             # redirect stdout to a file
#             sys.stdout.close()
#             sys.stdout = oldStdOut
#         except:
#             logger = logging.getLogger('timestamp')
#             logger.error("Error restoring stdout ", outFile)
#             sys.exit(1)


import logging
import checkm.prettytable
from checkm.defaultValues import DefaultValues
from checkm.common import checkFileExists, reassignStdOut, restoreStdOut

###############################################################################
#
# profile.py - calculate percentage of reads mapped to each bin
#
###############################################################################
#                                                                             #
#    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 3 of the License, or        #
#    (at your option) any later version.                                      #
#                                                                             #
#    This program is distributed in the hope that it will be useful,          #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of           #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
#    GNU General Public License for more details.                             #
#                                                                             #
#    You should have received a copy of the GNU General Public License        #
#    along with this program. If not, see <http://www.gnu.org/licenses/>.     #
#                                                                             #
###############################################################################





class Profile():
    def __init__(self):
        self.logger = logging.getLogger('timestamp')

    def run(self, coverageFile, outFile, bTabTable):

# Path: checkm/common.py
# def checkFileExists(inputFile):
#     """Check if file exists."""
#     if not os.path.exists(inputFile):
#         logger = logging.getLogger('timestamp')
#         logger.error('Input file does not exists: ' + inputFile + '\n')
#         sys.exit(1)
# 
# def reassignStdOut(outFile):
#     """Redirect standard out to a file."""
#     oldStdOut = sys.stdout
#     if(outFile != ''):
#         try:
#             # redirect stdout to a file
#             sys.stdout = open(outFile, 'w')
#         except:
#             logger = logging.getLogger('timestamp')
#             logger.error("Error diverting stdout to file: " + outFile)
#             sys.exit(1)
# 
#     return oldStdOut
# 
# def restoreStdOut(outFile, oldStdOut):
#     """Redirect standard out back to system standard out."""
#     if(outFile != ''):
#         try:
#             # redirect stdout to a file
#             sys.stdout.close()
#             sys.stdout = oldStdOut
#         except:
#             logger = logging.getLogger('timestamp')
#             logger.error("Error restoring stdout ", outFile)
#             sys.exit(1)


# Path: checkm/profile.py
import logging
import checkm.prettytable
from checkm.defaultValues import DefaultValues
from checkm.common import checkFileExists, reassignStdOut, restoreStdOut

###############################################################################
#
# profile.py - calculate percentage of reads mapped to each bin
#
###############################################################################
#                                                                             #
#    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 3 of the License, or        #
#    (at your option) any later version.                                      #
#                                                                             #
#    This program is distributed in the hope that it will be useful,          #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of           #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
#    GNU General Public License for more details.                             #
#                                                                             #
#    You should have received a copy of the GNU General Public License        #
#    along with this program. If not, see <http://www.gnu.org/licenses/>.     #
#                                                                             #
###############################################################################





class Profile():
    def __init__(self):
        self.logger = logging.getLogger('timestamp')

    def run(self, coverageFile, outFile, bTabTable):

        checkFileExists(coverageFile)
