5.1.26. overlap

### Navigation

- index
- next |
- previous |
- bedtools v2.18.0 »
- 5. The BEDTools suite »

# 5.1.26. overlap

overlap computes the amount of overlap (in the case of positive values) or distance (in the case of negative values) between feature coordinates occurring on the same input line and reports the result at the end of the same line. In this way, it is a useful method for computing custom overlap scores from the output of other BEDTools.

## 5.1.26.1. Usage and option summary

Usage:

    overlap [OPTIONS] -i <input> -cols s1,e1,s2,e2

Option | Description
--- | ---
-i | Input file. Use “stdin” for pipes.
-cols | Specify the columns (1-based) for the starts and ends of the features for which you’d like to compute the overlap/distance. The columns must be listed in the following order: start1,end1,start2,end2

## 5.1.26.2. Default behavior

The default behavior is to compute the amount of overlap between the features you specify based on the start and end coordinates. For example:

    windowBed -a A.bed -b B.bed -w 10
    chr1  10  20  A  chr1  15  25  B
    chr1  10  20  C  chr1  25  35  D

# Now let’s say we want to compute the number of base pairs of overlap # between the overlapping features from the output of windowBed.

    windowBed -a A.bed -b B.bed -w 10 | overlap -i stdin -cols 2,3,6,7
    chr1  10  20  A  chr1  15  25  B  5
    chr1  10  20  C  chr1  25  35  D  -5

comments powered by Disqus

### Navigation

- index
- next |
- previous |
- bedtools v2.18.0 »
- 5. The BEDTools suite »

### Edit and improve this document!

This file can be edited directly through the Web. Anyone can update and fix errors in this document with few clicks -- no downloads needed.

1. Go to 5.1.26. overlap on GitHub.
2. Edit files using GitHub's text editor in your web browser (see the 'Edit' tab on the top right of the file)
3. Fill in the Commit message text box at the bottom of the page describing why you made the changes. Press the Propose file change button next to it when done.
4. Then click Send a pull request.
5. Your changes are now queued for review under the project's Pull requests tab on GitHub!

For an introduction to the documentation format please see the reST primer.