---
name: "closest-features"
section: "1"
platform: "linux"
package: "bedops"
version: "2.4.41+dfsg-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/closest-features"
---

# closest-features(1)

manual page for closest-features 2.4.41+dfsg

## NAME

closest-features - manual page for closest-features 2.4.41+dfsg

## DESCRIPTION

closest-features

-

  citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract

-

  https://doi.org/10.1093/bioinformatics/bts277

- version:

  2\.4.41 (typical)

- authors:

  Shane Neph & Scott Kuehn

USAGE: closest-features \[Process-Flags\] \<input-file\> \<query-file\>

-

  All input files must be sorted per sort-bed. The program accepts BED and Starch file formats May use '-' for a file to indicate reading from standard input (BED format only).

-

  For every element in \<input-file\>, determine the two elements from \<query-file\> falling

- nearest to its left and right edges (See NOTES below).

  By default, echo the \<input-file\>

-

  element, followed by those left and right elements found in \<query-file\>.

-

  Process Flags:

- **--chrom** \<chromosome\>

  Jump to and process data for given \<chromosome\> only.

- **--closest**

  Choose the closest element for output only.  Ties go the left element.

- **--delim** \<delim\>

  Change output delimiter from '\|' to \<delim\> between columns (e.g. '\\t')

- **--dist**

  Print the signed distances to the \<input-file\> element as additional columns of output.  An overlapping element has a distance of 0.

- **--ec**

  Error check all input files (slower).

- **--header**

  Accept headers (VCF, GFF, SAM, BED, WIG) in any input file.

- **--help**

  Print this message and exit successfully.

- **--no-overlaps**

  Overlapping elements from \<query-file\> will not be reported.

- **--no-ref**

  Do not echo elements from \<input-file\>.

- **--no-query**

  Do not echo elements from \<query-file\>.

- **--version**

  Print program information.

-

  NOTES:

-

  If an element from \<query-file\> overlaps the \<input-file\> element, its distance is zero.

- An overlapping element takes precedence over all non-overlapping elements.

  This is true

-

  even when the overlapping element's edge-to-edge distance to the \<input-file\>'s element is greater than the edge-to-edge distance from a non-overlapping element.

-

  Overlapping elements may be ignored completely (no precedence) with **--no-overlaps**. Elements reported as closest to the left and right edges are never the same. When no qualifying element from \<query-file\> exists as a closest feature, 'NA' is reported.

## SEE ALSO

The full documentation for **closest-features** is maintained as a Texinfo manual.  If the **info** and **closest-features** programs are properly installed at your site, the command

-

  **info closest-features**

should give you access to the complete manual.
