The tomato, whose genome has just now been decoded, turns out to be one well-endowed vegetable, possessing 31,760 genes. This rich legacy, possibly a reflection of the disaster that killed off the dinosaurs, is some 7,000 more than that of a person, and presents a complex puzzle to scientists who hope to understand its secrets.

A consortium of plant geneticists from 14 countries has spent nine years decoding the tomato genome in the hope of breeding better ones. The scientists sequenced the genomes of both Heinz 1706, a variety used to make ketchup, and the tomato’s closest wild relative, Solanum pimpinellifolium, which lives in the highlands of Peru, where the tomato’s ancestors originated. Their results were published online Wednesday in the journal Nature.

The tomato, though a fruit to botanists, has been decreed a vegetable by the United States Supreme Court. The verdict is not so unreasonable given that the tomato has a close cousin that is a vegetable, namely the potato. The genomes of the two plants have 92 percent of their DNA in common, the tomato researchers report. The main difference is that the potato is thought to have a handful of genes that direct the plant’s energy away from producing fruit and into the generation of tubers. But even with the genomes of the two plants deciphered, those genes have not yet been identified, said Daniel Zamir, a plant geneticist at Hebrew University in Jerusalem and one of the report’s two principal authors.