Scientists in Dublin discovered a genetic "switch" that controls whether cannabis plants become male or female. The same system likely works in hop plants, which are used to make beer.