CoolFace
Apppublic

park758/Codon_OPT

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

Plant Codon Optimizer ๐ŸŒฑ

![Docker](https://www.docker.com/) ![Python](https://www.python.org/) ![Flask](https://flask.palletsprojects.com/)

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

  1. 1.Create a new Space on Hugging Face.
  2. 2.Select Docker as the SDK.
  3. 3.Upload the contents of this repository.
  4. 4.The application will build and start automatically on port 7860.

Run Locally with Docker

bash
# Build the image
docker build -t codon-opt .

# Run the container (accessible at http://localhost:7860)
docker run -p 7860:7860 codon-opt

Run Locally with Python

bash
# 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.

  1. 1.Initialization: A population of random DNA sequences (coding for your target protein) is created.
  2. 2.Evaluation: Each sequence is scored on Harmony, Context, and GC content.
  3. 3.Selection: The best sequences are chosen to reproduce.
  4. 4.Crossover & Mutation: Parents are combined and mutated to create new, potentially better offspring.
  5. 5.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.