I'm going to puke science and biology onto you on what my research has shown thus far. I hope you don't mind.
There appears to be a genetic element to it. however this element merely increases your likleyhood.
there was a study done into a condition known as CAH (Congenital Adrenial Hyperplasia) This is an intersex disorder, What happens is that the adrenal glands are unable to synthisise the female hormone progesterone correctly... Testosersone and Progestersone have a conjoined biosynthsis pathway, Thus if the body is unable to produce adrenial progestersones it will produce a whole load of testosersone instead this also has the effect of producing elevated levels of T during the early neurological development of the fetus whitch appears to decide gender based behaviour.
A symptom accociated with this conditions can be intersex genitalia, low cortisol levels, premature puberties, Infertility, masculinizing puberty (Low voice, development of facial hair)
And a much elevated instance of homosexual and transgender type behaviour. upto 5% of children with this condition express a desire to become male, And an even greater number than that 20% or so turn out to be homosexual (Lesbiens)
The most intreiguing thing about this condition is that the severity of the indivduals condition dose not corrilate with the severity of there condition.
There is a degree of controvery regarding certain treatments for this condition.
http://en.wikipedia.org/wiki/Dexamethasone#Congenital_adrenal_hyperplasiaDexmethasone is used while the mother is pregnant to reduce some of the ambiguities accociated with the child however it's also been observed to "correct" the instance of transgender/homosexual behaviour in those children... I get the feeling that when christians learn of this effect they will drop this "homosexuallity is a choice" and would rather mandate these drugs :/
http://www.ncbi.nlm.nih.gov/pubmed/16010462Study.
It should not be suprising that alot of FTM transmen have also been identified with elevated levels of this testosersone prior to starting T... Indicating an undetected low level CAH in numerous cases of FTM transsexuality, implying a genetic factor.
============
As for the MTF's a similar abbrent polymorphism has been detected in those indivduals androgen receptors.
And increase of tandem repeats within the Androgen receptor gene leads to a poor signal of testosersone whitch could lead to a partial or immunity from the same neurological changes that go on when gender is begin specified in the brain.
http://www.ncbi.nlm.nih.gov/pubmed/18962445It should be noted that just because the signal is poor it may well get through and cause the morphology changes thus not all males with this condition will become transsexual but perhaps in reaction with bad luck or a weak Testosersone surge reaction it is sufficent.
===========
The likleyhood of you begin homossexual/transsexual from these conditions are not 100% and are not linked to the indivduals severity of the condition.
in CAH highly masculinized individuals may well identify as female. whereas nearly unmasculinized indivduals identify as male.
The reasons for this were explored in an animal model
http://joe.endocrinology-journals.org/cgi/reprint/156/3/493.pdfRhesus monkeys express gender dysmorphic behaviour male and female child monkeys express favor for different toys, Male monkeys prefering wheeled toys, while females exhibiting no preference between wheeled toys and plush toys.
Pregnant Females carrying female embryos were exposed to high levels of testosersone at different stages of there pregnancy.
Some were exposed early on for a short period. (6weeks post conception)
Some were exposed later on for a short period. (18weeks post conception)
Some were exposed throughout.
Some were never exposed.
Those monkeys that were exposed early on did not develop genital abnormalities however they did tend to exhibit cross gender behaviour for toys, exhibiting masculine characteristics.
Those who were exposed later on developed androgynous or male physical charactaristics and ambigious genitalia, however there behaviour remained largely feminine.
Those who were exposed throughout were masculine and androgynous
Those who wern't exposed turned into normal females.
Although this experment cannot be duplicated in humans for obvious ethical reasons this provides great insight into the mechanisms of neurological gender differentiation.