Reference Code backup Executable files
Identifies common intervals among multiple BED/GFF/VCF files.
bedtools multiinter [OPTIONS] -i FILE1 FILE2 .. FILEn
This tool is part of the bedtools
suite ans it's also known as multiIntersectBed
.
Input files
$ cat a.bed chr1 6 12 chr1 10 20 chr1 22 27 chr1 24 30 $ cat b.bed chr1 12 32 chr1 14 30 $ cat c.bed chr1 8 15 chr1 10 14 chr1 32 34 $ cat sizes.txt chr1 5000
$ multiIntersectBed -i a.bed b.bed c.bed
chr1 6 8 1 1 1 0 0
chr1 8 12 2 1,3 1 0 1
chr1 12 15 3 1,2,3 1 1 1
chr1 15 20 2 1,2 1 1 0
chr1 20 22 1 2 0 1 0
chr1 22 30 2 1,2 1 1 0
chr1 30 32 1 2 0 1 0
chr1 32 34 1 3 0 0 1
In this case, titles are the file names
$ multiIntersectBed -header -i a.bed b.bed c.bed
chrom start end num list a.bed b.bed c.bed
chr1 6 8 1 1 1 0 0
chr1 8 12 2 1,3 1 0 1
chr1 12 15 3 1,2,3 1 1 1
chr1 15 20 2 1,2 1 1 0
chr1 20 22 1 2 0 1 0
chr1 22 30 2 1,2 1 1 0
chr1 30 32 1 2 0 1 0
chr1 32 34 1 3 0 0 1
$ multiIntersectBed-header
-i a.bed b.bed c.bed
-names A B C
chrom start end num list A B C chr1 6 8 1 A 1 0 0 chr1 8 12 2 A,C 1 0 1 chr1 12 15 3 A,B,C 1 1 1 chr1 15 20 2 A,B 1 1 0 chr1 20 22 1 B 0 1 0 chr1 22 30 2 A,B 1 1 0 chr1 30 32 1 B 0 1 0 chr1 32 34 1 C 0 0 1
$ multiIntersectBed -header-i a.bed b.bed c.bed
-names A B C
-empty-g sizes.txt
chrom start end num list A B C chr1 0 6 0 none 0 0 0 chr1 6 8 1 A 1 0 0 chr1 8 12 2 A,C 1 0 1 chr1 12 15 3 A,B,C 1 1 1 chr1 15 20 2 A,B 1 1 0 chr1 20 22 1 B 0 1 0 chr1 22 30 2 A,B 1 1 0 chr1 30 32 1 B 0 1 0 chr1 32 34 1 C 0 0 1 chr1 34 5000 0 none 0 0 0