Skip to content

Commit

Permalink
add automated hmmpress
Browse files Browse the repository at this point in the history
  • Loading branch information
adraismawur committed Aug 28, 2023
1 parent bf06fe9 commit a5ba752
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bigscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def load_data(run: RunParameters):
if run.legacy:
logging.info("Using legacy mode")

if not HMMer.are_profiles_pressed(run.input.pfam_path):
logging.warning("HMM files were not pressed!")
HMMer.press(run.input.pfam_path)

# start profiler
if run.diagnostics.profiling:
profiler = Profiler(run.output.profile_path)
Expand Down
19 changes: 19 additions & 0 deletions src/hmm/hmmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,25 @@ class HMMer:
profile_index: dict[str, int]
alphabet = Alphabet.amino()

@staticmethod
def are_profiles_pressed(hmm_path: Path) -> bool:
"""Returns true if HMM profiles are already pressed
Args:
hmm_path (Path): Path to the .hmm file containing domain models
"""
expected_extensions = [
".h3f",
".h3i",
".h3m",
".h3p",
]
expected_paths = [
hmm_path.parent / (hmm_path.name + expected_extension)
for expected_extension in expected_extensions
]
return all([path.exists() for path in expected_paths])

@staticmethod
def press(hmm_path: Path) -> None:
"""Presses hmm files for optimized files for further analysis
Expand Down

0 comments on commit a5ba752

Please sign in to comment.