Scientists have sequenced the genetic code of the cocoa tree, which they say could triple the yield of the disease-prone crop and transform the lives of millions of poor farmers in Africa and around the developing world who rely on it for their livelihood.

The US chocolate firm Mars, working with the computer firm IBM and the US Department of Agriculture, took two years and two months to unlock the genetic code of the tree, Theobroma cacao ("food of the gods").

Instead of patenting the genome, they have placed it online for anyone to use for free. They say that its discovery will allow breeders who use traditional methods to grow hardier, more productive and disease-resistant trees.

In West Africa, the centre of global cocoa production, yields are low, at about 400kg a hectare. The crop is highly susceptible to pests and disease, losing about $700m (£450m) to $800m of its global value annually.

In an outbreak in 1989, a fungal disease called witches' broom wiped out the cocoa crop in Brazil, which was then the world's second biggest producer. Since then Brazil has produced only a fraction of its former levels. Chocolate companies worry about the disease striking the Ivory Coast and Ghana, which grow about 70 per cent of the world's cocoa beans.

About 6.5 million mostly subsistence-farmers grow cocoa, which is then processed into a luxury food for Western markets in a business predicted to be worth $13bn next year. Although the price has rocketed in recent years, low prices have historically led to trees becoming neglected by farmers, meaning that cocoa production has struggled to keep pace with demand, which is rising by 3 per cent a year.

Professor Howard-Yana Shapiro of the University of California Davis, who led the research team, said he sequenced the genome because cocoa was little researched – an "orphan crop" left in the cold by agronomists and bioscientists. Scientists elsewhere have sequenced the code of life of wheat, corn and rice. "This was a Third World neo-tropical tree nobody was interested in," said Professor Shapiro, who is also Global Head of Plant Science at Mars. "This was not a formal farmed crop."

Mars, a $30bn-a-year worldwide manufacturer of chocolate, pet food and other products, gave $10m to the project, while IBM and the US Department of Agriculture's Agricultural Research Service contributed their expertise for free.

While the Mars team sought to unravel the genome, a consortium of French government laboratories and the Pennsylvania State University was doing likewise with backing from Mars' rival Hershey, the US chocolate-maker. That group says it, too, has cracked the code but cannot comment until it is published in a scientific journal.

Mars, which denied rushing an announcement yesterday to trump the other team, worked with 10 partners, including the Subtropical Horticulture Research Station in Miami, Mississippi's Jamie Whitten Research Center and the National Center for Genome Resources. The team decoded the genes of a strain of Theobroma cacao, which had 420 million DNA units, relatively small for a plant. The human genome has three billion units.

They put the completed work online, allowing multinational chocolate companies, research scientists and plant breeders to view the "golden traits" – the genes vital for disease resistance, drought resistance and flavour.

Teams at research laboratories in producer countries, initially the Ivory Coast and Ghana, will use the information from the Cacao Genome Database – online at www.cacaogenomedb.org – to breed hardier plants within 12 to 14 months.

Professor Shapiro, a molecular biologist, said: "We thought: 'Let's put this in the public domain so everyone has free access to it for eternity'. It could be patented and it can't be now. We have full open access.

"In West Africa where the average yield is 400 kilos a hectare my goal is that over 10 years we will be able to triple that. The best farmers will probably be able to quadruple that and the worst farmers will probably only double that."

A higher yield would allow farmers to remove unproductive trees (at present 30 per cent of trees produce 70 per cent of the beans) and diversify, planting fruit trees or other edible or saleable plants.

Mars, a family-owned firm which makes Milky Way and Snickers, denied the increase in production would reduce global prices. Mars said that because of the growing annual demand, prices would probably remain "stable".

Although farmers in West Africa remain poor with only basic access to healthcare and education, cocoa prices have soared due to the volatile and relatively low supply. Speculators are partly blamed for the rise, which has increased the price of a chocolate bar in Britain to about 60p. According to the International Cocoa Organisation, the cocoa price has doubled in five years, from $1,504 a ton in 2005 to $3,071 a ton last month.