Get the App
SLTechnology News&Howtos  ›  Development  › 

How to find intersection in bedtools

Shulou Source: shulou.com Published: 2022-06-01 13:03:16 10月02日 Update

This article mainly introduces how to find the intersection of bedtools, the introduction in the article is very detailed, has a certain reference value, interested friends must read!

Bedtools intersection its usage: bedtools intersect [OPTIONS] [- a |-abam]-b BED input file is in bed format, at least three columns, respectively.

Bedtools is a set of powerful tools to deal with genome information analysis, in which the intersect function can find the intersection between regions.

Its usage:

Bedtools intersect [OPTIONS] [- a |-abam]-b BED

The input file is in bed format, with at least three columns, namely the chromosome, the starting position (0-based, including), and the ending position (1-based, excluding). The fourth column is generally the name of the region

Case 1: two files containing the location of chromosomes, recorded as A file and B file respectively. What is the intersection of chromosome positions from different documents?

$cat A.bed

Chr1 10 20

Chr1 30 40

$cat B.bed

Chr1 15 25

$bedtools intersect-an A.bed-b B.bed

Chr1 15 20

Case 2: two files containing the location of chromosomes, recorded as A file and B file respectively. Find out which chromosome positions in file A have overlap with those in file B.

$cat A.bed

Chr1 10 20

Chr1 30 40

$cat B.bed

Chr1 15 25

$bedtools intersect-an A.bed-b B.bed-wa

Chr1 10 20

Case 3: two files containing the location of chromosomes, recorded as A file and B file respectively. To find out whether the chromosome position of file An intersects with the position of chromosome in file B. If there is an intersection, enter the chromosome location of A file and the chromosome location of B file respectively; if there is no intersection, output the chromosome location of A file and use'. -1-1 'make up the file.

$cat A.bed

Chr1 10 20

Chr1 30 40

$cat B.bed

Chr1 15 25

$bedtools intersect-an A.bed-b B.bed-loj

Chr1 10 20 chr1 15 25

Chr1 30 40. -1-1

Case 4: two files containing the location of chromosomes, recorded as A file and B file respectively. For the chromosome position in A file, if there is overlap in the chromosome position in file An and file B, the chromosome position in file An and the chromosome position in file B, as well as the length of overlap are output.

$cat A.bed chr1 10 20 chr1 30 40

$cat B.bed chr1 15 20 chr1 18 25

$bedtools intersect-an A.bed-b B.bed-wo

Chr1 10 20 chr1 15 20 5

Chr1 10 20 chr1 18 25 2

The above is all the content of the article "how to intersect bedtools". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: File location chromosome staining intersection two case don't remember input content region format article output different powerful between value information interest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Linux Apple macOS MySQL