Social insects such as ants, bees and wasps appear to be blessed with a genetic 'super switch' that designates both gender and their status as either a queen or worker, scientists have discovered.

They say it is a surprising find in a world where dual-function genes are usually limited to smaller genetic traits - not ones as significant as gender and caste.

The so-called "doublesex transcription factor" gene is found in many animals, and responsible for say, why male flies have one less body segment than females.

Looking at ants in particular, researchers from the University of Melbourne and Universität Regensburg in Germany suspected that the doublesex gene might be responsible for more than just gender.

After some genetic sleuthing, they determined it was also the gene responsible for the differences between queen and worker ants.

"It looks like the gene has been co-opted to control whether an ant becomes either a queen or a worker, in addition to its normal function making boys or girls," said Dr Luke Holman from the University of Melbourne's School of BioSciences.

"Social insects needed to evolve a genetic switch that allowed juveniles to grow into a queen or a worker, so we think they repurposed one they already had."

Dr Holman co-wrote the paper while at ANU before joining Melbourne University earlier this year.

It's well known that environmental factors play a key role in determining what a larva will become; for example, queen bees develop from larvae that are fed royal jelly.

What was unknown was which genes were regulated by the environment, causing the developmental change.

Co-author Jan Oettler, from Universität Regensburg, said while dual-function genes were common, the paper's principal finding was unexpected.

"This really blew our minds and we think it will represent a significant step in deciphering how one genome can give rise to such fundamentally different queen and worker body types."

The scientists believe the case can be applied to ants, bees and wasps - and possibly termites (which have the doublesex gene, but a drastically different developmental process).

The paper "Evolution of Social Insect Polyphenism Facilitated by the Sex Differentiation Cascade" has been published in the journal PLoS Genetics.