parameters: (in_fpath, out_fname)
return_statement: return summary_path
docstring: This function runs a BUSCO analysis according to the provided parameters.
      See the help for more details:
      ``python run_BUSCO.py -h``
      :raises SystemExit: if any errors occur
docstring_summary: This function runs a BUSCO analysis according to the provided parameters.
      See the help for more details:
      ``python run_BUSCO.py -h``
      :raises SystemExit: if any errors occur
docstring_tokens: This function runs a BUSCO analysis according to the provided parameters . See the help for more details : python run_BUSCO . py - h : raises SystemExit : if any errors occur
function: def main(in_fpath, out_fname):
      """
      This function runs a BUSCO analysis according to the provided parameters.
      See the help for more details:
      ``python run_BUSCO.py -h``
      :raises SystemExit: if any errors occur
      """
      start_time = time.time()
      # 1) Load a busco config file that will figure out all the params from all sources
      # i.e. provided config file, dataset cfg, and user args
      if os.environ.get('BUSCO_CONFIG_FILE') and os.access(os.environ.get('BUSCO_CONFIG_FILE'), os.R_OK):
          config_file = os.environ.get('BUSCO_CONFIG_FILE')
      else:
          config_file = '%s//config.ini.default' % os.path.dirname(os.path.realpath(__file__))
      config = BuscoConfig(config_file, args={'in': in_fpath, 'out': out_fname})
      # Define a logger, the config is passed to tell the logger if you required the quiet mode
  
      assembly_dirpath = os.path.join(config.get('busco', 'out_path'), 'run_%s' % out_fname)
      if not isdir(assembly_dirpath):
          os.makedirs(assembly_dirpath)
      summary_path = os.path.join(assembly_dirpath, 'short_summary_%s.txt' % out_fname)
  
      from quast_libs.busco import pipebricks
      pipebricks.PipeLogger.run_dirpath = assembly_dirpath
      from quast_libs.busco.GenomeAnalysis import GenomeAnalysis
      from quast_libs.busco.BuscoAnalysis import BuscoAnalysis
      from quast_libs.busco.pipebricks.Toolset import ToolException
      BuscoAnalysis._logger.reload_log()
      logger = BuscoAnalysis._logger
      if is_non_empty_file(summary_path):
          logger.info('Using existing BUSCO files for ' + out_fname + '...')
          return summary_path
  
      try:
          try:
              logger.info(
                  '****************** Start a BUSCO %s analysis, current time: %s **'
                  '****************' % (BuscoConfig.VERSION, time.strftime('%m/%d/%Y %H:%M:%S')))
              logger.info('Configuration loaded from %s' % config_file)
              # 2) Load the analysis, this will check the dependencies and return the appropriate analysis object
              analysis = GenomeAnalysis(config)
  
              # 3) Run the analysis
              analysis.run_analysis()
  
              if not logger.has_warning():
                  logger.info('BUSCO analysis done. Total running time: %s seconds' % str(time.time() - start_time))
              else:
                  logger.info('BUSCO analysis done with WARNING(s). Total running time: %s seconds'
                              % str(time.time() - start_time))
  
              logger.info('Results written in %s\n' % analysis.mainout)
  
          except ToolException as e:
              #
              logger.error(e)
              raise SystemExit
  
      except SystemExit:
          logger.error('BUSCO analysis failed !')
          logger.error(
              'Check the logs, read the user guide, if you still need technical '
              'support, then please contact %s\n' % BuscoConfig.CONTACT)
          raise SystemExit
  
      except KeyboardInterrupt:
          logger.error('A signal was sent to kill the process')
          logger.error('BUSCO analysis failed !')
          logger.error(
              'Check the logs, read the user guide, if you still need technical '
              'support, then please contact %s\n' % BuscoConfig.CONTACT)
          raise SystemExit
  
      except BaseException:
          exc_type, exc_value, exc_traceback = sys.exc_info()
          logger.critical('Unhandled exception occurred: %s\n' % traceback.format_exception(
              exc_type, exc_value, exc_traceback))
          logger.error('BUSCO analysis failed !')
          logger.error(
              'Check the logs, read the user guide, if you still need technical '
              'support, then please contact %s\n' % BuscoConfig.CONTACT)
          raise SystemExit
      return summary_path
function_tokens: def main ( in_fpath , out_fname ) : start_time = time . time ( ) # 1) Load a busco config file that will figure out all the params from all sources # i.e. provided config file, dataset cfg, and user args if os . environ . get ( 'BUSCO_CONFIG_FILE' ) and os . access ( os . environ . get ( 'BUSCO_CONFIG_FILE' ) , os . R_OK ) : config_file = os . environ . get ( 'BUSCO_CONFIG_FILE' ) else : config_file = '%s//config.ini.default' % os . path . dirname ( os . path . realpath ( __file__ ) ) config = BuscoConfig ( config_file , args = { 'in' : in_fpath , 'out' : out_fname } ) # Define a logger, the config is passed to tell the logger if you required the quiet mode assembly_dirpath = os . path . join ( config . get ( 'busco' , 'out_path' ) , 'run_%s' % out_fname ) if not isdir ( assembly_dirpath ) : os . makedirs ( assembly_dirpath ) summary_path = os . path . join ( assembly_dirpath , 'short_summary_%s.txt' % out_fname ) from quast_libs . busco import pipebricks pipebricks . PipeLogger . run_dirpath = assembly_dirpath from quast_libs . busco . GenomeAnalysis import GenomeAnalysis from quast_libs . busco . BuscoAnalysis import BuscoAnalysis from quast_libs . busco . pipebricks . Toolset import ToolException BuscoAnalysis . _logger . reload_log ( ) logger = BuscoAnalysis . _logger if is_non_empty_file ( summary_path ) : logger . info ( 'Using existing BUSCO files for ' + out_fname + '...' ) return summary_path try : try : logger . info ( '****************** Start a BUSCO %s analysis, current time: %s **' '****************' % ( BuscoConfig . VERSION , time . strftime ( '%m/%d/%Y %H:%M:%S' ) ) ) logger . info ( 'Configuration loaded from %s' % config_file ) # 2) Load the analysis, this will check the dependencies and return the appropriate analysis object analysis = GenomeAnalysis ( config ) # 3) Run the analysis analysis . run_analysis ( ) if not logger . has_warning ( ) : logger . info ( 'BUSCO analysis done. Total running time: %s seconds' % str ( time . time ( ) - start_time ) ) else : logger . info ( 'BUSCO analysis done with WARNING(s). Total running time: %s seconds' % str ( time . time ( ) - start_time ) ) logger . info ( 'Results written in %s\n' % analysis . mainout ) except ToolException as e : # logger . error ( e ) raise SystemExit except SystemExit : logger . error ( 'BUSCO analysis failed !' ) logger . error ( 'Check the logs, read the user guide, if you still need technical ' 'support, then please contact %s\n' % BuscoConfig . CONTACT ) raise SystemExit except KeyboardInterrupt : logger . error ( 'A signal was sent to kill the process' ) logger . error ( 'BUSCO analysis failed !' ) logger . error ( 'Check the logs, read the user guide, if you still need technical ' 'support, then please contact %s\n' % BuscoConfig . CONTACT ) raise SystemExit except BaseException : exc_type , exc_value , exc_traceback = sys . exc_info ( ) logger . critical ( 'Unhandled exception occurred: %s\n' % traceback . format_exception ( exc_type , exc_value , exc_traceback ) ) logger . error ( 'BUSCO analysis failed !' ) logger . error ( 'Check the logs, read the user guide, if you still need technical ' 'support, then please contact %s\n' % BuscoConfig . CONTACT ) raise SystemExit return summary_path