AmplifyP is a Python rewrite of William Engels's Amplify4, a tool for simulating Polymerase Chain Reaction (PCR). It allows users to predict amplification products (amplicons) from a given DNA template and a set of primers, taking into account the primability and stability of primer binding sites.
- PCR Simulation: Predict potential amplicons based on primer binding properties.
- Scoring System: Calculates primability and stability scores for primer binding sites using customizable weight tables.
- GUI Application: Includes a Tkinter-based graphical user interface for easy interaction.
- Python API: Provides a flexible API for programmatic access to simulation tools.
To use AmplifyP, clone the repository and ensure you have a compatible Python environment (Python 3.12+).
You probably want to set up your Python virtual environment first:
python -m venv venv
source venv/bin/activate
Then install AmplifyP:
git clone https://github.com/fangfufu/AmplifyP.git
cd AmplifyP
pip install .You can run AmplifyP directly in your browser without any installation! Visit the live static web app here: https://fangfufu.github.io/AmplifyP/
To test the static site build locally:
./build_static.sh
python -m http.server 23455 -d src/distThen open http://localhost:23455 in your browser.
Note: The static site runs Python entirely in the browser via Pyodide. File save/load uses a custom
file_handler.jsthat bridges the Pyodide Web Worker with the main thread for DOM-based file operations.
To launch the GUI locally as a desktop app:
python src/main.pyThe GUI allows you to:
- Input a template DNA sequence.
- Add multiple primers.
- Configure primability and stability cutoffs.
- Simulate PCR to view potential amplicons.
- Analyze individual primers to see all potential binding sites.
You can also use AmplifyP as a library in your Python scripts.
from amplifyp.dna import DNA, Primer, DNAType
from amplifyp.repliconf import Repliconf
from amplifyp.amplicon import AmpliconGenerator
from amplifyp.settings import DEFAULT_SETTINGS
# 1. Define your DNA template and primers
template_seq = "AGCT..." # Replace with your actual sequence
template = DNA(template_seq, DNAType.LINEAR, name="MyTemplate")
primer_fwd = Primer("AGCT...", name="FwdPrimer")
primer_rev = Primer("TCGA...", name="RevPrimer")
# 2. Initialize the Amplicon Generator
generator = AmpliconGenerator(template)
# 3. Create Replication Configurations for each primer
# This step calculates potential binding sites on the template
conf_fwd = Repliconf(template, primer_fwd, DEFAULT_SETTINGS)
conf_rev = Repliconf(template, primer_rev, DEFAULT_SETTINGS)
# 4. Search for origins (binding sites)
conf_fwd.search()
conf_rev.search()
# 5. Add configurations to the generator
generator.add(conf_fwd)
generator.add(conf_rev)
# 6. Generate amplicons
amplicons = generator.get_amplicons()
for amp in amplicons:
print(f"Product: {amp.product.name}")
print(f"Sequence: {amp.product.seq}")
print(f"Length: {len(amp.product)}")
print(f"Quality Score: {amp.q_score}")
print("-" * 20)To run the unit tests, install pytest and run it from the root of the
repository:
pip install pytest pytest-cov
pytestThis project is based on the logic and methodology of Amplify4 by William Engels. We aim to preserve the accuracy of the original simulations while providing a modern Python implementation.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.