For pot to gain the vast popularity it's achieved, it had to go viral.

Now teams of Canadian and U.S. scientists have located the genes responsible for the sought-after kick of cannabis - genes that had been hidden to researchers amid vast stretches of the "junk" DNA deposited in the plant's genome by viruses during its evolution.

The discovery will make it much easier to manipulate the levels of intoxicating THC and medicinal CBD contained in the plant to suit varied customer preferences in the newly legalized Canadian market, the researchers say.

"You can only manipulate a gene when you know where it is located," says Harm van Bakel, one of the key research contributors. "And you also need to know something about the rest of the sequencing in the genome so that you can uniquely target the gene of interest and not be sidetracked by . other things that look similar," says van Bakel, a genomic expert at the Icahn School of Medicine at Mount Sinai in New York City.

The chemical makeup of the genes that produce THC and CBD - the plant's two main cannabinoids - had been known to scientists for decades. Researchers had previously isolated the RNA those genes created - the molecules that actually manufacture the active cannabinoid components.

Yet even though the plant's 10-chromosome genome had been sequenced in 2011, the location of these key genes remained hidden in a sea of viral DNA.

It's not unusual for the genome of any species - humans included - to be peppered with DNA from viruses. Indeed, 70 to 75 per cent of the DNA of marijuana and hemp plants - which share a common ancestor - is derived from retrovirus sources, says Tim Hughes, a molecular geneticist at the University of Toronto's Donnelly Centre for Cellular and Biomolecular Research.

Retroviruses - such as HIV - are able to insert their DNA into the genomes of other species, says Hughes, who was another key member of the study team.

"Humans, plants, virtually all organisms have something like this," says Hughes, adding about half the human genome traces back to viral sources.

But the viral DNA in cannabis did much more than hide the genes from prying scientists. It likely helped create them, Hughes says. He says the random genetic rearrangements that produced the active forms of THC and CBD in the formerly inert plant would likely not have occurred had the genes not been surrounded by the viral DNA.

Hughes says cellular mechanisms that would normally keep genetic order can be foiled by the lengthy and repeated sequences of the surrounding viral DNA. And instead of maintaining the genes in their original form, the faulty mechanisms would have rearranged their sequencing to produce the current genetic configurations.

The machinery "that's normally responsible for keeping things tidy and organized gets confused when it sees multiple copies of the same thing, and it makes mistakes," Hughes says. "That is almost certainly what has happened" with the THC and CBD genes, he says.

The study, an early version of which which was released online this month by the journal Genome Research, also showed:

•Definitively that THC and CBD are produced by separate genes.

•The existence of another active gene that produces a product known as cannabichromone, or CBC, which can have both medicinal and slightly intoxicating effects in humans.

•The location of a gene that helps determine the potency of different cannabis strains.

Hughes says another one reason the genes had eluded scientists was the plant's illegal status.

"Until the last couple of years it's been extremely difficult to work with it legally," he says. "The repercussions of being caught with a huge number of marijuana strains in order to do genetic experiments . nobody would risk that."

Van Bakel says Canada's Oct. 17 legalization will make the country a hotbed for research on the plant and its effects. But he says locating the THC and CBD genes - on the plant's sixth chromosome - was facilitated by improved genetic scanning technology.

Loading... Loading... Loading... Loading... Loading... Loading...

He says the latest scanners can capture tens of thousands of the base pairs that make up the twisting DNA molecule; older technology could sequence only a few hundred at a time.

Ironically, while it is fairly well understood how THC and CBD affect humans, it's not known what the genes that produce them do for the plant itself, Hughes says.

He says research will likely now focus on locating the genes that create the components that give different strains of cannabis their distinctive tastes and smells.