Most of us remember losing our virginity during our teen years, when our friends, TV and film characters, and everyone going to senior prom were “doing it.” Inevitably, these sociocultural and environmental factors influence our “first time,” but our DNA may play a bigger role in our sexual behavior than we think. A recent study published in the journal Nature Genetics found our genes may predict the age we first have sex.

“We were able to calculate for the first time that there is a heritable component to age at first sex, and the heritability is about 25%, so one quarter nature, three quarters nurture,” said John Perry, senior investigator at Britain’s Medical Research Council, who was also involved in the study, NBC News reported.

Perry and his colleagues from the Medical Research Council and Cambridge University looked at the genetic role on sexual behavior, including other factors such as economic disadvantage, family instability, and low levels of parental monitoring and religion. The research team identified “virginity genes” from the DNA of more than 125,000 people aged 40 to 69 on the UK BioBank project. A total of 38 genes were found to affect the age at which people first had sex. These genes are those affiliated with reproductive biology, like the release of sex hormones and age of puberty. They later went on to observe the genes’ effects in 250,000 other men and women from Iceland and the United States.

A gene variant, CADM2, which controls brain cell connections and brain activity, was linked to an early start to sex life with risk-taking behavior, and to having many children. The researchers believe this gene changes our perception of risk, so we exercise less care with regard to the number of sexual partners we have. However, this effect is likely to be small — one-tenth.

Meanwhile, a version of a different gene, MSRA, was found in people who lost their virginity later than average (age 18), which has been linked to irritability. The researchers do suggest there may be a surprise benefit to being irritable. In fruit flies this gene has led to a delay in reproduction, but it has had the benefit of extending their longevity.

Interestingly, the researchers were able to identify another genetic variant, MC1R, which affects hair color and freckles, with “later” sexual encounters.

“Genetically predicted skin freckling seemed to promote later AFS [adult first sexual experience] in women but not in men and genetically predicted red hair seemed to promote later AFS in both men and women,” wrote the study authors in the report.

These findings, especially the link between the “risk-taking” gene and early sex, has implications on the role of puberty in teens. Early puberty has often been brought on by poor nutrition, and led to childhood obesity. Now, this study suggests it has a small but direct effect on the age people lose their virginity, and the age they have their first child linked to limited chances of doing well academically.

For example, those with these genes are more susceptible to early sex, which may lead to earlier first birth, having more children, being less likely to remain childless, and to poorer educational outcomes.

“This helps to inform us about future preventative efforts to delay puberty in young children,” said Perry.

Genetics only contributes to a small portion of our first sexual experience. Each of our genomes can be traced to see the influence our DNA has had on our sexual nature.

Although our genetics influence our sexual behavior, unsurprisingly so does our first time. In a 2013 study, researchers found the way we lose our virginity can color all of our future sexual experiences. The first sexual encounter was predictive of the physical and emotional satisfaction the participants felt in their current sexual interactions, two years after losing their virginity.

So although 25 percent of our genes influence the age we choose to have sex, most of it has to do with non-genetic factors, including whether or not we’re physically attracted to our partner.

Source: Day FR, Helgason H, Chasman DI et al. Physical and neurobehavioral determinants of reproductive onset and success. Nature Genetics. 2016.