park758/Codon_OPT
Plant Codon Optimizer ๐ฑ
  
A powerful, user-friendly tool for optimizing DNA sequences for expression in plant systems. Built with Python, Flask, and an advanced Genetic Algorithm (NSGA-III).
๐ Features
- Multi-Organism Support: Optimize sequences for:
- ๐พ Rice (Oryza sativa Japonica)
- ๐ฝ Maize (Zea mays)
- ๐ฑ Soybean (Glycine max)
- ๐ผ Canola (Brassica napus)
- Advanced Optimization: Uses the NSGA-III Genetic Algorithm to balance multiple objectives:
- Harmony Index: Matches the host organism's natural codon usage profile.
- Codon Context: Optimizes codon pairs for efficient translation.
- GC Content: Targets the optimal GC range for plant expression.
- Negative Filtering: Removes splice sites, poly-A signals, and repetitive sequences.
- Smart Reverse Translation: Convert protein sequences to DNA using:
- Harmonized Mode: Introduces natural variation for better optimization potential.
- Fastest Mode: Uses the most frequent codon for each amino acid.
- Robust Job Management:
- Persistent job history using a local SQLite database.
- Run multiple optimizations in parallel.
- Real-time progress tracking (generation-by-generation updates).
- Interactive Results:
- ClustalW-style Alignment: Visualize changes between your original and optimized sequences.
- Validation Reports: Comprehensive quality checks for both original and optimized sequences.
- Manual Editor: Fine-tune your sequence codon-by-codon with real-time feedback.
๐ Deployment
This application is containerized with Docker and ready for deployment on Hugging Face Spaces or any cloud provider.
Run on Hugging Face Spaces
- Create a new Space on Hugging Face.
- Select Docker as the SDK.
- Upload the contents of this repository.
- The application will build and start automatically on port
7860.
Run Locally with Docker
# Build the image
docker build -t codon-opt .
# Run the container (accessible at http://localhost:7860)
docker run -p 7860:7860 codon-optRun Locally with Python
# Install dependencies
pip install -r requirements.txt
# Run the app
python app.py๐ง How It Works
The core of the optimizer is a multi-objective genetic algorithm. It evolves a population of DNA sequences over many generations to find the "fittest" sequence.
- Initialization: A population of random DNA sequences (coding for your target protein) is created.
- Evaluation: Each sequence is scored on Harmony, Context, and GC content.
- Selection: The best sequences are chosen to reproduce.
- Crossover & Mutation: Parents are combined and mutated to create new, potentially better offspring.
- Iteration: This cycle repeats for a set number of generations (default 100).
๐ Project Structure
app.py: The main Flask application server and API routes.core_logic.py: Implementation of the Genetic Algorithm and optimization scoring.validation_module.py: Logic for validating sequences (GC checks, motif finding, etc.).data_loader.py: Handles loading organism codon usage data.codon_data/: JSON files containing codon frequency tables for each organism.templates/: HTML frontend templates.Dockerfile: Configuration for building the Docker image.
๐ค Contributing
Contributions are welcome! If you have suggestions for new organisms, features, or improvements, please feel free to open an issue or submit a pull request.
๐ License
This project is open-source. Please see the LICENSE file for details.
