Skip to content

Commit

Permalink
reformat check_software_requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
msarrias committed Nov 9, 2024
1 parent b7b4783 commit b2eacbc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions exonize/environment_setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import os
import shutil
import sys
from pathlib import Path


Expand Down Expand Up @@ -80,14 +81,8 @@ def __init__(
self.partial_excision = 'PARTIAL_EXCISION'
self.inter_boundary = 'INTER_BOUNDARY'
self.intronic = 'INTRONIC'

self.check_if_tool_installed('sqlite3')
if self.SEARCH_ALL:
self.check_if_tool_installed('tblastx')
self.check_if_tool_installed('muscle')
elif self.LOCAL_SEARCH:
self.check_if_tool_installed('muscle')

self.configure_logger()
self.check_software_requirements()
if not self.output_prefix:
self.output_prefix = self.gff_file_path.stem
if self.output_directory_path:
Expand All @@ -111,14 +106,20 @@ def __init__(
os.makedirs(self.csv_path, exist_ok=True)
self.setup_environment()

@staticmethod
def check_if_tool_installed(
self,
name: str
) -> None:
if shutil.which(name) is None:
self.logger.error(f"Error: {name} is not installed or not in your PATH environment variable.")
sys.exit(1)

def check_software_requirements(self):
self.check_if_tool_installed(name='sqlite3')
self.check_if_tool_installed(name='muscle')
if self.SEARCH_ALL:
self.check_if_tool_installed(name='tblastx')

def configure_logger(self):
"""
configure_logger is a function that configures the logger.
Expand All @@ -144,4 +145,3 @@ def setup_environment(self):
if self.results_database_path.exists():
os.remove(self.results_database_path)
os.makedirs(self.working_directory, exist_ok=True)
self.configure_logger()

0 comments on commit b2eacbc

Please sign in to comment.