doi: bioRxiv preprintThe heart evolved hundreds of millions of years ago. During mammalian evolution, the cardiovascular system developed with complete separation between pulmonary and systemic circulations incorporated into a single pump with chambers dedicated to each circulation. A lower pressure right heart chamber supplies deoxygenated blood to the lungs, while a high pressure left heart chamber supplies oxygenated blood to the rest of the body. Due to the complexity of morphogenic cardiac looping and septation required to form these two chambers, congenital heart diseases often involve maldevelopment of the evolutionarily recent right heart chamber. Additionally, some diseases predominantly affect structures of the right heart, including arrhythmogenic right ventricular cardiomyopathy (ARVC) and pulmonary hypertension. To gain insight into right heart structure and function, we fine-tuned deep learning models to recognize the right atrium, the right ventricle, and the pulmonary artery, and then used those models to measure right heart structures in over 40,000 individuals from the UK Biobank with magnetic resonance imaging. We found associations between these measurements and clinical disease including pulmonary hypertension and dilated cardiomyopathy. We then conducted genome-wide association studies, identifying 104 distinct loci associated with at least one right heart measurement. Several of these loci were found near genes previously linked with congenital heart disease, such as NKX2-5, TBX3, WNT9B, and GATA4. We also observed interesting commonalities and differences in association patterns at genetic loci linked with both right and left ventricular measurements. Finally, we found that a polygenic predictor of right ventricular end systolic volume was associated with incident dilated cardiomyopathy (HR 1.28 per standard deviation; P = 2.4E-10), and remained a significant predictor of disease even after accounting for a left ventricular polygenic score. Harnessing deep learning to perform large-scale cardiac phenotyping, our results yield insights into the genetic and clinical determinants of right heart structure and function.