bioRxiv · 10.64898/2026.03.06.710163
Popformer: Learning general signatures of positive selection with a self-supervised transformer
Abstract
Understanding natural selection can help shed light on the genetics underpinning adaptive evolution. The widespread availability of large-scale human genetic variation data has led to the development of data-driven methods for detecting signatures of selection, many of which are based on deep learning. However, these methods often fail to generalize well to the diversity of selection signatures across a broad range of evolutionary scenarios. We propose a novel transformer-based model, Popformer, for learning encodings of general patterns of genetic variation. Popformer includes site-wise and haplotype-wise attention, allowing us to capture variation among both genetic positions and individuals. It additionally learns relative positional embeddings for inter-SNP distances. The model is pre-trained with an analog of the masked language modeling objective across a range of real human genomic data, similar to the task of genetic imputation. Using dimensionality reduction, we show that the pre-trained model learns meaningful embeddings of genomic windows that correspond with population structure. We also show that the model can accurately perform genotype imputation. We further fine-tune the model on selection classification and demonstrate that our model is more accurate than other selection classification methods, on selection simulations of both well-specified and mis-specified demographic models. Using a novel real data validation approach, we apply Popformer to human data from the 1000 Genomes Project and reveal its ability to generalize from simulated data to the diversity of real data. Overall, our method provides a new direction for population genetic inference methods, with future fine-tuning applications including the inference of recombination rates, introgression, and local ancestry. Author summaryNatural selection lies at the heart of adaptation and evolution. Identifying genomic signals of natural selection can lead to insights about evolutionary pressures acting on populations, and provide an understanding of how populations differentiate. Detecting these signals using only present-day genomic data is difficult, and methods developed for this task often use specialized simulations, trading generalization for power. We show here that adapting deep learning techniques from modern language and image processing can be used to identify signals of selection with both high power and robustness to misspecification. By pre-training our transformer model, Popformer, on real data, we induce learned model representations that are representative of the variation in real data. We fine-tune our model on simulations inferred from European populations, and compare with other machine learning methods and summary statistics. Our results suggest that both our model architecture and our training regime are useful for strong performance in diverse simulation tests and in recovering known selection signatures in real data.
Source connections
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Zong, L., Friedler, S. A., Mathieson, S.. 2026-03-06. Popformer: Learning general signatures of positive selection with a self-supervised transformer. https://doi.org/10.64898/2026.03.06.710163
Cite the original work for its findings. Save a collection to share your selection of sources.