sxLaep: Rapid Enzyme/Non-Enzyme Prediction using sequence features and XGBoost
Project description
sxLaep: a Lightweight and Accurate Enzyme Predictor
sxLaep is an efficient machine learning tool for predicting whether a protein sequence is an enzyme or non-enzyme. It combines multi-physicochemical sequence features with an XGBoost classifier for fast and accurate binary classification.
QUICK LINKS
INTRODUCTION
In bioinformatics, accurate identification of enzymes from protein sequences is crucial for understanding metabolic pathways, drug target discovery, and functional annotation of novel proteins. Traditional experimental methods for enzyme classification are time-consuming and expensive, making computational prediction approaches highly valuable.
sxLaep provides a machine learning-based solution for enzyme/non-enzyme classification from protein sequences. The tool extracts comprehensive sequence-derived features that capture various physicochemical properties and structural characteristics of proteins:
- Multi-property Pseudo-Amino Acid Composition (Pse-AAC): Captures sequence-order information through hydrophobicity, polarity, and charge properties
- Composition-Transition-Distribution (CTD): Describes amino acid distribution across different physicochemical groups
- Windowed Amino Acid Composition: Captures local sequence patterns by dividing sequences into N-to-C segments
- Sequence Length: Raw protein length as a complementary feature
These features are fed into a pre-trained XGBoost classifier that has been optimized for performance on enzyme classification tasks. The model achieves high accuracy while maintaining fast inference speed, making it suitable for large-scale protein annotation projects.
sxLaep supports both single-sequence prediction and batch processing of FASTA files, with built-in parallelization for efficient feature extraction. The package provides both a simple Python API and a command-line interface for flexible integration into various bioinformatics workflows.
METHODS
Figure 1. The sxLaep pre-screening workflow. The framework acts as a lightweight ”gatekeeper” for massive protein datasets. It extracts alignment-free physicochemical features and utilizes a machine learning classifier to rapidly filter out non-enzymatic sequences. This process significantly reduces computational load for downstream analysis while effectively retaining potential enzymes, including remote homologs (”Functional Dark Matter”)
SOFTWARE
sxLaep (Lightweight and Accurate Enzyme Predictor)
The package is available for Python 3.9+ on Windows, Linux, and macOS.
Latest updates and source code are available at: https://github.com/labxscut/sxLaep
DOCKER
A pre-configured Docker image is provided to run sxLaep in an isolated environment with Python 3.11 and all required dependencies.
Quick Start
Pull the official image directly:
docker pull labxscut/sxlaep:python3.11
Running the Container
Mount your local data directory to the container's working directory (/workspace) and start an interactive shell:
docker run --rm -it -v $(pwd):/workspace labxscut/sxlaep:python3.11 bash
Once inside the container, the sxlaep CLI is ready to use (the sxlaep conda environment is auto-activated).
Build Locally (Optional)
If you prefer to build the image from the provided Dockerfile:
docker build --no-cache -t labxscut/sxlaep:python3.11 .
Then run it using the docker run command above.
INSTALL
Requires Python 3.9+. Dependencies (numpy, pandas, scikit-learn, xgboost, joblib) are pulled in automatically when you install the package.
Recommended: pipx (CLI on your PATH, no project venv)
pipx installs the app into its own isolated environment and links the sxlaep executable onto your PATH—you do not need to create or activate a virtualenv for normal command-line use.
Install pipx once (if needed), and add it into PATH:
pipx ensurepath
Then:
pipx install sxlaep --pip-args="--prefer-binary -v"
If downloads are slow, add an index URL inside --pip-args, for example:
pipx install sxlaep --pip-args="-i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn --prefer-binary -v"
Upgrade or reinstall:
pipx upgrade sxlaep
# or: pipx reinstall sxlaep
Optional: pipx install from GitHub (latest main)
Use this when you need commits not yet published to PyPI. You must have git installed and on your PATH (pip clones the repository).
This path is more fragile than PyPI: pipx may appear to hang on determining package name while it installs into a temporary virtual environment to discover the distribution name, then installs again into the real pipx venv. Dependency resolution and xgboost wheels or source builds can take many minutes. Use --verbose so you can see progress.
export PIP_DEFAULT_TIMEOUT=120
pipx install --verbose --force "sxlaep @ git+https://github.com/labxscut/sxLaep.git@main" \
--pip-args="--prefer-binary -v --default-timeout=120"
To track a different branch or tag, change the trailing @main (for example @develop or @v1.0.0).
Equivalent VCS URL form (some users prefer this):
pipx install --verbose --force "git+https://github.com/labxscut/sxLaep.git@main" \
--pip-args="--prefer-binary -v --default-timeout=120"
To refresh an existing git-based install, re-run the same command with --force. To go back to the PyPI build, use pipx uninstall sxlaep then pipx install sxlaep as in the recommended section above.
Development from a clone (editable install, still isolated like other pipx apps):
git clone https://github.com/labxscut/sxLaep.git
cd sxLaep
pipx install -e . --pip-args="--prefer-binary -v"
Alternative: pip in a virtual environment (library / notebooks)
Use this when you import sxlaep inside your own project or Jupyter and want dependencies in your venv—not required for the standalone CLI if you used pipx above.
Use a recent pip, then install with binary preference:
python3 -m pip install -U "pip>=24" setuptools wheel
python3 -m pip install --prefer-binary sxlaep
Run the same commands after activating whichever venv you use for that project.
Editable install (optional, for development without pipx):
git clone https://github.com/labxscut/sxLaep.git
cd sxLaep
python3 -m pip install -U "pip>=24" setuptools wheel
python3 -m pip install --prefer-binary -e .
If install is slow or hangs
- First-time resolution and wheel download can take several minutes; keep
-vso you see progress. pipx install … @ git+https://…(GitHub method above): pipx may sit on determining package name while it clones the repo and runs pip in a temporary venv, then repeats work in the final venv—use--verboseand a generousPIP_DEFAULT_TIMEOUT/--default-timeout(as in the examples).- Prefer wheels with
--prefer-binary(commands above) to avoid long source builds ofxgboost. - On Debian/Ubuntu, if
xgbooststill builds from source, install compilers and CMake, then retry:
sudo apt-get install -y build-essential cmake ninja-build
Python API (after install)
See Quick start below for load_model / predict_sequences and run_prediction_pipeline.
QUICK START
Python API
from pathlib import Path
import sxlaep
from sxlaep.model import load_model, predict_sequences
ubj = Path(sxlaep.__file__).resolve().parent / "enzyme_xgb_model.ubj"
model = load_model(ubj)
df = predict_sequences(model, ["MKVLWALIFLLKSAF"])
# columns: pred_label, enzyme_probability
FASTA to CSV in one call:
from sxlaep import run_prediction_pipeline
run_prediction_pipeline(
model_path="path/to/model.pkl", # or .ubj / .joblib
fasta_path="sequences.fasta",
output_csv="predictions.csv",
)
Command line
Training:
sxlaep train --noenzyme-fasta neg.fasta --enzyme-fasta pos.fasta --outdir results/sxlaep_training
Prediction (writes a CSV):
sxlaep predict --model path/to/model.pkl --fasta sequences.fasta --output predictions.csv
Shorthand (bundled enzyme_xgb_model.ubj in the installed package; no train / predict subcommand):
sxlaep --input sequences.fasta --output predictions.csv
# or: sxlaep -i sequences.fasta -o predictions.csv
# default output if -o omitted: sxlaep_predictions.csv in the current directory
Help:
sxlaep --help
sxlaep train --help
sxlaep predict --help
EXECUTABLES
sxlaep— CLI: subcommandstrainandpredict, or shorthandsxlaep --input/-i(bundled model) with--output/-o(see Quick start). Use--helpfor global and subcommand options.
From a clone, optional end-user helper:
- Example FASTAs:
tests/enzyme_example.fasta,tests/noenzyme_example.fasta. - Run
cd tests && ./install.sh: downloads missing FASTAs when needed,pipx installorpipx upgradefrom PyPI, then runssxlaep --helpandsxlaep --input example.fasta(copy ofenzyme_example.fastain a temp directory), prints a short CSV preview, and reports success (setSXLAEP_SKIP_CLI_SMOKE=1to skip). No sudo. Override raw URLs withSXLAEP_RAW_BASE/SXLAEP_RAW_REF(defaultmain). - Developers: from repo root, run
pytest tests/.
REFERENCE PARAMETERS
Feature Extraction Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
lag |
int | 10 | Maximum correlation lag for pseudo-AAC. Controls the length of sequence-order correlation terms. Higher values capture longer-range dependencies but increase feature dimensionality. |
weight |
float | 0.05 | Weight applied to sequence-order correlation terms in pseudo-AAC. Balances between standard amino acid composition and sequence-order information. |
n_segments |
int | 3 | Number of N-to-C sequence windows for windowed AAC. Divides the sequence into equal segments for local composition analysis. |
add_length |
bool | True | Whether to append raw sequence length to the feature vector. Provides additional size information that may be correlated with enzyme function. |
properties |
dict | PROPERTIES | Amino-acid physicochemical property tables used by pseudo-AAC. Default includes: hydrophobicity (HYDRO), polarity (POLAR), and charge (CHARGE). |
Command line arguments
Shorthand sxlaep --input (bundled model)
| Argument | Required | Description |
|---|---|---|
--input, -i |
Yes | Input FASTA path (uses packaged enzyme_xgb_model.ubj). Do not combine with train or predict. |
--output, -o |
No | Output CSV path (default sxlaep_predictions.csv in the current working directory). |
--lag |
No | Pseudo-AAC lag — fixed to 10 for bundled model; use sxlaep predict to customize. |
--weight |
No | Pseudo-AAC weight — fixed to 0.05 for bundled model; use sxlaep predict to customize. |
--segments |
No | Window-AAC segments — fixed to 3 for bundled model; use sxlaep predict to customize. |
--add-length / --no-add-length |
No | Append sequence length — fixed for bundled model; use sxlaep predict to customize. |
--properties |
No | Physicochemical properties — fixed to hydro polar charge for bundled model; use sxlaep predict to customize. |
sxlaep train
| Argument | Required | Description |
|---|---|---|
--noenzyme-fasta |
Yes | FASTA path for non-enzyme (negative) sequences. |
--enzyme-fasta |
Yes | FASTA path for enzyme (positive) sequences. |
--outdir |
No | Training output directory (default results/sxlaep_training). |
--lag |
No | Pseudo-AAC max correlation lag (default 10). |
--weight |
No | Pseudo-AAC sequence-order weight (default 0.05). |
--segments |
No | Number of window-AAC N-to-C segments (default 3). |
--add-length / --no-add-length |
No | Append raw sequence length to feature vector (default: enabled). |
--properties |
No | Physicochemical properties for pseudo-AAC: one or more of hydro, polar, charge (default: all three). |
--test-size |
No | Held-out test fraction (default 0.1). |
--seed |
No | Random seed for reproducibility (default 42). |
--n-jobs |
No | Parallel workers for feature extraction (default -1 = all cores). |
sxlaep predict
| Argument | Required | Description |
|---|---|---|
--model |
Yes | Trained model path (.pkl / .joblib / native .ubj as supported by load_model). |
--fasta |
Yes | Input FASTA path. |
--output |
No | Output CSV path (default results/predictions.csv). |
--lag |
No | Pseudo-AAC max correlation lag — must match training (default 10). |
--weight |
No | Pseudo-AAC sequence-order weight — must match training (default 0.05). |
--segments |
No | Number of window-AAC segments — must match training (default 3). |
--add-length / --no-add-length |
No | Append sequence length — must match training (default: enabled). |
--properties |
No | Physicochemical properties — must match training; one or more of hydro, polar, charge (default: all three). |
--n-jobs |
No | Parallel workers for feature extraction (default 1). |
Output file formats
CSV output (sxlaep predict or sxlaep --input)
The prediction CSV includes (among others) identifier columns plus scores:
| Column | Description |
|---|---|
sequence_id |
FASTA record id (first token of the header). |
description |
Full header line after >. |
pred_label |
0 = non-enzyme, 1 = enzyme. |
enzyme_probability |
Estimated probability of enzyme class (when available from the model). |
EXAMPLES
Batch FASTA processing (Python)
from sxlaep import run_prediction_pipeline
df = run_prediction_pipeline(
model_path="enzyme_xgb_model.pkl",
fasta_path="proteins.fasta",
output_csv="predictions.csv",
)
print(df[["sequence_id", "pred_label", "enzyme_probability"]].head())
Same task from the shell
sxlaep predict --model enzyme_xgb_model.pkl --fasta proteins.fasta --output predictions.csv
With the bundled model (after pipx install sxlaep, from any directory):
sxlaep --input proteins.fasta --output predictions.csv
NOTES
- The pre-trained model is shipped as
enzyme_xgb_model.ubj(XGBoost native format). Training still writes a sibling.ubjwhen you save*.pklfor backward compatibility.- The Python package name for installation is
sxlaep(for example:python3 -m pip install --prefer-binary sxlaep).- Sequences containing non-standard amino acids are automatically sanitized (only the 20 standard amino acids are used).
- Short sequences (< 10 amino acids) may yield less reliable predictions.
- For large-scale predictions (>10,000 sequences), consider processing in batches or using a high-performance computing environment.
CONTACT
lcxia@scut.edu.cn dhy.scut@outlook.com GitHub: https://github.com/labxscut
CITATIONS
Please cite sxLaep if you use it in your research:
labxscut. sxLaep: a Lightweight and Accurate Enzyme Predictor for High-throughput Mining of Metagenomic Sequences. (2026).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sxlaep-1.0.4.tar.gz.
File metadata
- Download URL: sxlaep-1.0.4.tar.gz
- Upload date:
- Size: 6.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53517f8160d89e2e31156db8228ee0a2a11104bca6902734b2772464a5629ce3
|
|
| MD5 |
715ed3051609f3da518813251bad557a
|
|
| BLAKE2b-256 |
a9af4356b8025932b57b1df83de9fd274eb1617d70299b371890cec6ecd23194
|
File details
Details for the file sxlaep-1.0.4-py3-none-any.whl.
File metadata
- Download URL: sxlaep-1.0.4-py3-none-any.whl
- Upload date:
- Size: 6.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe1ee297ae33abf37ca0c271eaf77a8fed048d3dd627a491cb1f8786918b3a23
|
|
| MD5 |
37cca03edb5e5d3a54c3b8f8f5aa0d2c
|
|
| BLAKE2b-256 |
46940bfd916ac003ffbe8412eb7246534df8a4fbb701922b046a664c87188178
|