Functions predict horizontal gene transfer and the emergence of antibiotic resistance