Skip to content

Repository files navigation

AMP-Microevolution

Overview

This repository implements a method for generating novel candidate antimicrobial peptide sequences (AMPs) by coupling a genetic algorithm (GA) with a pretrained deep-learning classifier that estimates the probability of a given sequence exhibiting antimicrobial activity, which is a methodology based on our previous work (Njirjak et al., Nat. Mach. Intell., 2024). Candidate peptides are evolved directly in sequence space and selected according to the learned fitness signal.

The central design principle is microevolution: rather than running a single, large-population GA to convergence, the method repeats many independent, short-lived sub-runs, each seeded with a small, randomly initialized population. Each sub-run behaves as an isolated evolving lineage that explores and locally converges within its own neighborhood of chemical space before terminating, analogous to a population undergoing a brief, independent bout of evolutionary adaptation. Because each sub-run starts from an independently sampled initial population and applies stochastic selection, crossover, and mutation, different sub-runs tend to converge towards different regions of sequence space. Iterating this process many times and pooling the qualifying individuals across sub-runs yields a diverse library of high-fitness peptides that is broader than what a single, larger-population GA run would typically produce.

Data

The curated peptide dataset used to train the AMP classifier from our previous work (Otović et al., J. Chem. Inf. Model., 2022) is located at data/amp_combined_clean.csv. The dataset itself is provided here for transparency and reproducibility of the classifier training pipeline; it is not consumed directly by the generation scripts, which instead rely on the pretrained model shipped in src/amp_microevolution/amp_model/. Additionally, the instances were weighted during training phase to account for the class imbalance present in the dataset.

Repository Structure

.
├── data/
│   └── amp_combined_clean.csv           # Curated peptide dataset used for AMP classifier development
├── generated_peptides/
│   ├── library.fasta                    # Full library of generated qualifying peptides
│   └── top.fasta                        # Fitness-weighted subsample of top candidates
├── src/
│   └── amp_microevolution/
│       ├── amp_model/                   # Pretrained AMP probability classifier
│       ├── amp_peptide_eval.py          # SeqpropsAMPFitness: model-based fitness function
│       ├── ga_peptide_microevolution.py # AMP_GA: core genetic algorithm implementation
│       ├── generate.py                  # Command-line entry point for peptide generation
│       └── models.py                    # Model architectures used in the AMP classifier
├── pyproject.toml
├── uv.lock
└── README.md

Installation

This project uses uv for dependency management, with all dependencies pinned in pyproject.toml and locked in uv.lock.

git clone https://github.com/mnjirjak/amp-microevolution.git
cd amp-microevolution
uv sync

Usage

Peptide generation is exposed via five console entry points, each corresponding to a target category and each invoking the same underlying routine (amp_microevolution.generate:main). The invoked script name determines the output directory:

uv run <category, e.g. 'generate_broad_spectrum'> --n-sequences 50000 --top-k 100 --seed 42

Command-Line Arguments

Argument Default Description
--n-sequences 50000 Total number of qualifying peptides to collect
--top-k 100 Number of peptides to sample (fitness-weighted, without replacement) for the top-candidate file
--seed 42 Random seed for reproducibility
--length 50 Reserved for future use; the maximum peptide length is currently fixed at 50 AA by the algorithm and this argument is ignored with a warning if overridden

Output

Each run creates a directory named after the invoked entry point and writes two FASTA files:

  • library.fasta: all collected qualifying peptides, each annotated with its predicted fitness score.
  • top.fasta: a fitness-weighted random subsample of top-k peptides drawn without replacement from the library.

Example outputs generated with the default configuration are provided under generated_peptides/ for reference (50,000 peptides in library.fasta, 100 peptides in top.fasta).

About

Generates novel antimicrobial peptide candidates by coupling a genetic algorithm with a pretrained deep-learning classifier, using a "microevolution" strategy of many short, independent GA sub-runs to produce a diverse library of high-fitness sequences.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages