File size: 7,277 Bytes
75aae0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: ColiFormer Training and Evaluation Dataset
license: mit
tags:
- biology
- codon-optimization
- e-coli
- protein-synthesis
- bioinformatics
- synthetic-biology
size_categories:
- 10K<n<100K
task_categories:
- text-generation
- sequence-modeling
language:
- en
pretty_name: E. coli Codon Optimization Dataset for ColiFormer
---

# ColiFormer Training and Evaluation Dataset

This dataset contains the training and evaluation data used for the **ColiFormer** model - a specialized codon optimization transformer fine-tuned for *Escherichia coli* sequences. The model achieves 6.2% better CAI (Codon Adaptation Index) scores compared to the base CodonTransformer model.

## 🔗 Related Resources

- **Model**: [saketh11/ColiFormer](https://huggingface.co/saketh11/ColiFormer)
- **Base Model**: [adibvafa/CodonTransformer](https://huggingface.co/adibvafa/CodonTransformer)
- **Paper**: [CodonTransformer: The Global Codon Optimization Benchmark](https://www.biorxiv.org/content/10.1101/2023.09.09.556981v1)

## 📁 Dataset Contents

### Core Dataset Files

#### 1. `finetune_set.json` (9.0MB)
**Training data for fine-tuning the ColiFormer model**
- **Format**: JSONL with codon-tokenized sequences
- **Size**: ~4,300 high-CAI E. coli gene sequences
- **Fields**:
  - `idx`: Sequence identifier
  - `codons`: Codon-tokenized DNA sequence (format: `AMINO_CODON`)
  - `organism`: Organism ID (51 = *Escherichia coli* general)
- **Usage**: Fine-tuning CodonTransformer for E. coli-specific optimization

#### 2. `test_set.json` (103KB)
**Evaluation dataset for model testing**
- **Format**: JSON array of test sequences
- **Size**: 100 sequences
- **Fields**:
  - `codons`: DNA sequence for evaluation
  - `organism`: Organism ID (51)
- **Usage**: Performance evaluation and benchmarking

### Reference Data for Metrics Calculation

#### 3. `ecoli_processed_genes.csv` (55MB)
**Comprehensive E. coli gene dataset with CAI annotations**
- **Size**: ~50,000 validated E. coli gene sequences
- **Fields**:
  - `gene_id`: Gene identifier from NCBI
  - `dna_sequence`: Complete coding DNA sequence
  - `protein_sequence`: Translated amino acid sequence
  - `cai_score`: Calculated Codon Adaptation Index
  - `is_high_cai`: Boolean flag for high-CAI sequences (used for filtering training data)
- **Usage**: CAI weight calculation, reference sequences for evaluation metrics

#### 4. `CAI.csv` (45MB)
**Raw CAI scores and sequences**
- **Fields**:
  - `gene_id`: Gene identifier
  - `cai_score`: CAI score
  - `dna_sequence`: DNA sequence
- **Usage**: Original CAI calculation data

#### 5. `Database 3_4300 gene.csv` (4.9MB)
**High-CAI gene subset**
- **Size**: 4,300 high-quality E. coli genes
- **Fields**:
  - `dna_sequence`: High-CAI DNA sequences
- **Usage**: Identifying high-quality sequences for training

#### 6. `organism_tai_weights.json`
**Organism-specific tRNA Adaptation Index (tAI) weights**
- **Format**: JSON with organism-specific tAI coefficients
- **Coverage**: Multiple organisms including *E. coli*
- **Usage**: Calculating tAI scores for evaluation metrics

## 📊 Metrics and Evaluation

The dataset enables calculation of multiple codon optimization metrics:

### Primary Metrics
- **CAI (Codon Adaptation Index)**: Measures codon usage bias relative to highly expressed genes
- **tAI (tRNA Adaptation Index)**: Reflects tRNA availability for translation
- **GC Content**: Nucleotide composition analysis

### Secondary Metrics
- **Restriction Sites**: Count of restriction enzyme recognition sites
- **Negative Cis Elements**: Regulatory sequence analysis
- **Homopolymer Runs**: Repetitive sequence detection
- **ENC (Effective Number of Codons)**: Codon usage diversity
- **CPB (Codon Pair Bias)**: Codon pair preferences
- **SCUO (Synonymous Codon Usage Order)**: Codon usage ordering

## 🔬 Model Performance

### ColiFormer vs Base Model Results
- **CAI Improvement**: +6.2% average improvement
- **Training Data**: 4,300 high-CAI E. coli sequences
- **Architecture**: BigBird Transformer with Adaptive Learning Methods (ALM)
- **Specialization**: Optimized specifically for *E. coli* codon usage patterns

### Benchmarking
The dataset includes comprehensive evaluation protocols comparing:
1. **Fine-tuned ColiFormer**: E. coli-specialized model
2. **Base CodonTransformer**: General-purpose model  
3. **Naive HFC**: High-frequency codon baseline

## 🧬 Data Processing Pipeline

### 1. Data Collection
- Source: NCBI *E. coli* genome annotations
- Quality filtering: Valid ORFs, proper start/stop codons
- CAI calculation using relative adaptiveness

### 2. Training Set Creation
- Filter for `is_high_cai == True` sequences
- Remove duplicates based on DNA sequence
- Format conversion to codon-tokenized representation

### 3. Test Set Creation  
- Sample 100 sequences from lower-CAI pool
- Ensure diversity and representative coverage
- Format for evaluation pipeline

## 📈 Usage Examples

### Loading the Dataset

```python
from datasets import load_dataset

# Load the complete dataset
dataset = load_dataset("saketh11/ColiFormer-Data")

# Load specific files
import pandas as pd
import json

# Training data
with open("finetune_set.json", "r") as f:
    finetune_data = [json.loads(line) for line in f]

# Reference sequences for CAI calculation
processed_genes = pd.read_csv("ecoli_processed_genes.csv")
reference_sequences = processed_genes['dna_sequence'].tolist()

# Calculate CAI weights
from CAI import relative_adaptiveness
cai_weights = relative_adaptiveness(sequences=reference_sequences)
```

### Calculating Metrics

```python
from CAI import CAI
import json

# Load tAI weights
with open("organism_tai_weights.json", "r") as f:
    tai_weights = json.load(f)["Escherichia coli general"]

# Calculate metrics for a sequence
dna_sequence = "ATGAAAGAACTG..."  # Your sequence
cai_score = CAI(dna_sequence, weights=cai_weights)
tai_score = calculate_tAI(dna_sequence, tai_weights)
```

## 📚 Citation

If you use this dataset in your research, please cite:

```bibtex
@article{coliformer2024,
  title={ColiFormer: Enhanced E. coli Codon Optimization with Adaptive Learning Methods},
  author={Your Name},
  journal={bioRxiv},
  year={2024},
  note={Fine-tuned model achieving 6.2\% CAI improvement over base CodonTransformer}
}

@article{codontransformer2023,
  title={CodonTransformer: The Global Codon Optimization Benchmark},
  author={Adibvafa Fallahpour and Bartosz Grzybowski and Seyed Pooya Alavizadeh and Ali Emami},
  journal={bioRxiv},
  year={2023},
  doi={10.1101/2023.09.09.556981}
}
```

## 🔄 Data Updates

This dataset represents the training and evaluation data used for the initial ColiFormer model. Future updates may include:
- Additional E. coli strains and conditions
- Extended metric calculations
- Comparative analysis with other organisms
- Integration with experimental validation data

## ⚖️ License

This dataset is released under the MIT License. See LICENSE file for details.

## 🤝 Contributing

For questions, issues, or contributions related to this dataset, please contact the maintainers or open an issue in the associated model repository.

---

**Keywords**: codon optimization, E. coli, synthetic biology, protein expression, CAI, tAI, transformer model, bioinformatics