Skip to main content

Predict fungal effector proteins from FASTA files using ESM-1b embeddings and R SVM models.

Project description

Fungtion logo

Fungtion

Predict fungal effectors from FASTA files using ESM-1b embeddings and R SVM models.

Paper: https://doi.org/10.1016/j.jmb.2024.168613

For sequences predicted as fungal effectors, this project also generates:

  • ESM-1b-based similarity network visualization
  • relationship tree visualization
  • an HTML report in the style of the original Fungtion web page

Clone the Repository

git clone https://github.com/noHup-cc/fungtion.git
cd fungtion

Install

Option 1: create the full Conda environment from environment.yml (recommended)

conda env create -f environment.yml
conda activate fungtion

# optional: install Fungtion as a local editable package
pip install -e .

Option 2: create the Conda environment manually

conda create -n fungtion -c conda-forge python=3.10 r-base=4.4 r-e1071 r-caret r-optparse
conda activate fungtion

# install the Python package in editable mode
pip install -e .

Developer tooling:

pip install -e ".[dev]"
pre-commit install
pre-commit run --all-files

PyTorch Compatibility

The default installation will install torch automatically.

If your system has specific CPU/GPU or CUDA driver requirements, you may need to reinstall a compatible PyTorch build manually after installation. For example:

# CPU only
pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cpu

# Example: CUDA 12.6
pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu126

Please choose the PyTorch build that matches your local hardware and driver setup:

Example Run

Example FASTA:

  • data/examples/example.fasta

Download ESM-1b Weights

Before prediction, you can download the pretrained ESM-1b weights through a separate setup step. This downloads the same ESM-1b model file that Fungtion would otherwise fetch automatically through fair-esm:

fungtion setup-models

By default, the downloaded file is stored at:

~/.cache/fungtion/models/esm1b_t33_650M_UR50S.pt

You can also choose a custom directory:

fungtion setup-models --model-dir /path/to/models

If the weights already exist locally, the setup step will skip downloading by default. To force a fresh download and overwrite the existing local copy, use:

fungtion setup-models --force

Simple:

fungtion \
  --fasta data/examples/example.fasta \
  --output-dir outputs \
  --prefix example_prediction \
  --device auto \
  --skip-visualization

With HTML report:

fungtion \
  --fasta data/examples/example.fasta \
  --output-dir outputs \
  --prefix example_prediction \
  --device auto \
  --html-report

Keep intermediate files:

fungtion \
  --fasta data/examples/example.fasta \
  --output-dir outputs \
  --prefix example_prediction \
  --device auto \
  --skip-visualization \
  --keep-temp

With GPU:

fungtion \
  --fasta data/examples/example.fasta \
  --output-dir outputs \
  --prefix example_prediction \
  --device cuda \
  --skip-visualization

Note

If the setup-downloaded weights exist in the default Fungtion cache directory, the prediction command will use them automatically.

If you pass --pretrain, Fungtion will use that explicit local path in preference to the default setup location.

You can also download the model file manually to a local path and run Fungtion with --pretrain /path/to/esm1b_t33_650M_UR50S.pt.

fungtion \
  --fasta data/examples/example.fasta \
  --output-dir outputs \
  --prefix example_prediction \
  --pretrain /path/to/esm1b_t33_650M_UR50S.pt \
  --device auto \
  --skip-visualization

Official ESM-1b weights:

Example Run Output

The HTML example above generates everything under outputs/example_prediction/:

  • example_prediction.csv: prediction results
  • example_prediction_analysis/: network and tree intermediate outputs
  • example_prediction.html: HTML report
  • example_prediction_assets/: HTML report assets and per-sequence visualization pages
  • example_prediction_temp_folder/: intermediate feature files when --keep-temp is used

Example Run Output CSV Columns

  • header: FASTA header
  • score: prediction score
  • decision: yes or no
  • type: Exp. or Pred.
  • type_link: external link for Exp. entries when available

Notes

  • If an input sequence is identical to a reference positive sequence, it is marked as Exp. and its score is shown as 1.
  • Other sequences are marked as Pred. and scored by the R SVM models.
  • The HTML report supports search, sorting, pagination, column toggling, export, help popovers, and visualization links.
  • The ESM-1b network page supports clicking non-query nodes to open UniProt or NCBI Protein pages.
  • Before committing code changes, run pre-commit run --all-files to apply Ruff fixes/formatting and basic whitespace checks.

More Parameters On Run

  • --fasta: input FASTA file
  • --output-dir: directory where the prefixed output folder will be created
  • --prefix: naming identifier for the output folder and generated files
  • --pretrain: optional local path to pretrained ESM-1b weights
  • --device: device for ESM-1b feature extraction; choose from auto, cpu, or cuda
  • --html-report: generate the HTML report and bundled assets
  • --skip-visualization: skip network and tree generation
  • --keep-temp: keep intermediate temporary files under <output-dir>/<prefix>/<prefix>_temp_folder/

Data

data/

  • examples/: example FASTA files for demonstration and example runs

Full training and independent benchmark datasets used in the paper are available on Zenodo:

src/fungtion/reference_data/

  • FungalEffector_positive.fasta: experimentally validated fungal effector proteins
  • FungalEffector_positive_esm_uniref50.csv: ESM-1b features of the experimentally validated fungal effector proteins
  • FungalEffector_positive_similarity_matrix/: precomputed reference similarity matrices used for network and relationship tree visualization

Citation

If you use this project, please cite:

@article{li2024fungtion,
  title={Fungtion: A Server for Predicting and Visualizing Fungal Effector Proteins},
  author={Li, Jiahui and Ren, Jinzheng and Dai, Wei and Stubenrauch, Christopher and Finn, Robert D. and Wang, Jiawei},
  journal={Journal of Molecular Biology},
  volume={436},
  number={17},
  pages={168613},
  year={2024},
  doi={10.1016/j.jmb.2024.168613}
}

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

fungtion-1.0.0.tar.gz (18.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fungtion-1.0.0-py3-none-any.whl (18.3 MB view details)

Uploaded Python 3

File details

Details for the file fungtion-1.0.0.tar.gz.

File metadata

  • Download URL: fungtion-1.0.0.tar.gz
  • Upload date:
  • Size: 18.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for fungtion-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4e8671ef3f0482e98342d356cdf6eee5ae50d05e2549c727b09e0e0072276602
MD5 cfb9ae37dcef97725ba542403788fdec
BLAKE2b-256 b9b28cb0313a1c0a7c6323c233fc9f9dd6e69aac33d263dcd59e80fe262d9a8f

See more details on using hashes here.

File details

Details for the file fungtion-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fungtion-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for fungtion-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e05d6f4ca82dfe3f2d11e4cac044fbfcfb28cc9a627b1edce121681c9cbc46e
MD5 7c5d1f39058a71a3100841d93e05c401
BLAKE2b-256 2876724a0aecd7978b1e51b1c2118c598c36652557163f25ebd2d7b194e4e527

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page