# What is the expected number of occurrences of a 9-mer in 500 random DNA strings, each of length 1000?

I have started learning bioinformatics. There are some matter of finding expected value. But I think I am very weak in calculating such types of things.

As expected value is related to statistics, its explanation is skipped in bioinformatics. So, I am posting it here.

### Question:

Suppose, I have 500 strings, each having length 1000.

Now, I have to calculate the expected number of occurrences of a sub-string having length exactly 9.

Notice that, the string contains only four letters A, T, G, C with same probability (each 0.25).

Another thing to be noted: Overlapping strings should be counted.

### My Approach:

The probability of existing a 9-length sub-string among all 9-length sub-strings = $(0.25)^9$

The number of occurrences of a 9-length sub-string in a string having length 1000 = $(1000-9+1) * (0.25)^9$

If the number of such string becomes 500, then the number of occurrences would be = $500 * (1000-9+1) * (0.25)^9$

But I did wrong somewhere, may be in assumption or in calculation.

Could you please guide me to get the actual solution?

### Source:

This problem is a part of Bioinformatics course track in Coursera.

### Accuracy:

Allowable error = 0.0001

• It depends on the details of each string. Possibly you are thinking of your 500 strings as being some kind of random sample from a large set, but if so, exactly what is that large set? If it's the set of all strings with the uniform distribution then the answer still depends on the length-9 probe string. (That surprises some people.) This question has been discussed a few times on this site (e.g., stats.stackexchange.com/questions/26988), so do some searching. – whuber Aug 19 '16 at 18:15
• @whuber primarily, we should only think about this problem without considering that large dataset. – Enamul Hassan Aug 19 '16 at 18:19
• There is no way to answer it without creating a model for the probability distribution of those 500 strings. For instance, in one model, A never appears. The expected count of AAAAAAAAA therefore is zero. In another model, all strings start and end with 100 A's. The expected count of AAAAAAAAA therefore is at least 184. – whuber Aug 19 '16 at 18:22
• @whuber I got this problem from here. I did something wrong with precision. According to them, my solution is correct. They allow error up to 0.0001. So, may be you are telling about something which deals with the expected number less than that. However, I am actually asking about expected number, not only probability. That means it is not exact duplicate of the question you have provided. Thanks. – Enamul Hassan Aug 19 '16 at 18:28
• A solution that shows how to find the full probability distribution automatically includes everything you need to find expectations. Sometimes there are shortcuts to finding expectations, without needing the full distribution, but a close reading of the duplicate should reveal that cannot be the case here. The fact that you need only an approximate answer, though, opens up genuinely new possibilities. (But please see Henry's answer to the duplicate first: it appears to solve your problem.) Please include that information in an edit to your post. – whuber Aug 19 '16 at 18:30

The answer is: $1.8920898$
However, This answer gives an approximation about the probability. But when it is converted to expected value by multiplying, it becomes a little bit bad and does not serve the purpose. It gives answer: $1.8885179$. According to whuber ♦'s calculation in comment, it came $1.895678$ which also does not serve the purpose.