3. Quick start

### Navigation

- index
- next |
- previous |
- bedtools v2.18.0 »

# 3. Quick start

## 3.1. Install bedtools

    curl http://bedtools.googlecode.com/files/BEDTools.<version>.tar.gz > BEDTools.tar.gz
    tar -zxvf BEDTools.tar.gz
    cd BEDTools
    make
    sudo cp bin/* /usr/local/bin/

## 3.2. Use bedtools

Below are examples of typical bedtools usage. Using the “-h” option with any bedtools will report a list of all command line options.

Report the base-pair overlap between the features in two BED files.

    bedtools intersect -a reads.bed -b genes.bed

Report those entries in A that overlap NO entries in B. Like “grep -v”

    bedtools intersect  -a reads.bed -b genes.bed -v

Read BED A from STDIN. Useful for stringing together commands. For example, find genes that overlap LINEs but not SINEs.

    bedtools intersect -a genes.bed -b LINES.bed | \
      bedtools intersect -a stdin -b SINEs.bed -v

Find the closest ALU to each gene.

    bedtools closest -a genes.bed -b ALUs.bed

Merge overlapping repetitive elements into a single entry, returning the number of entries merged.

    bedtools merge -i repeatMasker.bed -n

Merge nearby repetitive elements into a single entry, so long as they are within 1000 bp of one another.

    bedtools merge -i repeatMasker.bed -d 1000

comments powered by Disqus

### Navigation

- index
- next |
- previous |
- bedtools v2.18.0 »

### 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 3. Quick start 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.