Installation and use of Bedtools

Source: Internet
Author: User

1) Installation

Bedtools offers 3 mounting options

    • Download source code from Google code to install
    • Install using the package management tools in the system, such as Yum under Cnetos, Apt-get under Ubuntu, homebrew under Mac
    • Download the source code from GitHub for installation

Since you can't access Google code and want to compile the installation, download the latest version from GitHub: HTTPS://GITHUB.COM/ARQ5X/BEDTOOLS2

Download the v2.25.0 version of the source code for installation

wget https://github.com/arq5x/bedtools2/archive/v2.25.0.tar.gztar XZVF v2. 25.0 CD BEDTOOLS2-2.25. 0/makeCD bin/export PATH= $PWD: $PATH

2) Use

Intersect: Ask for the intersection of two intervals, the input file can be BED,GFF,VCF

Prepare two test files,

Cpg.bed, the contents of which are

Chr12070cpg_1chr1100120cpg_2chr1150250cpg_3

Exon.bed, the contents of which are

Chr11040exon_1chr15060exon_2chr1130180exon_3chr1200280exon_4

Using the default parameters, please overlap the file, run

Bedtools intersect-a cpg.bed-  b exon.bed

Result is

Chr12040cpg_1chr15060cpg_1chr1150180cpg_3chr1200250cpg_3

As you can see, by default only the area of overlap in a is output

Add the-wa parameter and run it again

Bedtools intersect-a cpg.bed-  b Exon.bed-wa

The result is:

Chr12070cpg_1chr12070cpg_1chr1150250cpg_3chr1150250cpg_3

As can be seen, with the-wa parameter, as long as the area in A and B in the area has a intersection, the output, and overlap several times, the output several times

Add-WB parameter, run

Bedtools intersect-a cpg.bed-  b EXON.BED-WB

The result is:

Chr12040cpg_1chr11040exon_1chr15060cpg_1chr15060exon_2chr1150180cpg_3chr1130180exon_3chr1200250cpg_ 3chr1200280exon_4

As you can see, with the-WB parameter, the entire range in B is output in addition to the overlap area in output a.

Add-wa,-WB parameters, run again

Bedtools intersect-a cpg.bed-  b EXON.BED-WA-WB

The result is:

Chr12070cpg_1chr11040exon_1chr12070cpg_1chr15060exon_2chr1150250cpg_3chr1130180exon_3chr1150250cpg_ 3chr1200280exon_4

As you can see, adding the-wa and-WB parameters at the same time will output the overlap area in pairs

-C parameter, count the number of each region and Boverlap in a

Bedtools intersect-a cpg.bed-  b exon.bed-c

The result is:

Chr12070cpg_12chr1100120cpg_20chr1150250cpg_32

-V parameter: only outputs a zone with no boverlap in a

Bedtools intersect-a cpg.bed-  b exon.bed-v

The result is:

Chr1100120cpg_2

As you can see, as long as the overlap with B is not output.

  

 

  

  

  

  

  

  

  

  

  

Installation and use of Bedtools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.