Is the chemical composition of a gas determined by its analysis of the spectral lines of the gas?

Yes.