Studies as far back as the nineties have shown that men probably carry their sexual preference in their genes. Back then, regions of the genome were correlated with male homosexuality, but that link was not shown to be causal.
Now new evidence has emerged. Specific genes, not just an area of the genome, has been connected to sexual preferences in men. They have also shown how this mechanism may be working.
One gene researchers identified can impact an area of the brain called the diencephalon, and within that area lies the hypothalamus. It has been thought that this part of the brain plays an important role in sexual development. The other gene impacts the thyroid, a gland that affects metabolism. Notably, a disease that is more common in gay men is associated with an overactive thyroid.
There is still much more work to be done, especially in the area of female sexuality, which lags far behind.