Application of Bayes Theorem on fly mutation problem We've recently come across Bayes Theorem in a lecture. The notes we received are not helpful to me. I have watched a few video tutorials, and I feel like I have an understanding in broad sense and can understand questions attached to said video tutorials, but when it comes to applying the theorem to specific exam questions I'm having difficulty.
The following for example is a question found a past exam paper. I will be sitting a similar exam in a few months time so will recieve a similar questions. However I'm not too sure how to start.

In a fly breeding experiment, it is thought that one in ten thousand
  flies will exhibit a desired behavioral mutation, within a population
  of a million.  Flies are raised and tested automatically using a
  robotic flywrangling system.  The test for the desired behavioral
  mutation is very good, with an error rate (in either direction) of
  only 0.1%.  What is the probability that a fly identified by the robot
  as possessing the desired mutation is actually a target mutant?

Would anyone be able to help me with this problem, please? I am sure if I can work through a worked solution, I won't have difficulty with further questions of this type - they all extremely similar to the above. 
Thanks
John
 A: I'll give you a more intuitive explanation where you can formulate the Bayes equation yourself.  I'll also use more intuitive numbers where you can substitute with the give numbers.
Assume the Mutants are 10% of the population. Of 100, there will be 10.  Assume also the test can identify 10% wrongly in either side.  That is for the real 10 Mutants, test will identify 9 correctly and 1 non-Mutant. Also from the other 90 non-mutants, test will incorrectly claim 9 mutants and 81 non-mutants.  Perhaps draw a Venn-diagram to comprehend this. So, based on the test results you have 18 claimed to be mutants but only 9 is correct.
Doing this formally, define labels as
$M$: mutant, $\tilde{M}:$ non mutant, $T$ test positive, $F$ test negative
and assign given probabilities
$P(M)=p = 1 - P(\tilde{M}) \\P(T|\tilde{M}) = P(F|M) = \epsilon$
$$
P(M|T) = \frac{P(T|M) P(M)}{P(T)} = \frac{P(T|M) P(M)}{P(T|M)P(M)+P(T|\tilde{M})P(\tilde{M})} \\
= \frac{(1-\epsilon) p}{(1-\epsilon) p + \epsilon(1-p)}
$$
A: First let us define the probabilities of the given problem
$$P(Mutation)= {1\over{10,000}} = 0.0001$$
$$P(\overline{Mutatuon})=1-P(Mutation)=1-0.0001=0.9999$$
$$P(Error)=0.1$$
$$P(\overline{Error})=1-P(Error)=1-0.1=0.9$$
The easiest way to view this problem is by drawing a tree diagram:

Now all you need to simply do to find the probabily that the fly identified by the robot possessed the desired mutations is actually a target mutant (i.e $P(Mutation|\overline{Error}))$, all you need to do is follow the path on the tree diagram and multiply the values along the way.
Therefore: $P(Mutation|\overline{Error})=0.0001\times0.9=0.00009$
Hope this is insightful!
A: The 'prevalence' is $P(\text{Mutation}) =P(M) =1/10,000 = 0.0001.$ 
'Sensitivity' is $P(\text{Positive}|M) = P(P|M) =0.001,$
Also, 'specificity' is  $P(\text{Negative}|M^c) = P(P^c|M^c) =0.001.$
By the law of total probability, 
$$P(P) = P(P\cap M) + P(P\cap M^c) = P(M)P(P|M) + P(M^c)[1-P(P^c|M^c)].$$
Then the 'predictive power of a positive test' is 
$$P(M|P) \frac{P(P\cap M)}{P(P)}.$$
Plug in the numbers.
Note: The terms in single quotes are widely used in biological and medical applications of
Bayes' Theorem. You might want to google them. From time to time Wikipedia has had extensive relevant articles.
