Sign inSign up

pratik0297/antifp2

By pratik0297

β€’Updated 12 months ago

AntiFP2: Antifungal Protein Prediction Toolkit

Image
0

139

pratik0297/antifp2 repository overview

⁠AntiFP2: Antifungal Protein Prediction Toolkit (Docker Version)

This repository provides a fully containerized version of AntiFP2, a toolkit for antifungal protein prediction using:

  • ESM2 (fine-tuned language model)
  • Machine Learning (PAAC features)
  • BLAST (sequence similarity adjustment)
  • MERCI (motif adjustment)
  • Prokka (for genome annotation in meta-pipelines)

All dependencies (Python, ESM2 models, BLAST, MERCI, Prokka, etc.) are pre-installed inside the Docker image.


β πŸš€ Running the Docker Container

Instead of running individual scripts directly, you should always enter the Docker container first.

⁠Start an interactive shell inside the container
docker run -it --rm antifp2 bash

By default, this gives you a working shell inside the container.

If you want to work on files stored on your host machine, mount them into the container:

docker run -it --rm -v /absolute/path/to/data:/workspace -w /workspace antifp2 bash
  • /absolute/path/to/data β†’ path on your host with FASTA/contigs files.
  • /workspace β†’ working directory inside the container (you will be placed here after startup).

⁠🧭 Master Launcher: antifp2.py

All methods are launched using a single master script:

python3 antifp2.py --method <method-name> [method-specific options]
⁠List all available methods
python3 antifp2.py --list

This will display:

  • esm2
  • esm2-hybrid
  • esm2-meta
  • ml-hybrid
  • ml-hybrid-meta

Each corresponds to a backend script or combination pipeline.


β πŸ“– Detailed Usage per Method

⁠1️⃣ ESM2 Only β€” esm2

Predict antifungal proteins using the fine-tuned ESM2 model (sequence-only, one-by-one).

⁠Arguments:
FlagDescription
--inputInput protein FASTA file
--outputPath to output CSV file
--threshold(Optional) Probability cutoff (default: 0.5)
--no-cleanup(Optional) Keep intermediate files
⁠Example:
python3 antifp2.py --method esm2 --input proteins.fasta --output esm2_predictions.csv --threshold 0.5

⁠2️⃣ ESM2 + BLAST + MERCI β€” esm2-hybrid

Combines ESM2 predictions with BLAST adjustments and motif analysis (MERCI).

⁠Arguments:
FlagDescription
--inputInput protein FASTA file
--outdirOutput directory for results
--threshold(Optional) Probability cutoff (default: 0.5)
--no-cleanup(Optional) Keep intermediate files
⁠Example:
python3 antifp2.py --method esm2-hybrid --input proteins.fasta --outdir esm2_hybrid_results --threshold 0.6

⁠3️⃣ MetaPipeline (Prokka + ESM2) β€” esm2-meta

Runs Prokka genome annotation first, then applies ESM2 predictions on predicted proteins.

⁠Arguments:
FlagDescription
--inputInput contigs FASTA file
--outdirDirectory for all outputs
--threshold(Optional) Probability cutoff (default: 0.5)
--threads(Optional) CPU threads for Prokka (default: all)
--no-cleanup(Optional) Keep intermediate files
--metagenome(Optional) Enable Prokka metagenome mode
⁠Example:
python3 antifp2.py --method esm2-meta --input contigs.fasta --outdir esm2_meta_out --threads 8

⁠4️⃣ ML Hybrid (PAAC + BLAST + MERCI) β€” ml-hybrid

Uses ML classifier (PAAC features) combined with BLAST and MERCI adjustments.

⁠Arguments:
FlagDescription
--inputInput protein FASTA file
--outdirDirectory for outputs
--threshold(Optional) Probability cutoff (default: 0.5)
--envfilePath to envfile (BLAST/MERCI config)
⁠Example:
python3 antifp2.py --method ml-hybrid --input proteins.fasta --outdir ml_hybrid_out --threshold 0.5

⁠5️⃣ MetaPipeline (Prokka + ML Hybrid) β€” ml-hybrid-meta

Runs Prokka annotation, then applies ML + BLAST + MERCI hybrid classifier.

⁠Arguments:
FlagDescription
--inputInput contigs FASTA
--outdirDirectory for outputs
--threshold(Optional) Probability cutoff (default: 0.5)
--threads(Optional) CPU threads for Prokka
--no-cleanup(Optional) Keep intermediate files
--metagenome(Optional) Enable Prokka metagenome mode
--envfilePath to envfile (BLAST/MERCI config)
⁠Example:
python3 antifp2.py --method ml-hybrid-meta --input contigs.fasta --outdir ml_hybrid_meta_out --threads 8 

β πŸ“‚ Outputs

Depending on the method, outputs include:

File/DirDescription
*_predictions.csvMain prediction results (probabilities, labels)
*_antifp2.fastaFASTA with predicted antifungal proteins
blast_out.csv, *.locateIntermediate BLAST/MERCI results
prokka/ (dir)Prokka annotation results (in meta pipelines)
rejected_log.txtLog of sequences filtered or rejected

⁠πŸ§ͺ Example Full Workflow

Assume your FASTA files are in /home/user/antifp2_data.

  1. Start the container and mount your data:
docker run -it --rm -v /home/user/antifp2_data:/workspace -w /workspace antifp2 bash
  1. Inside the container, run one of the pipelines. Example with ML hybrid:
python3 antifp2.py --method ml-hybrid --input proteins.fasta --outdir results
  1. Outputs (results/) will appear both inside the container and in your host directory (/home/user/antifp2_data/results).

⁠🧹 Cleanup

Use --no-cleanup if you want to keep intermediate .faa, .locate, .csv, or Prokka files for debugging. Otherwise, they are automatically removed.


⁠🍏 Running AntiFP2 on macOS (Apple Silicon)

AntiFP2 runs inside a Linux-based Docker container, which is fully compatible with Intel-based Macs and Apple Silicon (M1/M2/M3) using emulation.

🧠 macOS does not natively support some Linux tools like Prokka due to architecture or package conflicts β€” that’s why Docker is the preferred method.

β βœ… Step-by-Step Setup for Apple Silicon (M1/M2/M3)
  1. Install Docker Desktop for macOS

  2. Enable Rosetta Emulation (only needed once):

softwareupdate --install-rosetta
  1. Pull and run AntiFP2 with x86_64 compatibility:
docker run --platform linux/amd64 --rm -it -v /absolute/path/on/mac:/data pratik0297/antifp2
  1. Run the pipeline inside the container as usual, for example:
python3 antifp2.py --method

esm2-meta --input /data/your_contigs.fasta --outdir /data/esm2_meta --threads 4 --metagenome


### πŸ§ͺ macOS Example

Assuming your FASTA file is at `~/Downloads/testing/first_100.fasta`:

```bash
docker run --platform linux/amd64 --rm -it -v ~/Downloads/testing:/data pratik0297/antifp2

Then, inside the container:

python3 antifp2.py --method esm2-meta --input /data/test_contigs.fasta --outdir /data/esm2_meta
⁠🧯 Troubleshooting
  • If you get Bad CPU type in executable or Illegal instruction errors, it likely means:

    • You didn't use --platform linux/amd64
    • Rosetta 2 isn’t installed
  • Prokka and BLAST inside Docker will work even if they don't install on native macOS.


β βœ… Citation

If you use AntiFP2 in your research, please cite: (Add citation / preprint link here)


β πŸ‘¨β€πŸ’» Support

For issues, please:

Tag summary

Content type

Image

Digest

sha256:134f80ba7…

Size

1.6 GB

Last updated

12 months ago

docker pull pratik0297/antifp2