A statistical approach to the prediction of pKa values in proteins