# dist2closest()

### Description

Computes the distance to the closest amino acid of the indicated type

### Usage

`dist2closest(pdb, res, aa, backbone = FALSE)`

### Arguments

`pdb` is either a PDB id, or the path to a pdb file.

`chain` one letter identifier of the polypeptide chain.

`res` position of the residue of interest.

`aa` amino acid of interest.

`backbone` logical, when TRUE it means that we include those atoms belonging to the main chain (CA, N, O and C) beside all the side chain atoms.

### Value

Numerical value indicating the distance in ångströms (Å).

pairwise.dist(), res.dist(), ball()

### Details

The continuous formation and rupture of non-covalent bonds (intra- and intermolecular), gives rise to dynamic molecular interactions, which are cosubstantial to life. These non-covalent interactions can adopt many forms, but all of them are fundamentally electrostatic in nature, and strongly influenced by distances.

Therefore, computing spatial distances (in ångströms, Å), either between atoms or residues, is a useful task in many different contexts. A number of function from the package ptm will help us in these tasks:

Let’s take as model the alpha subunit of the human eIF2 (PDB ID 1Q8K). Ser218 and Met222
have been proposed to be functionally related. So, we’ll focus on this pair of residues.

What if we want to know the distance in ångströms between M222 and the closest vecinal serine?, is Ser218 the closest one? To address this issues, we shall use dist2closest() as follows:

```dist2closest(pdb = '1q8k', chain = 'A', res = 222, aa = 'S')
```
```## [1] 5.04
## attr(,"closest residue")
## [1] "CB-SER-218-A <--> CB-MET-222-A"
```

Note that the identities of the closest atoms are given as an attribute. Also, remember that the backbone atoms can be included in the analysis is wished:

```dist2closest(pdb = '1q8k', chain = 'A', res = 222, aa = 'S', backbone = TRUE)
```
```## [1] 3.46
## attr(,"closest residue")
## [1] "CB-SER-218-A <--> O-MET-222-A"
```

Just out of curiosity, what would be the closest methionine to Met222?

```dist2closest(pdb = '1q8k', chain = 'A', res = 222, aa = 'M', backbone = TRUE)
```
```## [1] 9.19
## attr(,"closest residue")
## [1] "CE-MET-236-A <--> O-MET-222-A"
```