Quasispecies theory for horizontal gene transfer and recombination