Rare and common variants in ERAP1 and ERAP2 selected for in response to Yersinia pestis infection contribute to autoimmune disease including inflammatory bowel disease. Here, ERAP2 is linked to inflammatory bowel disease.