Theory of Raman gain spectrum transformations