For the first time, researchers have analysed ancient DNA taken from humans who lived before, during, and after the agricultural revolution, allowing them to map how our ancestors' genomes changed in response to societal shifts.

It's long been known that farming changed humans forever, right down to our DNA, but until now those changes have been pieced together by looking at genetic variations in today's populations, which are simply echoes of what happened back then. The new research, however, allows scientists to see those changes almost in real time.

"It allows us to put a time and date on [natural] selection and to directly associate selection with specific environmental changes," said lead researcher Iain Mathieson from Harvard Medical School. "In this case the development of agriculture and the expansion of the first farmers into Europe."

Using new extraction techniques, Mathieson and his team were able to take DNA from ancient human remains and create a genetic database of 230 ancient humans who lived across Europe between 2,300 and 8,500 years ago.

By analysing these genomes, they were able to identify 12 specific genome regions that changed during, and also after, the transition from hunter-gatherer communities to farming.

Unsurprisingly, many of those variations were located on or near genes that are associated with height, the ability to digest lactose, fatty acid metabolism, light skin pigmentation, and blue eye colour – all traits that have previously been linked to our transition to agriculture-based societies.

But the new research, which has been published in Natureprovides more insight than we've ever had into how and when ancient humans adapted to agriculture. One big find is that the gene that allows adults to digest milk didn't become common until about 4,000 years ago – thousands of years later than previously thought.

The study also showed that early farmers were dark-skinned, but that the gene for light skin became more commonly passed on over the millennia. Lead researcher David Reich told Carl Zimmer from The New York Times that this could have been because farmers ate less meat than hunter-gatherers, so their vitamin D intake was reduced. People with dark skin would have been able to get less vitamin D from sun exposure, which could have left them deficient.

Another big change was that our immune system ramped up, which makes a lot of sense, because disease would have become a whole lot more common with the onset of agriculture.

"The Neolithic period involved an increase in population density, with people living close to one another and to domesticated animals," said one of the researchers, Wolfgang Haak from the University of Adelaide in Australia. "Although that finding did not come fully as a surprise, it was great to see the selection happening in 'real time'." 

The research also supports the hypothesis that farmers from Anatolia – modern-day Turkey – first brought agriculture to Europe, and with them, short genes to southern Europe. People in northern Europe are so tall, however, because they have more ancestry from the Eurasian steppe populations.

But even though 230 is an impressive sample size when we're talking about long-dead individuals, it's not incredibly large by scientific standards, and the researchers couldn't find out as much as they wanted to. For example, they didn't have enough evidence to make a conclusion as to whether the genes that contribute to type 2 diabetes or high body mass index were selected for during the shift to farming.

The team now wants to study even more ancient DNA to try to get a better idea of exactly how we ended up like we are now, and how our ancestors migrated and interbred across the planet.

"It's a great mystery how present-day populations got to be the way we are today, both in terms of how our ancestors moved around and intermingled and how populations developed the adaptations that help us survive a bit better in the different environments in which we live," said Reich. "Now that ancient DNA is available at the genome-wide scale and in large sample sizes, we have an extraordinary new instrument for studying these questions."