# Phagetrix
[](https://badge.fury.io/py/phagetrix)
[](https://pypi.org/project/phagetrix/)
[](https://github.com/retospect/phagetrix/blob/main/LICENSE)
[](https://github.com/retospect/phagetrix/actions/workflows/check.yml)
[](https://colab.research.google.com/github/retospect/phagetrix/blob/main/examples/phagetrix.ipynb)
[](https://doi.org/10.5281/zenodo.7676572)
**A powerful codon optimization tool for [phage display library](https://bio.libretexts.org/Bookshelves/Biochemistry/Supplemental_Modules_(Biochemistry)/4._Biotechnology_2/4.3%3A_M13_Phage_Display_Libraries) generation and protein engineering.**
Phagetrix helps researchers design optimal degenerate codon libraries for phage display, directed evolution, and synthetic biology applications. Maximize your library diversity while staying within experimental constraints.
## Table of Contents
- [Key Features](#key-features)
- [Use Cases](#use-cases)
- [The Library Diversity Problem](#the-library-diversity-problem)
- [Quick Start](#quick-start)
- [Installation](#installation)
- [Advanced Features](#advanced-features)
- [Documentation & Support](#documentation--support)
- [Citation](#citation)
- [Related Tools](#related-tools)
- [License](#license)
## Key Features
- **Intelligent codon optimization** - Automatically selects the best degenerate codons for your amino acid requirements
- **Library statistics** - Calculate theoretical diversity and material requirements
- **Multi-vendor support** - Compatible with IDT, Eurofins, and NEB degenerate codon sets
- **Species-specific** - Supports codon usage tables for multiple organisms
- **Easy to use** - Simple file format and command-line interface
- **Python integration** - Use as a library in your bioinformatics pipelines
## Use Cases
- **Phage display library design** - Optimize antibody/peptide libraries
- **Directed evolution** - Design mutagenesis libraries for protein engineering
- **Synthetic biology** - Create diverse protein variants for screening
- **Molecular biology research** - Plan degenerate PCR experiments
## The Library Diversity Problem
When creating phage display libraries, you're limited by experimental constraints:
- **1 liter of phage solution** ≈ **10¹² different sequences**
- **Random mutagenesis**: 20⁹ ≈ 10¹² permutations (only ~9 variable positions)
- **Smart degenerate codons**: 6¹⁵ ≈ 10¹² permutations (**~15 variable positions!**)
**Phagetrix maximizes your library diversity** by intelligently selecting degenerate codons from manufacturers like [IDT](https://www.idtdna.com/pages/support/faqs/what-are-the-base-degeneracy-codes-that-you-use-(eg.-r-w-k-v-s-)), Eurofins, and NEB, allowing you to target more positions with rational amino acid choices.
## Quick Start
### Python Library (Recommended)
```python
import phagetrix
# Optimize degenerate codons for your sequence
result = phagetrix.optimize_codons(
sequence="VLAYMVAQVQ",
variations={3: "AGVIL", 4: "YFW", 7: "AVIL"}
)
print("Optimized DNA sequence:", result["final_sequence"])
print("Efficiency per position:", result["efficiency"])
```
### Command Line Interface
Create a simple text file specifying your target sequence and desired variations:
```txt
VLAYMVAQVQ
A3AGVIL
Y4YFW
A7AVIL
```
Run Phagetrix:
```bash
phagetrix input.txt
```
### Output
```txt
1 2 3 4 5 6 7 8 9 10
V L A Y M V A Q V Q
GTT CTT VBA TDK ATG GTT VYA CAG GTT CAG degenerate codons
56 50 67 percentage on target
1V 1L 1V 1Y 1M 1V 1V 1Q 1V 1Q
1L 1W 1L
1I 1F 1I
1G -- 1A
1A 1L --
-- 1C 1T
2R 1* 1P
Final sequence: GTTCTTVBATDKATGGTTVYACAGGTTCAG
```
**Output includes:**
- **Degenerate codons** (VBA, TDK, etc.) optimized for your requirements
- **Efficiency percentages** showing on-target vs off-target products
- **Amino acid breakdown** for each position
- **Ready-to-order sequence** for DNA synthesis
## Installation
### Using pip (recommended)
```bash
pip install phagetrix
```
### Using Poetry (for development)
```bash
git clone https://github.com/retospect/phagetrix.git
cd phagetrix
poetry install
poetry run phagetrix --help
```
### Try Online
[](https://colab.research.google.com/github/retospect/phagetrix/blob/main/examples/phagetrix.ipynb)
Try Phagetrix interactively in your browser with comprehensive examples!
**Requirements:** Python 3.10 or higher
## Library Usage
### Common Functions
```python
import phagetrix
# Get available companies and species
companies = phagetrix.get_available_companies()
species = phagetrix.get_available_species()
# Parse existing Phagetrix files
seq, variations, config = phagetrix.parse_phagetrix_file("input.phagetrix")
# Calculate library statistics
stats = phagetrix.calculate_library_stats("ACDEF", {1: "AG", 3: "DEF"})
print(f"Library diversity: {stats['diversity']:,} variants")
# Compare different companies
for company in ["IDT", "Eurofins", "NEB"]:
result = phagetrix.optimize_codons("ACDEF", {1: "AG"}, company=company)
print(f"{company}: {result['final_sequence']}")
```
### Batch Processing
```python
# Process multiple sequences
sequences = [
("CDR1", "RASQSISSWLA", {4: "QE", 6: "ST"}),
("CDR2", "AASSLQS", {3: "ST", 5: "LI"}),
("CDR3", "QQSYSTPLT", {3: "ST", 7: "PT"})
]
for name, seq, vars in sequences:
result = phagetrix.optimize_codons(seq, vars)
print(f"{name}: {result['final_sequence']}")
```
For complete examples, see **[Library Usage Guide](LIBRARY_USAGE.md)** and run:
```bash
python examples/library_examples.py
```
## Advanced Features
### Custom Numbering
Add position offsets for working with longer sequences:
```txt
# offset = 20
VLAYMVAQVQ
A23AGVIL # Position 23 in the full protein
```
### Multiple Vendors
Choose your preferred DNA synthesis company:
```bash
phagetrix --company IDT input.txt # Default
phagetrix --company Eurofins input.txt
phagetrix --company NEB input.txt
```
### Species-Specific Codon Usage
Optimize for different organisms:
```bash
phagetrix --species e_coli input.txt # Default
phagetrix --species h_sapiens_9606 input.txt # Human
phagetrix --species s_cerevisiae_4932 input.txt # Yeast
```
## Documentation & Support
- **[Library Usage Guide](LIBRARY_USAGE.md)** - Complete Python library documentation
- **[Contributing Guidelines](CONTRIBUTING.md)** - Help improve Phagetrix
- **[Release Process](RELEASE.md)** - How to create releases
- **[GitHub Workflows](.github/WORKFLOWS.md)** - Automated CI/CD and release process
- **[Changelog](CHANGELOG.md)** - See what's new
- **[Examples](examples/)** - Code examples and tutorials
## Citation
If you use Phagetrix in your research, please cite:
```bibtex
@software{phagetrix,
title = {Phagetrix: Codon optimization for phage display libraries},
author = {Stamm, Reto},
doi = {10.5281/zenodo.7676572},
url = {https://github.com/retospect/phagetrix}
}
```
## Related Tools
- **[varVAMP](https://github.com/jonas-fuchs/varVAMP)** - Primers for highly variable genomes
- **[Biopython](https://biopython.org/)** - Python bioinformatics toolkit
## Acknowledgments
This package has been enhanced and maintained with assistance from **[Windsurf](https://codeium.com/windsurf)**, an AI-powered development environment that helped implement modern development practices, comprehensive testing, type safety, security scanning, and automated CI/CD workflows.
## License
This project is licensed under the GPL-3.0-or-later License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "phagetrix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "bioinformatics, phage-display, codon-optimization, molecular-biology, protein-engineering, synthetic-biology, directed-evolution, dna-synthesis, degenerate-codons, library-design",
"author": "Reto Stamm",
"author_email": "reto@retospect.ch",
"download_url": "https://files.pythonhosted.org/packages/40/2c/80a376d08f2526b9168b2514df939549d5c987778c814874362d6da18110/phagetrix-1.0.5.tar.gz",
"platform": null,
"description": "# Phagetrix\n\n[](https://badge.fury.io/py/phagetrix)\n[](https://pypi.org/project/phagetrix/)\n[](https://github.com/retospect/phagetrix/blob/main/LICENSE)\n[](https://github.com/retospect/phagetrix/actions/workflows/check.yml)\n[](https://colab.research.google.com/github/retospect/phagetrix/blob/main/examples/phagetrix.ipynb)\n[](https://doi.org/10.5281/zenodo.7676572)\n\n**A powerful codon optimization tool for [phage display library](https://bio.libretexts.org/Bookshelves/Biochemistry/Supplemental_Modules_(Biochemistry)/4._Biotechnology_2/4.3%3A_M13_Phage_Display_Libraries) generation and protein engineering.**\n\nPhagetrix helps researchers design optimal degenerate codon libraries for phage display, directed evolution, and synthetic biology applications. Maximize your library diversity while staying within experimental constraints.\n\n## Table of Contents\n\n- [Key Features](#key-features)\n- [Use Cases](#use-cases) \n- [The Library Diversity Problem](#the-library-diversity-problem)\n- [Quick Start](#quick-start)\n- [Installation](#installation)\n- [Advanced Features](#advanced-features)\n- [Documentation & Support](#documentation--support)\n- [Citation](#citation)\n- [Related Tools](#related-tools)\n- [License](#license)\n\n## Key Features\n\n- **Intelligent codon optimization** - Automatically selects the best degenerate codons for your amino acid requirements\n- **Library statistics** - Calculate theoretical diversity and material requirements \n- **Multi-vendor support** - Compatible with IDT, Eurofins, and NEB degenerate codon sets\n- **Species-specific** - Supports codon usage tables for multiple organisms\n- **Easy to use** - Simple file format and command-line interface\n- **Python integration** - Use as a library in your bioinformatics pipelines\n\n## Use Cases\n\n- **Phage display library design** - Optimize antibody/peptide libraries\n- **Directed evolution** - Design mutagenesis libraries for protein engineering \n- **Synthetic biology** - Create diverse protein variants for screening\n- **Molecular biology research** - Plan degenerate PCR experiments\n\n## The Library Diversity Problem\n\nWhen creating phage display libraries, you're limited by experimental constraints:\n- **1 liter of phage solution** \u2248 **10\u00b9\u00b2 different sequences**\n- **Random mutagenesis**: 20\u2079 \u2248 10\u00b9\u00b2 permutations (only ~9 variable positions)\n- **Smart degenerate codons**: 6\u00b9\u2075 \u2248 10\u00b9\u00b2 permutations (**~15 variable positions!**)\n\n**Phagetrix maximizes your library diversity** by intelligently selecting degenerate codons from manufacturers like [IDT](https://www.idtdna.com/pages/support/faqs/what-are-the-base-degeneracy-codes-that-you-use-(eg.-r-w-k-v-s-)), Eurofins, and NEB, allowing you to target more positions with rational amino acid choices.\n\n## Quick Start\n\n### Python Library (Recommended)\n\n```python\nimport phagetrix\n\n# Optimize degenerate codons for your sequence\nresult = phagetrix.optimize_codons(\n sequence=\"VLAYMVAQVQ\",\n variations={3: \"AGVIL\", 4: \"YFW\", 7: \"AVIL\"}\n)\n\nprint(\"Optimized DNA sequence:\", result[\"final_sequence\"])\nprint(\"Efficiency per position:\", result[\"efficiency\"])\n```\n\n### Command Line Interface\n\nCreate a simple text file specifying your target sequence and desired variations:\n\n```txt\nVLAYMVAQVQ\nA3AGVIL\nY4YFW\nA7AVIL\n```\n\nRun Phagetrix:\n\n```bash\nphagetrix input.txt\n```\n\n### Output\n\n```txt\n 1 2 3 4 5 6 7 8 9 10\n V L A Y M V A Q V Q\n GTT CTT VBA TDK ATG GTT VYA CAG GTT CAG degenerate codons\n 56 50 67 percentage on target\n 1V 1L 1V 1Y 1M 1V 1V 1Q 1V 1Q\n 1L 1W 1L\n 1I 1F 1I\n 1G -- 1A\n 1A 1L --\n -- 1C 1T\n 2R 1* 1P\n\nFinal sequence: GTTCTTVBATDKATGGTTVYACAGGTTCAG\n```\n\n**Output includes:**\n- **Degenerate codons** (VBA, TDK, etc.) optimized for your requirements\n- **Efficiency percentages** showing on-target vs off-target products\n- **Amino acid breakdown** for each position\n- **Ready-to-order sequence** for DNA synthesis\n\n## Installation\n\n### Using pip (recommended)\n```bash\npip install phagetrix\n```\n\n### Using Poetry (for development)\n```bash\ngit clone https://github.com/retospect/phagetrix.git\ncd phagetrix\npoetry install\npoetry run phagetrix --help\n```\n\n### Try Online\n[](https://colab.research.google.com/github/retospect/phagetrix/blob/main/examples/phagetrix.ipynb)\n\nTry Phagetrix interactively in your browser with comprehensive examples!\n\n**Requirements:** Python 3.10 or higher\n\n## Library Usage\n\n### Common Functions\n\n```python\nimport phagetrix\n\n# Get available companies and species\ncompanies = phagetrix.get_available_companies()\nspecies = phagetrix.get_available_species()\n\n# Parse existing Phagetrix files\nseq, variations, config = phagetrix.parse_phagetrix_file(\"input.phagetrix\")\n\n# Calculate library statistics\nstats = phagetrix.calculate_library_stats(\"ACDEF\", {1: \"AG\", 3: \"DEF\"})\nprint(f\"Library diversity: {stats['diversity']:,} variants\")\n\n# Compare different companies\nfor company in [\"IDT\", \"Eurofins\", \"NEB\"]:\n result = phagetrix.optimize_codons(\"ACDEF\", {1: \"AG\"}, company=company)\n print(f\"{company}: {result['final_sequence']}\")\n```\n\n### Batch Processing\n\n```python\n# Process multiple sequences\nsequences = [\n (\"CDR1\", \"RASQSISSWLA\", {4: \"QE\", 6: \"ST\"}),\n (\"CDR2\", \"AASSLQS\", {3: \"ST\", 5: \"LI\"}),\n (\"CDR3\", \"QQSYSTPLT\", {3: \"ST\", 7: \"PT\"})\n]\n\nfor name, seq, vars in sequences:\n result = phagetrix.optimize_codons(seq, vars)\n print(f\"{name}: {result['final_sequence']}\")\n```\n\nFor complete examples, see **[Library Usage Guide](LIBRARY_USAGE.md)** and run:\n```bash\npython examples/library_examples.py\n```\n\n## Advanced Features\n\n### Custom Numbering\nAdd position offsets for working with longer sequences:\n\n```txt\n# offset = 20\nVLAYMVAQVQ\nA23AGVIL # Position 23 in the full protein\n```\n\n### Multiple Vendors\nChoose your preferred DNA synthesis company:\n\n```bash\nphagetrix --company IDT input.txt # Default\nphagetrix --company Eurofins input.txt\nphagetrix --company NEB input.txt\n```\n\n### Species-Specific Codon Usage\nOptimize for different organisms:\n\n```bash\nphagetrix --species e_coli input.txt # Default\nphagetrix --species h_sapiens_9606 input.txt # Human\nphagetrix --species s_cerevisiae_4932 input.txt # Yeast\n```\n\n## Documentation & Support\n\n- **[Library Usage Guide](LIBRARY_USAGE.md)** - Complete Python library documentation\n- **[Contributing Guidelines](CONTRIBUTING.md)** - Help improve Phagetrix\n- **[Release Process](RELEASE.md)** - How to create releases\n- **[GitHub Workflows](.github/WORKFLOWS.md)** - Automated CI/CD and release process\n- **[Changelog](CHANGELOG.md)** - See what's new\n- **[Examples](examples/)** - Code examples and tutorials\n\n## Citation\n\nIf you use Phagetrix in your research, please cite:\n\n```bibtex\n@software{phagetrix,\n title = {Phagetrix: Codon optimization for phage display libraries},\n author = {Stamm, Reto},\n doi = {10.5281/zenodo.7676572},\n url = {https://github.com/retospect/phagetrix}\n}\n```\n\n## Related Tools\n\n- **[varVAMP](https://github.com/jonas-fuchs/varVAMP)** - Primers for highly variable genomes\n- **[Biopython](https://biopython.org/)** - Python bioinformatics toolkit\n\n## Acknowledgments\n\nThis package has been enhanced and maintained with assistance from **[Windsurf](https://codeium.com/windsurf)**, an AI-powered development environment that helped implement modern development practices, comprehensive testing, type safety, security scanning, and automated CI/CD workflows.\n\n## License\n\nThis project is licensed under the GPL-3.0-or-later License - see the [LICENSE](LICENSE) file for details.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Optimizer for degenerate codon use in phage library generation",
"version": "1.0.5",
"project_urls": {
"Bug Tracker": "https://github.com/retospect/phagetrix/issues",
"Documentation": "https://github.com/retospect/phagetrix",
"Homepage": "https://github.com/retospect/phagetrix",
"Repository": "https://github.com/retospect/phagetrix"
},
"split_keywords": [
"bioinformatics",
" phage-display",
" codon-optimization",
" molecular-biology",
" protein-engineering",
" synthetic-biology",
" directed-evolution",
" dna-synthesis",
" degenerate-codons",
" library-design"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "539e1f7e6443cd0abe8b761939e0171caedcb0a2c593dc247fb17d49166b0997",
"md5": "dc00d0e5b2a64e87bad8e476310f5984",
"sha256": "30867fcd2c10409a7eaee896e395d5ce50bf41c56a16c0cca87d14721579fcc2"
},
"downloads": -1,
"filename": "phagetrix-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dc00d0e5b2a64e87bad8e476310f5984",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 28186,
"upload_time": "2025-10-27T22:34:38",
"upload_time_iso_8601": "2025-10-27T22:34:38.121775Z",
"url": "https://files.pythonhosted.org/packages/53/9e/1f7e6443cd0abe8b761939e0171caedcb0a2c593dc247fb17d49166b0997/phagetrix-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "402c80a376d08f2526b9168b2514df939549d5c987778c814874362d6da18110",
"md5": "8cf2e9431523684080217ee764efc659",
"sha256": "aa1e1d10902b3b54e14743dbff7ff5b385b1f34191853f62975d255c8900fd7c"
},
"downloads": -1,
"filename": "phagetrix-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "8cf2e9431523684080217ee764efc659",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 28388,
"upload_time": "2025-10-27T22:34:39",
"upload_time_iso_8601": "2025-10-27T22:34:39.323405Z",
"url": "https://files.pythonhosted.org/packages/40/2c/80a376d08f2526b9168b2514df939549d5c987778c814874362d6da18110/phagetrix-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-27 22:34:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "retospect",
"github_project": "phagetrix",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "phagetrix"
}