Nucleic acid molecules encoding polypeptides having polyketide synthase activity have been identified and characterized. Expression or over-expression of the nucleic acids alters levels of cannabinoid compounds in organisms. The polypeptides may be used in vivo or in vitro to produce cannabinoid compounds.