File size: 7,768 Bytes
ca41776
 
 
5770d80
ca41776
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# BioFlow - AI-Powered Drug Discovery Platform

[![Version](https://img.shields.io/badge/version-2.0.0-blue.svg)]()
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

**BioFlow** is a unified AI platform for drug discovery, combining molecular encoding, protein analysis, and drug-target interaction prediction in a modern web interface.

## πŸ—οΈ Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Next.js Frontend                          β”‚
β”‚                   (React 19 + Tailwind)                      β”‚
β”‚                     localhost:3000                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ HTTP/REST
                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   FastAPI Backend                            β”‚
β”‚                    localhost:8000                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ ModelService β”‚  β”‚QdrantServiceβ”‚  β”‚ DTI Predictor    β”‚   β”‚
β”‚  β”‚ (Encoders)   β”‚  β”‚ (VectorDB)  β”‚  β”‚ (DeepPurpose)    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚
                        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    OpenBioMed Core                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Models   β”‚  β”‚  Datasets  β”‚  β”‚       Tasks         β”‚   β”‚
β”‚  β”‚ BioT5,ESM  β”‚  β”‚ DAVIS,KIBA β”‚  β”‚ Property Prediction β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## πŸš€ Quick Start

### Prerequisites

- Python 3.10+
- Node.js 18+ with pnpm
- (Optional) CUDA-compatible GPU

### Installation

```bash
# Clone the repository
git clone https://github.com/hamzasammoud11-dotcom/lacoste001.git
cd lacoste001

# Install Python dependencies
pip install -r bioflow/api/requirements.txt

# Install frontend dependencies
cd lacoste001/ui
pnpm install
cd ../..
```

### Running

**Option 1: Using the launch script (Windows)**

```bash
launch_bioflow_full.bat
```

**Option 2: Manual start**

```bash
# Terminal 1: Start FastAPI backend
python -m uvicorn bioflow.api.server:app --reload --port 8000

# Terminal 2: Start Next.js frontend
cd lacoste001/ui
pnpm dev
```

### Access

- **Frontend**: <http://localhost:3000>
- **API Docs**: <http://localhost:8000/docs>
- **API Health**: <http://localhost:8000/health>

## πŸ“ Project Structure

```
OpenBioMed/
β”œβ”€β”€ bioflow/                    # BioFlow Platform
β”‚   β”œβ”€β”€ api/                    # FastAPI Backend
β”‚   β”‚   β”œβ”€β”€ server.py           # Main API server
β”‚   β”‚   β”œβ”€β”€ model_service.py    # Unified model access
β”‚   β”‚   β”œβ”€β”€ qdrant_service.py   # Vector database
β”‚   β”‚   └── dti_predictor.py    # DTI prediction
β”‚   β”œβ”€β”€ core/                   # Core abstractions
β”‚   β”œβ”€β”€ plugins/                # Encoders & retrievers
β”‚   └── workflows/              # Pipeline definitions
β”‚
β”œβ”€β”€ lacoste001/
β”‚   └── ui/                     # Next.js Frontend
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ api/            # API routes
β”‚       β”‚   └── dashboard/      # UI pages
β”‚       β”œβ”€β”€ components/         # React components
β”‚       └── lib/                # Services & utilities
β”‚
β”œβ”€β”€ open_biomed/                # OpenBioMed Research Engine
β”‚   β”œβ”€β”€ models/                 # BioT5, ESM, GraphMVP
β”‚   β”œβ”€β”€ datasets/               # Dataset loaders
β”‚   └── tasks/                  # Task implementations
β”‚
└── configs/                    # YAML configurations
```

## πŸ”Œ API Endpoints

### Discovery Pipeline

- `POST /api/discovery` - Start discovery job
- `GET /api/discovery/{job_id}` - Get job status

### Predictions

- `POST /api/predict` - DTI prediction
- `POST /api/encode` - Encode molecule/protein/text

### Data Management

- `POST /api/ingest` - Add data to vector DB
- `GET /api/molecules` - List molecules
- `GET /api/proteins` - List proteins
- `GET /api/collections` - List vector collections

### Visualization

- `GET /api/explorer/embeddings` - Get 2D projections
- `GET /api/similarity` - Compute similarity scores

## πŸ§ͺ Features

### Drug Discovery Pipeline

- Natural language, SMILES, or FASTA input
- Automatic modality detection
- Vector similarity search
- Property prediction (MW, LogP, TPSA)
- Binding affinity prediction

### Molecular Analysis

- 2D/3D molecule visualization
- SMILES validation
- Property calculation via RDKit

### Protein Analysis

- 3D protein structure viewing
- Sequence embedding
- DTI prediction

### Explorer

- UMAP/t-SNE embedding visualization
- Cluster analysis
- Interactive filtering

## πŸ”§ Configuration

### Environment Variables

```bash
# .env file
NEXT_PUBLIC_API_URL=http://localhost:8000
QDRANT_URL=http://localhost:6333  # Optional: remote Qdrant
QDRANT_PATH=./qdrant_data          # Local Qdrant storage
```

### API Configuration

Edit `lacoste001/ui/config/api.config.ts`:

```typescript
export const API_CONFIG = {
  baseUrl: process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000",
  // ...
}
```

## 🧬 Model Support

| Model | Type | Use Case |
|-------|------|----------|
| ChemBERTa | Molecule Encoder | SMILES embeddings |
| ESM-2 | Protein Encoder | Sequence embeddings |
| PubMedBERT | Text Encoder | Biomedical text |
| DeepPurpose | DTI | Binding prediction |
| GraphMVP | Property | Molecular properties |
| BioT5 | Generation | Molecule generation |

## πŸ“Š Development

### Verify Installation

```bash
python scripts/verify_phase3.py
```

### Run Tests

```bash
pytest tests/
```

### Type Checking (Frontend)

```bash
cd lacoste001/ui
pnpm tsc --noEmit
```

## 🀝 Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request

## πŸ“„ License

Apache 2.0 - See [LICENSE](LICENSE)

## πŸ™ Acknowledgments

- [OpenBioMed](https://github.com/PharMolix/OpenBioMed) - Foundation models
- [DeepPurpose](https://github.com/kexinhuang12345/DeepPurpose) - DTI prediction
- [Qdrant](https://qdrant.tech/) - Vector database
- [Next.js](https://nextjs.org/) - React framework
- [Shadcn/ui](https://ui.shadcn.com/) - UI components