# Path: epac/version.py
# SATIVA_BUILD="v0.9-60-g8c31962"
# 
# SATIVA_RELEASE_DATE="2021-01-04"
# 
# SATIVA_RAXML_VER="8.2.3"


import os
import sys
import glob
import shutil
import datetime
import time
import logging
import random
import multiprocessing
import configparser
from epac.version import SATIVA_BUILD,SATIVA_RELEASE_DATE,SATIVA_RAXML_VER

        self.hmmer_home = self.resolve_relative_path(parser.get_param("hmmer", "hmmer_home", str, self.hmmer_home))
        self.muscle_home = self.resolve_relative_path(parser.get_param("muscle", "muscle_home", str, self.muscle_home))
        
        self.run_on_cluster = parser.get_param("cluster", "run_on_cluster", bool, self.run_on_cluster)
        self.cluster_epac_home = parser.get_param("cluster", "cluster_epac_home", str, self.cluster_epac_home) + "/"
        self.cluster_qsub_script = parser.get_param("cluster", "cluster_qsub_script", str, self.cluster_qsub_script)

        self.min_confidence = parser.get_param("assignment", "min_confidence", float, self.min_confidence)

        return parser

    def subst_name(self, in_str):
        """Replace %NAME% macros with an actual EPAC run name. Used to 
        generate unique run-specific identifiers (filenames, RAxML job names etc)"""
        return in_str.replace("%NAME%", self.name)
    
    def tmp_fname(self, fname):
        return os.path.join(self.temp_dir, self.subst_name(fname))

    def out_fname(self, fname):
        return os.path.join(self.output_dir, self.subst_name(fname))
        
    def clean_tempdir(self):
        if not self.debug and os.path.isdir(self.temp_dir):
            shutil.rmtree(self.temp_dir)
    
    def exit_fatal_error(self, msg=None):
        if msg:
            self.log.error(msg)

# Path: epac/version.py
# SATIVA_BUILD="v0.9-60-g8c31962"
# 
# SATIVA_RELEASE_DATE="2021-01-04"
# 
# SATIVA_RAXML_VER="8.2.3"


# Path: epac/config.py
import os
import sys
import glob
import shutil
import datetime
import time
import logging
import random
import multiprocessing
import configparser
from epac.version import SATIVA_BUILD,SATIVA_RELEASE_DATE,SATIVA_RAXML_VER


        self.hmmer_home = self.resolve_relative_path(parser.get_param("hmmer", "hmmer_home", str, self.hmmer_home))
        self.muscle_home = self.resolve_relative_path(parser.get_param("muscle", "muscle_home", str, self.muscle_home))
        
        self.run_on_cluster = parser.get_param("cluster", "run_on_cluster", bool, self.run_on_cluster)
        self.cluster_epac_home = parser.get_param("cluster", "cluster_epac_home", str, self.cluster_epac_home) + "/"
        self.cluster_qsub_script = parser.get_param("cluster", "cluster_qsub_script", str, self.cluster_qsub_script)

        self.min_confidence = parser.get_param("assignment", "min_confidence", float, self.min_confidence)

        return parser

    def subst_name(self, in_str):
        """Replace %NAME% macros with an actual EPAC run name. Used to 
        generate unique run-specific identifiers (filenames, RAxML job names etc)"""
        return in_str.replace("%NAME%", self.name)
    
    def tmp_fname(self, fname):
        return os.path.join(self.temp_dir, self.subst_name(fname))

    def out_fname(self, fname):
        return os.path.join(self.output_dir, self.subst_name(fname))
        
    def clean_tempdir(self):
        if not self.debug and os.path.isdir(self.temp_dir):
            shutil.rmtree(self.temp_dir)
    
    def exit_fatal_error(self, msg=None):
        if msg:
            self.log.error(msg)

        sys.exit(13)    