Molecular lines hold valuable information on the physical and chemical composition of disks around young stars, the likely progenitors of planetary systems. This invited contribution discusses techniques to calculate the molecular emission (and absorption) line spectrum based on models for the physical and chemical structure of protoplanetary disks. Four examples of recent research illutrate these techniques in practice: matching resolved molecular-line emission from the disk around LkCa15 with theoertical models for the chemistry; evaluating the two-dimensional transfer of ultraviolet radiation into the disk, and the effect on the HCN/CN ratio; far-infrared CO line emission from a superheated disk surface layer; and inward motions in the disk around L1489 IRS.