temporal-ood / README.md
YYJMAY's picture
Upload README.md with huggingface_hub
992621a verified
---
license: mit
task_categories:
- text-classification
tags:
- tcr
- mhc
- peptide
- immunology
- temporal-shift
- covid-19
- out-of-distribution
size_categories:
- 10K<n<100K
---
# Temporal OOD Dataset for TCR-pMHC Binding Prediction
## Dataset Description
The **Temporal OOD (Out-of-Distribution) Dataset** evaluates TCR-pMHC binding prediction models under **temporal shift**. This dataset contains SARS-CoV-2 T cell receptor sequences collected during the COVID-19 pandemic, providing a natural test of model generalization to time-lagged data.
### Key Features
- **Temporal Shift Testing**: Data collected after training set construction
- **COVID-19 Focus**: SARS-CoV-2 T cell repertoire from pandemic
- **Complete PMT Data**: All samples include CDR3, peptide, and HLA
- **Multi-Laboratory**: Compiled from multiple research laboratories
- **Experimentally Validated**: All TCR-pMHC interactions experimentally annotated
## Dataset Details
### Construction Method
This dataset follows the out-of-date testing protocol introduced in FusionPMT, using the external SARS-CoV-2 repertoire from VDJdb's recent update. The sequences were:
1. Collected during COVID-19 pandemic by multiple laboratories
2. Experimentally annotated for peptide and HLA specificities
3. Filtered using standard quality control rules
4. Deduplicated to remove redundant entries
5. Validated for completeness
### Statistics
- **Total Samples**: 13979
- **Positive Samples**: 1272 (9.1%)
- **Negative Samples**: 12707 (90.9%)
- **Unique TCR Sequences**: N/A
- **Unique Peptide Epitopes**: 239
- **Unique HLA Alleles**: 48
### Data Format
CSV file with the following columns:
| Column | Type | Description | Required |
|--------|------|-------------|----------|
| CDR3 | string | TCR CDR3beta amino acid sequence | Yes |
| peptide | string | Peptide amino acid sequence | Yes |
| HLA | string | HLA allele (e.g., A*02:01) | Yes |
| label | int | Binding label (1=binder, 0=non-binder) | Yes |
| HLA_sequence | string | HLA pseudo-sequence | Optional |
### Peptide Length Distribution
- 7aa: 54 samples (0.4%)\n- 8aa: 1016 samples (7.3%)\n- 9aa: 9287 samples (66.4%)\n- 10aa: 2662 samples (19.0%)\n- 11aa: 729 samples (5.2%)\n- 12aa: 137 samples (1.0%)\n- 13aa: 42 samples (0.3%)\n- 20aa: 52 samples (0.4%)
### Label Distribution
- **Binders (label=1)**: 1272 samples
- **Non-binders (label=0)**: 12707 samples
- **Imbalance Ratio**: ~1:10.0 (positive:negative)
## Usage
### Load with Hugging Face Datasets
```python
from datasets import load_dataset
dataset = load_dataset("YYJMAY/temporal-ood")
df = dataset['train'].to_pandas()
```
### Load with Pandas
```python
import pandas as pd
from huggingface_hub import hf_hub_download
file_path = hf_hub_download(
repo_id="YYJMAY/temporal-ood",
filename="temporal_ood.csv",
repo_type="dataset"
)
df = pd.read_csv(file_path)
```
### Use with SPRINT Framework
```python
from sprint.core.dataset_manager import DatasetManager
manager = DatasetManager()
dataset_config = {
'hf_repo': 'YYJMAY/temporal-ood',
'files': ['temporal_ood.csv'],
'test': 'temporal_ood.csv'
}
files = manager.get_dataset('temporal_ood', dataset_config)
test_file = files['test']
```
## Scientific Context
### Temporal Shift Challenge
This dataset addresses a critical challenge in machine learning for immunology: **temporal generalization**. Models trained on historical data must generalize to new sequences collected at later time points. The COVID-19 pandemic provides a unique natural experiment for this evaluation.
### Why Temporal OOD Matters
1. **Real-world Deployment**: Clinical applications require models that work on future data
2. **Emerging Pathogens**: New disease outbreaks generate novel epitopes
3. **Distribution Drift**: Immune repertoires evolve over time
4. **Model Robustness**: Tests whether models learn fundamental biology vs. dataset artifacts
### Biological Significance
- **SARS-CoV-2 Epitopes**: Includes key viral peptides recognized by T cells
- **Pandemic Diversity**: Represents diverse patient populations and disease stages
- **Laboratory Consensus**: Multi-laboratory validation increases reliability
- **Clinical Relevance**: Direct connection to COVID-19 immune response research
## Task Compatibility
- **PMT Task**: Yes (all samples have CDR3)
- **PM Task**: Yes (peptide-HLA pairs available)
All 13979 entries are suitable for TCR-peptide-MHC (PMT) binding prediction.
## Quality Control
### Filtering Rules Applied
1. Removed entries with missing CDR3, peptide, or HLA
2. Removed duplicate (CDR3, peptide, HLA, label) combinations
3. Validated label values (0 or 1 only)
4. Checked for empty strings in critical columns
5. Verified HLA sequence availability
### Data Integrity
- **No Missing Values**: All required columns complete
- **No Duplicates**: 659 duplicates removed during preprocessing
- **Valid Labels**: All labels are binary (0 or 1)
- **Standardized Format**: Consistent with other SPRINT datasets
## Comparison with Training Data
This dataset intentionally differs from training data in temporal dimension:
| Aspect | Training Data | Temporal OOD |
|--------|---------------|--------------|
| Collection Period | Pre-pandemic | During COVID-19 pandemic |
| Epitope Source | Various pathogens | SARS-CoV-2 dominant |
| Data Vintage | Historical | Recent/contemporary |
| Distribution | Established | Time-shifted |
## Benchmark Results
This dataset is used to evaluate multiple TCR-pMHC binding prediction methods in the SPRINT benchmark suite. Expected performance characteristics:
- **Difficulty**: Moderate to challenging due to temporal shift
- **Baseline**: Random classifier ~9.1% (positive class frequency)
- **Evaluation Metrics**: AUC, AUPR, F1, Precision, Recall
## Citation
If you use this dataset, please cite:
```bibtex
@dataset{temporal_ood_2024,
title={Temporal OOD Dataset for TCR-pMHC Binding Prediction},
author={SPRINT Framework Contributors},
year={2024},
note={SARS-CoV-2 T cell repertoire data from VDJdb},
url={https://huggingface.co/datasets/YYJMAY/temporal-ood}
}
```
And the original VDJdb paper:
```bibtex
@article{goncharov2022vdjdb,
title={VDJdb in 2019: database extension, new analysis infrastructure and a T-cell receptor motif compendium},
author={Goncharov, Mikhail and others},
journal={Nucleic Acids Research},
year={2022}
}
```
## Related Datasets
- **Allelic OOD**: Tests generalization to rare HLA alleles
- **Modality OOD**: Tests cross-modality generalization (BA ↔ EL)
- **FusionPMT Training**: Original training data
## Limitations
1. **COVID-19 Bias**: Heavy emphasis on SARS-CoV-2 epitopes
2. **Temporal Specificity**: Limited to pandemic time period
3. **Imbalanced Labels**: Negative samples dominate (~87%)
4. **HLA Coverage**: 48 alleles, may not cover all population diversity
## License
MIT License - Free for academic and commercial use
## Contact
For questions, issues, or contributions:
- Dataset repository: YYJMAY/temporal-ood
- SPRINT framework: https://github.com/Computational-Machine-Intelligence/SPRINT
## Acknowledgments
- VDJdb team for SARS-CoV-2 repertoire data
- Multiple laboratories contributing T cell sequences during COVID-19 pandemic
- FusionPMT authors for temporal OOD protocol design