Skip to content

Commit a224cc0

Browse files
committed
FIX: making paras manual dependency
1 parent 53e9510 commit a224cc0

5 files changed

Lines changed: 40 additions & 5 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ We recommend installing BioCracker in a virtual conda environment, based on the
2525
conda env create -f environment.yml
2626
```
2727

28+
### Installing PARAS
29+
30+
PARAS is used by BioCracker to predict substrate specificities of NRPS adenylation domains.
31+
32+
PARAS has no PyPI package ans must be installed from source manually:
33+
34+
```bash
35+
pip install "paras @ git+https://github.com/bthedragonmaster/parasect.git@v2.0.0"
36+
```
37+
2838
### Installing HMMER2 on macOS Arm64
2939

3040
Use Rosetta to install the x86_64 version of HMMER2:

environment.dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ dependencies:
1515
- pip
1616
- pip:
1717
- -e .
18+
- "paras @ git+https://github.com/bthedragonmaster/parasect.git@v2.0.0"
1819
- hatch

environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ dependencies:
1414
# Extra PyPI deps
1515
- pip
1616
- pip:
17-
- "biocracker @ git+https://github.com/moltools/biocracker.git"
17+
- biocracker
18+
- "paras @ git+https://github.com/bthedragonmaster/parasect.git@v2.0.0"

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "biocracker"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
description = "BioCracker is a parser for antiSMASH output GenBank files"
55
readme = "README.md"
66
requires-python = ">=3.10"
@@ -15,8 +15,7 @@ keywords = ["parser", "antismash"]
1515

1616
dependencies = [
1717
"biopython",
18-
"tqdm",
19-
"paras @ git+https://github.com/bthedragonmaster/parasect.git@v2.0.0"
18+
"tqdm"
2019
]
2120

2221
classifiers = [

src/biocracker/paras.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
from pathlib import Path
66

77
import joblib
8-
from parasect.api import run_paras # module is called parasect, but we are using the paras model
8+
9+
try:
10+
from parasect.api import run_paras # module is called parasect, but we are using the paras model
11+
12+
_HAS_PARAS = True
13+
except ImportError:
14+
run_paras = None
15+
_HAS_PARAS = False
916

1017
from biocracker.antismash import DomainRec
1118
from biocracker.config import LOGGER_NAME, PARAS_CACHE_DIR_NAME, PARAS_MODEL_DOWNLOAD_URL
@@ -14,13 +21,25 @@
1421
_PARAS_MODEL_CACHE: dict[str, object] = {}
1522

1623

24+
def has_parasect() -> bool:
25+
"""
26+
Check if parasect is installed.
27+
28+
:return: True if parasect is installed, False otherwise
29+
"""
30+
return _HAS_PARAS
31+
32+
1733
def _load_paras_model(cache_dir: Path) -> object:
1834
"""
1935
Load the paras model from disk (cached in memory for reuse).
2036
2137
:param cache_dir: Path to the cache directory
2238
:return: loaded paras model
2339
"""
40+
if not _HAS_PARAS:
41+
raise ImportError("paras is not installed, cannot load paras model")
42+
2443
global _PARAS_MODEL_CACHE
2544

2645
# If model already loaded, return it immediately
@@ -64,6 +83,11 @@ def predict_amp_domain_substrate(
6483
if domain.kind != "AMP-binding":
6584
return None
6685

86+
# If parasect is missing, log and return None
87+
if not has_parasect():
88+
logger.warning("parasect not installed — skipping substrate prediction.")
89+
return None
90+
6791
# Define cache directory
6892
cache_dir = (
6993
Path(cache_dir_override)

0 commit comments

Comments
 (0)