Spaces:
Running
Running
lucapinello
commited on
Commit
·
028b069
1
Parent(s):
0b617df
update
Browse files
README.md
CHANGED
|
@@ -1,14 +1,56 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
-
short_description: ' Generation of cell type-specific DNA sequences'
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: DNA Diffusion Slot Machine
|
| 3 |
+
emoji: 🧬
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.1
|
| 8 |
+
app_file: app_spaces.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# DNA-Diffusion Slot Machine 🎰🧬
|
| 14 |
+
|
| 15 |
+
An interactive web application for generating cell type-specific DNA regulatory sequences using the DNA-Diffusion model from [Pinello Lab](https://pinellolab.org).
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- 🎰 **Interactive Slot Machine Interface**: Watch 200 slots spin as DNA sequences are generated
|
| 20 |
+
- 🧬 **Cell Type-Specific**: Generate sequences for K562, GM12878, and HepG2 cell lines
|
| 21 |
+
- ⚡ **Real-time Animation**: Visual feedback during sequence generation
|
| 22 |
+
- 🎨 **Beautiful UI**: Retro-futuristic design with smooth animations
|
| 23 |
+
|
| 24 |
+
## Note
|
| 25 |
+
|
| 26 |
+
This is a demo version running in mock mode. For real DNA sequence generation:
|
| 27 |
+
1. Deploy with GPU enabled
|
| 28 |
+
2. Install DNA-Diffusion model dependencies
|
| 29 |
+
3. Use the full `app.py` instead of `app_spaces.py`
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
1. Select a cell type (K562, GM12878, or HepG2)
|
| 34 |
+
2. Click GENERATE or pull the lever
|
| 35 |
+
3. Watch the slots spin!
|
| 36 |
+
4. View your generated 200bp regulatory sequence
|
| 37 |
+
|
| 38 |
+
## Citation
|
| 39 |
+
|
| 40 |
+
If you use this application in your research, please cite:
|
| 41 |
+
|
| 42 |
+
```bibtex
|
| 43 |
+
@article{dnadiffusion2024,
|
| 44 |
+
title={DNA-Diffusion: Leveraging Generative Models for Controlling Chromatin Accessibility and Gene Expression via Synthetic Regulatory Elements},
|
| 45 |
+
author={DaSilva, Lucas Ferreira and Senan, Simon and Patel, Zain Munir and others},
|
| 46 |
+
journal={bioRxiv},
|
| 47 |
+
year={2024},
|
| 48 |
+
doi={10.1101/2024.02.01.578352}
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Links
|
| 53 |
+
|
| 54 |
+
- [GitHub Repository](https://github.com/pinellolab/gradio-dna-diffusion)
|
| 55 |
+
- [DNA-Diffusion Paper](https://www.biorxiv.org/content/10.1101/2024.02.01.578352v1)
|
| 56 |
+
- [Pinello Lab](https://pinellolab.org)
|
app.py
CHANGED
|
@@ -14,6 +14,20 @@ import html
|
|
| 14 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
| 15 |
logger = logging.getLogger(__name__)
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Try to import model, but allow app to run without it for UI development
|
| 18 |
try:
|
| 19 |
from dna_diffusion_model import DNADiffusionModel, get_model
|
|
@@ -61,6 +75,7 @@ class DNADiffusionApp:
|
|
| 61 |
finally:
|
| 62 |
self.model_loading = False
|
| 63 |
|
|
|
|
| 64 |
def generate_sequence(self, cell_type: str, guidance_scale: float = 1.0) -> Tuple[str, Dict[str, Any]]:
|
| 65 |
"""Generate a DNA sequence using the model or mock data"""
|
| 66 |
|
|
|
|
| 14 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
| 15 |
logger = logging.getLogger(__name__)
|
| 16 |
|
| 17 |
+
# Try to import spaces for GPU decoration
|
| 18 |
+
try:
|
| 19 |
+
import spaces
|
| 20 |
+
SPACES_AVAILABLE = True
|
| 21 |
+
except ImportError:
|
| 22 |
+
SPACES_AVAILABLE = False
|
| 23 |
+
# Create a dummy decorator if spaces is not available
|
| 24 |
+
class spaces:
|
| 25 |
+
@staticmethod
|
| 26 |
+
def GPU(duration=60):
|
| 27 |
+
def decorator(func):
|
| 28 |
+
return func
|
| 29 |
+
return decorator
|
| 30 |
+
|
| 31 |
# Try to import model, but allow app to run without it for UI development
|
| 32 |
try:
|
| 33 |
from dna_diffusion_model import DNADiffusionModel, get_model
|
|
|
|
| 75 |
finally:
|
| 76 |
self.model_loading = False
|
| 77 |
|
| 78 |
+
@spaces.GPU(duration=60)
|
| 79 |
def generate_sequence(self, cell_type: str, guidance_scale: float = 1.0) -> Tuple[str, Dict[str, Any]]:
|
| 80 |
"""Generate a DNA sequence using the model or mock data"""
|
| 81 |
|