For each feature in A, finds the closest feature (upstream or downstream) in B.
Similar to intersectBed, closestBed searches for overlapping features in A and B. In the event that no feature in B overlaps the current feature in A, closestBed will report the closest (that is, least genomic distance from the start or end of A) feature in B. For example, one might want to find which is the closest gene to a significant GWAS polymorphism. Note that closestBed will report an overlapping feature as the closest, that is, it does not restrict to closest non-overlapping feature.
The output is a tab-delimited text file.
This tool uses the BEDTools package. Please cite the article:
Quinlan AR and Hall IM, 2010. BEDTools: a flexible suite of utilities for comparing genomic features. Bioinformatics. 26, 6, pp. 841–842.
Please see the BEDTools homepage for more details.