Modelling the origin of complex diseases and phenotypes