It has been known that if the gene W in drosophila plays a role, male drosophila will not courtship female drosophila and instead pursue homosexuality. 
If this male drosophila becomes an adult, as long as it is raised collectively for more than one day, the male drosophila begins to chase other male drosophila, showing homosexual courtship behavior. However, if the drosophila is raised in isolation after emergence, this behavior will not occur.
 the homosexuality of drosophila is considered to be determined by genetic factors. Recently, researchers cultured male drosophila with the gene W, and then conducted experiments with this kind of drosophila. They found that the homosexual behavior of drosophila is not only affected by genetic factors, but also promoted by social factors.