Use when you need to find the closest genomic feature in one file for each feature in another file, including distance calculations and strand-aware lookups.
closestBed -a <A> -b <B> [options]/home/vimalinx/miniforge3/envs/bio/bin/closestBedreferences/help.md-d or signed upstream/downstream distance with -D.-io.-s / -S.-t, -k, and -mdb.# 1) Find the nearest gene for each peak with distance
closestBed \
-a peaks.bed \
-b genes.bed \
-d
# 2) Report upstream/downstream signed distance relative to A strand
closestBed \
-a peaks.bed \
-b genes.bed \
-D a \
-io
# 3) Keep the two closest same-strand hits and break ties by file order
closestBed \
-a exons.bed \
-b transcripts.bed \
-s \
-k 2 \
-t first
-io.-d for absolute distance or -D ref|a|b if signed orientation matters biologically.-s / -S, -iu / -id, or -fu / -fd only after you are sure the strand and orientation model is the one you want.none / -1 output because they mean no candidate in B exists on the same chromosome.-iu, -id, -fu, and -fd require -D and inherit its upstream/downstream orientation rules.-t first or -t last.-mdb each and -mdb all produce meaningfully different semantics.none / -1 results.-h for help; some --help / --version invocations on these wrappers produce extra errors.