Category

Genomic Interval Manipulation


Usage

intersectBed [OPTIONS] -a \ -b


Manual

-a    BAM/BED/GFF/VCF file “A”. Each feature in A is compared to B in search of overlaps. Use “stdin” if passing A with a UNIX pipe.
-b    

One or more BAM/BED/GFF/VCF file(s) “B”. Use “stdin” if passing B with a UNIX pipe.

NEW!!!: -b may be followed with multiple databases and/or wildcard (*) character(s).


-abam    BAM file A. Each BAM alignment in A is compared to B in search of overlaps. Use “stdin” if passing A with a UNIX pipe: For example: samtools view -b | bedtools intersect -abam stdin -b genes.bed. Note: no longer necessary after version 2.19.0
-ubam    Write uncompressed BAM output. The default is write compressed BAM output.
-bed    When using BAM input (-abam), write output as BED. The default is to write output in BAM when using -abam. For example: bedtools intersect -abam reads.bam -b genes.bed -bed
-wa    Write the original entry in A for each overlap.
-wb    Write the original entry in B for each overlap. Useful for knowing what A overlaps. Restricted by -f and -r.
-loj    Perform a “left outer join”. That is, for each feature in A report each overlap with B. If no overlaps are found, report a NULL feature for B.
-wo    Write the original A and B entries plus the number of base pairs of overlap between the two features. Only A features with overlap are reported. Restricted by -f and -r.
-wao    Write the original A and B entries plus the number of base pairs of overlap between the two features. However, A features w/o overlap are also reported with a NULL B feature and overlap = 0. Restricted by -f and -r.
-u    Write original A entry once if any overlaps found in B. In other words, just report the fact at least one overlap was found in B. Restricted by -f and -r.
-c    For each entry in A, report the number of hits in B while restricting to -f. Reports 0 for A entries that have no overlap with B. Restricted by -f and -r.
-v    Only report those entries in A that have no overlap in B. Restricted by -f and -r.
-f    Minimum overlap required as a fraction of A. Default is 1E-9 (i.e. 1bp).
-F    Minimum overlap required as a fraction of B. Default is 1E-9 (i.e., 1bp).
-r    Require that the fraction of overlap be reciprocal for A and B. In other words, if -f is 0.90 and -r is used, this requires that B overlap at least 90% of A and that A also overlaps at least 90% of B.
-e    Require that the minimum fraction be satisfied for A _OR_ B. In other words, if -e is used with -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of B is covered. Without -e, both fractions would have to be satisfied.
-s    Force “strandedness”. That is, only report hits in B that overlap A on the same strand. By default, overlaps are reported without respect to strand.
-S    Require different strandedness. That is, only report hits in B that overlap A on the _opposite_ strand. By default, overlaps are reported without respect to strand.
-split    Treat “split” BAM (i.e., having an “N” CIGAR operation) or BED12 entries as distinct BED intervals.
-sorted    For very large B files, invoke a “sweeping” algorithm that requires position-sorted (e.g., sort -k1,1 -k2,2n for BED files) input. When using -sorted, memory usage remains low even for very large files.
-g    Specify a genome file the defines the expected chromosome order in the input files for use with the -sorted option.
-header    Print the header from the A file prior to results.
-names    When using multiple databases (-b), provide an alias for each that will appear instead of a fileId when also printing the DB record.
-filenames    When using multiple databases (-b), show each complete filename instead of a fileId when also printing the DB record.
-sortout    When using multiple databases (-b), sort the output DB hits for each record.
-nobuf    Disable buffered output. Using this option will cause each line of output to be printed as it is generated, rather than saved in a buffer. This will make printing large output files noticeably slower, but can be useful in conjunction with other software tools and scripts that need to process one line of bedtools output at a time.
-iobuf    Follow with desired integer size of read buffer. Optional suffixes K/M/G supported. Note: currently has no effect with compressed files.


Share your experience or ask a question