For a given point on BAF-LRR plot and a given canonical line, this function finds the nearest point on the line to the data point.

1 2 | ```
getDistToPath(x0, y0, x, y, type, nb, nt, strictness = 1.1,
thr = 0.001, is.scaling = F, BAF.scale = 8)
``` |

`x0` |
x coordinate for the Origin Cluster |

`y0` |
y coordinate for the Origin Cluster |

`x` |
x coordinate for the data point |

`y` |
y coordinate for the data point |

`type` |
integer, ploidy indicator. 1, diploid; 2, tetraploid; 3, hexaploid |

`nb` |
number of minor alleles |

`nt` |
number of total alleles |

`strictness` |
noise tolerance for points with sAGP around 1. See |

`thr` |
numeric, see details. |

`is.scaling` |
logic. If TRUE, the function will rescale the BAF values so that it has the same dimension as LRR. |

`BAF.scale` |
numeric. If is.scaling is TRUE, this is the value to rescale BAF values. |

For a given data point A, and a canonical line L, this function first finds a point X on L that is closest to A, and designates the distance from A to X is the closest distance from A to L. This step is achieved by sequentially split the period of L and select the half that is closer to A. The argument `thr`

is the sensitivity threshold to find X during this step.

A list representing a canonical line and containing the following elements:

`p.min` |
sAGP value of the nearest point (X) on L to the data point (A). |

`dist` |
distance from A to X. |

`x.min` |
x coordinate of X. |

`y.min` |
y coordinate of X. |

Bo Li

1 2 3 4 5 6 | ```
x0=0.05
y0=0.2
x=0.15
y=0.45
## Find X on canonical line for hemizygous amplification:
getDistToPath(x0,y0,x,y,1,1,3)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.