A likelihood framework for the phylogenetic analysis of adaptation