Thousands of years ago, a wildcat first started lingering on the outskirts of a human camp, perhaps to eat the mice living in people's granaries. Now, billions of house pets and countless cat videos later, researchers have revealed the genetic roots of the special relationship between humans and cats.

A new study has revealed the genetic changes that make kitties snuggle up with humans and purr for treats. Many of the changes have altered the cat's motivation to seek rewards and have changed their fear of new situations, said study co-author Wesley Warren, a geneticist at the Genome Institute at the Washington University School of Medicine in St. Louis.

The team also discovered the genetic changes that make cats keen nighttime hunters and why their noses aren't as sensitive as their canine cousins'. [Here, Kitty, Kitty: 10 Facts for Cat-Lovers]

Domestic mystery

Cats and humans go way back: Some studies suggest cats were first domesticated about 9,000 years ago in the Near East, while others trace cat domestication back to China around 5,000 years ago.

But though the relationship between you and Gingersnap may seem completely natural, domestication is an extreme rarity in the animal world. Humans have only domesticated a handful of animals — such as the dog, cow, chicken, sheep and goat — and scientists did not know which genes were involved in the domestication process.

Then, in the 1950s, scientists at a fur farm in Novosibirsk, Russia, began breeding foxes for their friendliness to humans. Within a few generations, foxes wagged their tails and licked the faces of humans affectionately. Along the way, the foxes developed floppy ears; lighter, patchy coats; and curly tails — traits found in other domesticated animals, such as dogs, pigs and sheep.

The fox study, which is still going on today, hinted that some of the behavioral domestication genes were tied to those curly-tail, floppy-ear genes. And a study published earlier this year in the journal Genetics found that domesticated animals have changes in their neural crest, a group of embryonic cells that guide the development of various organ systems.

But without advanced genetic analysis, it was difficult to tease apart exactly which genes were responsible for domestication.

Big cat, little cat

In 2007, scientists sequenced the genome of an Abyssinian cat named Cinnamon (who has since died). But that analysis wasn't complete, so scientists couldn't say much about the genes underpinning domestication.

Warren and his colleagues did a second sequence of Cinnamon's genome, along with the genomes of several other domestic cats and two species of wildcat, and compared them to the genomes for the tiger, the dog and many other animals. [Animal Code: Our Favorite Genomes]

In domestic cats, genes linked to motivation and fear had faced strong evolutionary pressure over history, leading the cats to be less shy and more driven by rewards, Warren said.

Compared to dogs, domestic cats and their wild cousins, such as tigers, had several more copies of genes for receptors to detect pheromones, or sex hormones. This could help the solitary creatures find mates, Warren said.

Dogs, in contrast, have many more copies of genes for smell receptors, which may account for their amazing sense of smell. The genes for feline night vision and keen hearing were also under strong selection in both big cats and house kitties. Those areas of the genome may explain why felines are such expert hunters, Warren said.

Cat origins

The findings help underpin some of the biological changes associated with domestication in cats.

"The study is great, especially in defining changes in the genome that have led to domestication or, more correctly, to the adaptation of the ancestors of domestic cats that allowed them to associate with humans and thus gain both protection from their predators and an ample food supply (rodents)," Niels Pedersen, a veterinary researcher at the University of California, Davis who was not involved in the study, said in an email.

The paper provides a springboard to analyze cats in greater detail, added Dominic Wright, a geneticist at Linkoping University in Sweden, who was also not involved in the study.

"It will be great to take some of these regions which they identify and go further with them," Wright told Live Science.

But the study only identified relatively large gene regions that changed in the domestic cat, and it's still not clear exactly what those genes do or how they are regulated, he added.

To really understand that, scientists now need to focus on these specific gene regions, studying animals with different versions of the genes and then analyzing the effects on their behavior, Wright told Live Science.

The findings were published today (Nov. 10) in the journal Proceedings of the National Academy of Sciences.

Follow Tia Ghose on Twitter and Google+. Follow LiveScience @livescience, Facebook & Google+. Originally published on Live Science.