# calcTargetingDistance: Calculates a 5-mer distance matrix from a TargetingModel... In shazam: Immunoglobulin Somatic Hypermutation Analysis

## Description

`calcTargetingDistance` converts either the targeting rates in a `TargetingModel` model to a matrix of 5-mer to single-nucleotide mutation distances, or the substitution rates in a 1-mer substitution model to a symmetric distance matrix.

## Usage

 `1` ```calcTargetingDistance(model, places = 2) ```

## Arguments

 `model` TargetingModel object with mutation likelihood information, or a 4x4 1-mer substitution matrix normalized by row with rownames and colnames consisting of "A", "T", "G", and "C". `places` decimal places to round distances to.

## Details

The targeting model is transformed into a distance matrix by:

1. Converting the likelihood of being mutated p=mutability*substitution to distance d=-log10(p).

2. Dividing this distance by the mean of the distances.

3. Converting all infinite, no change (e.g., A->A), and NA distances to zero.

The 1-mer substitution matrix is transformed into a distance matrix by:

1. Symmetrize the 1-mer substitution matrix.

2. Converting the rates to distance d=-log10(p).

3. Dividing this distance by the mean of the distances.

4. Converting all infinite, no change (e.g., A -> A), and NA distances to zero.

## Value

For input of TargetingModel, a matrix of distances for each 5-mer motif with rows names defining the center nucleotide and column names defining the 5-mer nucleotide sequence. For input of 1-mer substitution matrix, a 4x4 symmetric distance matrix.

 ```1 2 3 4 5``` ```# Calculate targeting distance of HH_S5F dist <- calcTargetingDistance(HH_S5F) # Calculate targeting distance of HH_S1F dist <- calcTargetingDistance(HH_S1F) ```