I have used a python script to identify target sequences in a DNA sequence file. There are two classes of sequence: coding and non-coding.

I have identified 728 sequences of interest. 597 of these fall into the coding regions and 131 of these fall into the non-coding regions. This is the equivalent of 18% non-coding. The total non-coding region in the sequence file is 13%.

Is there a statistical tool to demonstrate the python script identified target sequences in a non-random fashion? If the script identified sequences that were randomly distributed then 13% of them would have been found in the non-coding region, from a total of 728 this seems like it should be reliable.


You can model this as a binomial process.

A genomic region can be either coding or non-coding. Drawing 100 samples from a distribution where 90% of the regions are non-coding, you would expect that you draw around 90 non-coding and 10 coding samples. The farther away you are from this expected ratio, the less likely it is that the 100 samples are drawn by random from the 90/10 distribution.

Therefore, given the fraction of coding/non-coding regions, the total number of regions and the number of regions identified as non-coding by your script, you can calculate a p-value and reject the assumption that your script identified non-coding regions in a random fashion if the p-value is small enough.

You can do this in R like this:

binom.test(x, n, p)

where x is the number of non-coding regions identified by your script, n the total number of regions and p the fraction of non-coding regions.

  • $\begingroup$ Excellent, this makes perfect sense and sounds just exactly like what I was looking for. $\endgroup$ – Ryan_J_Hope Jan 8 at 16:58
  • $\begingroup$ Could I just check I have done this correctly. My reference ([doi.org/10.1186/s13068-017-0742-z] - Table 1, Row 1) shows there are 3871 coding regions to get total regions (n) I have multiplied this by 2 as every coding region is separated by a non coding which produces a total of 7742. The fraction of non-coding is 13.04% which I have expressed as 0.1304 $\endgroup$ – Ryan_J_Hope Jan 8 at 17:40
  • $\begingroup$ Exact binomial test data: 131 and 7742 number of successes = 131, number of trials = 7742, p-value < 2.2e-16 alternative hypothesis: true probability of success is not equal to 0.1304 95 percent confidence interval: 0.01416616 0.02004698 sample estimates: probability of success 0.01692069 $\endgroup$ – Ryan_J_Hope Jan 8 at 17:58
  • $\begingroup$ That p-value looks weird. $\endgroup$ – Ryan_J_Hope Jan 8 at 18:00
  • $\begingroup$ It doesn't look weird. That p-value is just zero for all practical purposes. $\endgroup$ – Pere Jan 8 at 19:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.