Analysis of the loss of coherence in interferometry with macromolecules