<p>I would recommend looking into BEDtools, assuming that you are talking about genomic intervals, which I <em>think</em> you are based on the question. Possibly a diagram would help.</p>
<p>BEDtools has a suite of statistical tools for evaluating overlaps, including <a href="https://bedtools.readthedocs.io/en/latest/content/tools/fisher.html" rel="nofollow noreferrer">Fisher Exact Tests</a> and also approaches based on the <a href="https://bedtools.readthedocs.io/en/latest/content/tools/reldist.html" rel="nofollow noreferrer">relative distance</a> of 2 sets of intervals. So as long as your genomic intervals are defined by BED files and a genome file, this should be quite easy, e.g.</p>
<pre><code>bedtools fisher -a A.bed -b B.bed -g genome_file.genome
# will print p-values for left, right, and two-tailed tests
</code></pre>

CC BY-SA 4.0
2021-10-01T19:02:39.887Z
2021-10-01T19:02:39.887Z
Maximilian Press
<p>Is there an appropriate statistical or performance test to perform when I want to compare genomic intervals between 2 samples. Sample A is the the benchmark of comparing the intervals and sample B is the sample in question. What I am really looking for is not only how many intervals from sample B did indeed overlap with sample A but additionally what intervals from sample B has intervals that don't overlap with sample A and also those intervals in sample A that don't overlap with B and being able to measure the performance of how accurate sample B intervals overlap with sample A. This in some sense, can be translated into the following:</p>
<ol>
<li>True positive: intervals from sample B that overlap with sample A.</li>
<li>False positive: intervals from sample B that don't overlap with sample A.</li>
<li>False negative: intervals from sample A that don't overlap with sample B.</li>
</ol>
<p>If I consider the above schema, then I will not be able to do any of the performance and statistical test (ROC curve or accuracy) because it is not possible to know what the true negative and the true negative are needed parameters. Then, what would should I be using to be able to incorporate the above schema and still apply performance and statistical testing.</p>
<p>I highly appreciate any help or pointers in advance.</p>

CC BY-SA 4.0
2021-09-29T04:08:27.310Z
Could you please give more context around your question? What samples? What gene? Can you provide any examples of what you're interested in?

Abstract questions about hypothetical situations are not easy to answer.
gringer
CC BY-SA 4.0
2021-10-01T12:36:49.297Z
Are you looking for some coding solution to get which A interval fall into B interval ?
Paul Endymion
CC BY-SA 4.0
2023-09-14T12:19:35.787Z
Please consider @MaximillianPress's for upvoting/accepting. Accepting an answer does help with site stats
M__
<r><genomics>
Statistical or performance test for genomic intervals between 2 samples
# Statistical or performance test for genomic intervals between 2 samples

(Asked by: username_0 on 2021-09-28)

Is there an appropriate statistical or performance test to perform when I want to compare genomic intervals between 2 samples. Sample A is the the benchmark of comparing the intervals and sample B is the sample in question. What I am really looking for is not only how many intervals from sample B did indeed overlap with sample A but additionally what intervals from sample B has intervals that don't overlap with sample A and also those intervals in sample A that don't overlap with B and being able to measure the performance of how accurate sample B intervals overlap with sample A. This in some sense, can be translated into the following:

1. True positive: intervals from sample B that overlap with sample A.
2. False positive: intervals from sample B that don't overlap with sample A.
3. False negative: intervals from sample A that don't overlap with sample B.

If I consider the above schema, then I will not be able to do any of the performance and statistical test (ROC curve or accuracy) because it is not possible to know what the true negative and the true negative are needed parameters. Then, what would should I be using to be able to incorporate the above schema and still apply performance and statistical testing.

I highly appreciate any help or pointers in advance.

**Tags:** r, genomics
> **Comments:**
> **username_1**: Could you please give more context around your question? What samples? What gene? Can you provide any examples of what you're interested in?  Abstract questions about hypothetical situations are not easy to answer.  
> **username_2**: Are you looking for some coding solution to get which A interval fall into B interval ?  
> **username_3**: Please consider @MaximillianPress's for upvoting/accepting. Accepting an answer does help with site stats  

---

## 1 answers

### Answer by username_4 on 2021-10-01. Score: 1

I would recommend looking into BEDtools, assuming that you are talking about genomic intervals, which I think you are based on the question. Possibly a diagram would help.
BEDtools has a suite of statistical tools for evaluating overlaps, including Fisher Exact Tests and also approaches based on the relative distance of 2 sets of intervals. So as long as your genomic intervals are defined by BED files and a genome file, this should be quite easy, e.g.
bedtools fisher -a A.bed -b B.bed -g genome_file.genome
# will print p-values for left, right, and two-tailed tests


---

