YYJMAY commited on
Commit
0910878
·
verified ·
1 Parent(s): 1da2800

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +247 -0
README.md ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ tags:
6
+ - mhc
7
+ - peptide
8
+ - immunology
9
+ - out-of-distribution
10
+ - modality-shift
11
+ - binding-affinity
12
+ - eluted-ligand
13
+ size_categories:
14
+ - 1M<n<10M
15
+ ---
16
+
17
+ # Modality OOD Dataset
18
+
19
+ ## Dataset Description
20
+
21
+ The Modality OOD dataset tests model generalization across **different data modalities** in peptide-MHC (pMHC) binding prediction. It contains two complementary datasets representing distinct experimental measurement types:
22
+
23
+ - **BA (Binding Affinity)**: In vitro binding affinity measurements with continuous values
24
+ - **EL (Eluted Ligand)**: Mass spectrometry-based eluted ligand data with binary labels
25
+
26
+ ### Key Features
27
+
28
+ - **Modality Shift Testing**: Evaluates if models trained on one modality (e.g., BA) can generalize to another (e.g., EL)
29
+ - **Real-World Relevance**: Reflects the practical challenge of applying models across different experimental platforms
30
+ - **Large Scale**: Combined 3.85M samples across 130+ HLA alleles
31
+ - **Single Allele Format**: Each sample has one peptide-HLA pair (no multi-allele)
32
+
33
+ ### Biological Significance
34
+
35
+ **Why Two Modalities Matter:**
36
+
37
+ 1. **Binding Affinity (BA)**:
38
+ - Measures peptide-MHC binding strength in controlled conditions
39
+ - Continuous scale (0 = no binding, 1 = strong binding)
40
+ - Reflects thermodynamic stability
41
+ - Common in immunoinformatics training data
42
+
43
+ 2. **Eluted Ligand (EL)**:
44
+ - Peptides naturally presented on cell surface MHC molecules
45
+ - Binary label (1 = naturally presented, 0 = not presented)
46
+ - Reflects cellular processing, TAP transport, and MHC loading
47
+ - More biologically relevant but harder to obtain
48
+
49
+ **The Modality Gap:**
50
+ Models trained on BA data often fail on EL data (and vice versa) because:
51
+ - BA measures binding only, EL captures the full antigen processing pathway
52
+ - Different experimental biases and noise profiles
53
+ - Label semantics differ (affinity vs. presentation)
54
+
55
+ This dataset enables testing cross-modality generalization.
56
+
57
+ ## Dataset Structure
58
+
59
+ ### Files
60
+
61
+ - **ba_s.csv**: Binding Affinity dataset (single allele)
62
+ - **el_s.csv**: Eluted Ligand dataset (single allele)
63
+
64
+ ### Data Format
65
+
66
+ Both files share the same schema:
67
+
68
+ | Column | Type | Description | Required |
69
+ |--------|------|-------------|----------|
70
+ | peptide | string | Peptide amino acid sequence (8-15aa) | Yes |
71
+ | HLA | string | HLA allele (e.g., HLA-A02:01, HLA-B07:02) | Yes |
72
+ | label | float/int | BA: continuous 0-1, EL: binary 0/1 | Yes |
73
+ | HLA_sequence | string | HLA pseudo-sequence | Yes |
74
+
75
+ ### Dataset Statistics
76
+
77
+ #### BA (Binding Affinity)
78
+
79
+ - **Total Samples**: 170,470
80
+ - **Label Type**: Continuous (0.0 to 1.0)
81
+ - **Mean Affinity**: 0.2547
82
+ - **Median Affinity**: 0.0847
83
+ - **Unique HLA Alleles**: 111
84
+ - **Peptide Lengths**: 8-14 amino acids (74.3% are 9-mers)
85
+ - **File Size**: 10.61 MB
86
+
87
+ #### EL (Eluted Ligand)
88
+
89
+ - **Total Samples**: 3,679,405
90
+ - **Label Type**: Binary classification
91
+ - **Positive Samples**: 197,547 (5.4%)
92
+ - **Negative Samples**: 3,481,858 (94.6%)
93
+ - **Unique HLA Alleles**: 130
94
+ - **Peptide Lengths**: 8-15 amino acids (distributed across all lengths)
95
+ - **File Size**: 213.35 MB
96
+
97
+ ### Combined Statistics
98
+
99
+ - **Total Samples**: 3,849,875
100
+ - **Unique HLA Coverage**: 130+ alleles across HLA-A, B, C
101
+ - **Modalities**: 2 (BA and EL)
102
+ - **Task Type**: Peptide-MHC (PM) binding prediction
103
+
104
+ ## Usage
105
+
106
+ ### Load with Pandas
107
+
108
+ ```python
109
+ from huggingface_hub import hf_hub_download
110
+ import pandas as pd
111
+
112
+ # Download BA dataset
113
+ ba_file = hf_hub_download(
114
+ repo_id="YYJMAY/modality-ood",
115
+ filename="ba_s.csv",
116
+ repo_type="dataset"
117
+ )
118
+ ba_df = pd.read_csv(ba_file)
119
+
120
+ # Download EL dataset
121
+ el_file = hf_hub_download(
122
+ repo_id="YYJMAY/modality-ood",
123
+ filename="el_s.csv",
124
+ repo_type="dataset"
125
+ )
126
+ el_df = pd.read_csv(el_file)
127
+ ```
128
+
129
+ ### Use with SPRINT Framework
130
+
131
+ ```python
132
+ from sprint.core.dataset_manager import DatasetManager
133
+
134
+ manager = DatasetManager()
135
+ config = {
136
+ 'hf_repo': 'YYJMAY/modality-ood',
137
+ 'files': ['ba_s.csv', 'el_s.csv'],
138
+ 'ba': 'ba_s.csv',
139
+ 'el': 'el_s.csv'
140
+ }
141
+
142
+ files = manager.get_dataset('modality_ood', config)
143
+ ba_file = files['ba']
144
+ el_file = files['el']
145
+ ```
146
+
147
+ ### Example: Cross-Modality Evaluation
148
+
149
+ ```python
150
+ import pandas as pd
151
+ from your_model import YourModel
152
+
153
+ # Load data
154
+ ba_df = pd.read_csv(ba_file)
155
+ el_df = pd.read_csv(el_file)
156
+
157
+ # Scenario 1: Train on BA, test on EL
158
+ model = YourModel()
159
+ model.train(ba_df)
160
+ el_predictions = model.predict(el_df)
161
+
162
+ # Scenario 2: Train on EL, test on BA
163
+ model = YourModel()
164
+ model.train(el_df)
165
+ ba_predictions = model.predict(ba_df)
166
+
167
+ # Evaluate cross-modality generalization
168
+ ```
169
+
170
+ ## Experimental Design
171
+
172
+ ### Recommended Evaluation Scenarios
173
+
174
+ 1. **BA → EL Generalization**
175
+ - Train on BA (continuous labels)
176
+ - Test on EL (binary labels)
177
+ - Measures if affinity-based models predict presentation
178
+
179
+ 2. **EL → BA Generalization**
180
+ - Train on EL (binary labels)
181
+ - Test on BA (continuous labels)
182
+ - Measures if presentation-based models predict affinity
183
+
184
+ 3. **Mixed Training**
185
+ - Train on both BA and EL
186
+ - Test separately on each
187
+ - Measures multi-task learning benefits
188
+
189
+ 4. **Modality-Specific Training**
190
+ - Train and test on same modality
191
+ - Baseline for comparison
192
+
193
+ ### Metrics Considerations
194
+
195
+ - **For BA**: Use regression metrics (MSE, MAE, Pearson correlation)
196
+ - **For EL**: Use classification metrics (AUC, F1, precision, recall)
197
+ - **Cross-modal**: May need to binarize BA predictions or convert EL to scores
198
+
199
+ ## Construction Method
200
+
201
+ Both datasets were constructed to ensure:
202
+
203
+ 1. **Single Allele Format**: Each sample has exactly one HLA allele
204
+ 2. **Quality Control**:
205
+ - No missing values in required columns
206
+ - No duplicate peptide-HLA-label combinations
207
+ - Peptide lengths filtered to 8-15 amino acids
208
+ 3. **Standardized HLA Format**: HLA-A02:01 format (with hyphen prefix)
209
+ 4. **Representative Coverage**: 130+ HLA alleles across major supertypes
210
+ 5. **Balanced Lengths**: Both datasets include diverse peptide lengths
211
+
212
+ ## Citation
213
+
214
+ If you use this dataset, please cite:
215
+
216
+ ```bibtex
217
+ @dataset{modality_ood_2024,
218
+ title={Modality OOD Dataset for Peptide-MHC Binding Prediction},
219
+ author={SPRINT Framework Contributors},
220
+ year={2024},
221
+ url={https://huggingface.co/datasets/YYJMAY/modality-ood}
222
+ }
223
+ ```
224
+
225
+ ## Related Datasets
226
+
227
+ - **Allelic OOD**: Tests generalization to rare HLA alleles
228
+ - **Temporal OOD**: Tests generalization to new data over time
229
+
230
+ ## Notes
231
+
232
+ - **No CDR3 sequences**: These datasets are for PM (Peptide-MHC) tasks only, not PMT (Peptide-MHC-TCR)
233
+ - **Label semantics differ**: BA is continuous affinity, EL is binary presentation
234
+ - **Experimental platforms differ**: BA from in vitro assays, EL from mass spectrometry
235
+ - **Biological processes differ**: BA measures binding only, EL captures full pathway
236
+
237
+ ## License
238
+
239
+ MIT License
240
+
241
+ ## Contact
242
+
243
+ For questions or issues, please open an issue on the dataset repository.
244
+
245
+ ---
246
+
247
+ **Keywords**: peptide-MHC binding, immunology, binding affinity, eluted ligand, modality shift, out-of-distribution, generalization, cross-modal learning