liminfo

bedtools Reference

Free reference guide: bedtools Reference

25 results

About bedtools Reference

The bedtools Reference is a comprehensive cheat sheet covering over 25 essential bedtools commands organized into seven categories: interval operations, coverage analysis, proximity searches, sequence extraction, file formats, utilities, and bioinformatics pipelines. Each entry includes the command syntax, a clear description of its purpose, and real-world usage examples with common flags.

This reference is designed for bioinformaticians, genomics researchers, and computational biologists who work with BED, BAM, GFF, and BedGraph files on a daily basis. Whether you are performing ChIP-seq peak filtering, RNA-seq exon coverage analysis, or whole-genome variant annotation, the searchable interface lets you find the exact command and flag combination you need in seconds.

All content is rendered entirely in your browser with no server interaction. The reference supports full-text search across command names, descriptions, and examples, and you can filter by category to narrow results. Dark mode and responsive layout ensure comfortable use on any device, from a desktop workstation to a laptop in the lab.

Key Features

  • Complete syntax and examples for intersect, subtract, merge, complement, and other interval operations
  • Coverage commands including bedtools coverage, genomecov, and multicov with BAM/BED inputs
  • Proximity tools such as closest, window, and slop with asymmetric and percentage-based extension options
  • Sequence extraction with getfasta, maskfasta, and nuc for GC content and nucleotide composition
  • File format specifications for BED3/BED6/BED12, GFF/GTF, and BedGraph with coordinate system notes
  • Ready-to-use pipeline examples for ChIP-seq blacklist filtering, RNA-seq intergenic extraction, and WGS variant annotation
  • Category-based filtering across interval ops, coverage, proximity, sequence, formats, utilities, and pipelines
  • Full-text search across all command names, flags, and example code snippets

Frequently Asked Questions

What bedtools commands does this reference cover?

This reference covers over 25 core bedtools commands organized into seven categories: interval operations (intersect, subtract, merge, complement), coverage analysis (coverage, genomecov, multicov), proximity tools (closest, window, slop), sequence extraction (getfasta, maskfasta, nuc), file format specifications (BED, GFF/GTF, BedGraph), utilities (sort, bamtobed, makewindows, groupby), and complete pipeline examples for ChIP-seq, RNA-seq, and WGS workflows.

How do I use bedtools intersect with a minimum overlap fraction?

Use the -f flag to specify the minimum overlap as a fraction of the A interval. For example, "bedtools intersect -a a.bed -b b.bed -f 0.50" requires that at least 50% of the A interval overlaps with B. Add the -r flag for reciprocal overlap, meaning both A and B must meet the threshold, or -e for either-or logic.

What is the difference between bedtools coverage and genomecov?

bedtools coverage computes read depth statistics for each interval in file A using reads from file B, reporting per-interval metrics like bases covered and coverage fraction. bedtools genomecov calculates genome-wide coverage depth and can output in BedGraph format (-bg), making it suitable for generating coverage tracks for genome browsers or BigWig conversion.

How do I extract FASTA sequences for specific BED regions?

Use "bedtools getfasta -fi genome.fa -bed regions.bed" to extract the sequences corresponding to your BED intervals. Add the -s flag to respect strand orientation (reverse-complement for minus strand), and the -name flag to use the BED name column instead of coordinates in the FASTA headers.

Why does bedtools merge require sorted input?

bedtools merge processes intervals sequentially and combines overlapping or adjacent regions. Sorted input (by chromosome then start position) ensures that all overlapping intervals are contiguous in the file, allowing single-pass merging. Sort your file with "sort -k1,1 -k2,2n" or "bedtools sort" before piping to merge.

What coordinate system does BED format use?

BED files use a 0-based, half-open coordinate system. The start position is 0-indexed and inclusive, while the end position is exclusive. For example, the first 100 bases of chr1 are represented as "chr1 0 100". This differs from GFF/GTF, which uses 1-based, fully-closed coordinates where the same region would be "chr1 1 100".

How can I remove blacklist regions from ChIP-seq peaks?

Use "bedtools intersect -a peaks.narrowPeak -b blacklist.bed -v" where the -v flag returns only A intervals that do NOT overlap with any B interval. This effectively removes all peaks that fall within blacklisted genomic regions. You can then pipe the result to merge or further downstream analysis.

Can I use bedtools for multi-sample coverage analysis?

Yes, bedtools multicov is designed for exactly this purpose. It takes multiple BAM files and a BED file of intervals, then reports read counts for each BAM across every interval. The command "bedtools multicov -bams s1.bam s2.bam s3.bam -bed peaks.bed" appends one count column per BAM file to each BED interval.