A single gene that controls male and female sexes in one organism evolved from a simpler precursor gene in a unicellular algae, new research suggests.