Learn R Programming

perfectphyloR (version 0.2.1)

rdistMatrix: Rank-based distances between haplotypes in a given partition

Description

This function computes the pairwise distances between haplotypes (tips) of the dendrogram based on the ranking of the nested partitions in the dendrogram. See the details.

Usage

rdistMatrix(dend, sep = "-")

Arguments

dend

A list of nodes that represents the nested partition of haplotypes.

sep

A character string separator for concatenating haplotype labels in the dendrogram if they are undistingushable in the window around the focal SNV. See the arguments in reconstructPP.

Value

A matrix of pairwise distances between haplotypes.

Details

We code the distance between two haplotypes of a dendrogram as the number of inner nodes that seperate the haplotypes plus one. That is, we assign the distance between two internal neighbouring nodes as one, and the distance between an internal node and its neighbouring tip as one. To illustrate, consider the following figure of a dendrogram. In the figure, the distance between the haplotypes 2931 and 454 is 3; the distance between other haplotypes are given in the table below.

Figure: treedist.png

Figure: trtable.png

Examples

Run this code
# NOT RUN {
data(ex_hapMat_data)
rdend <- reconstructPP(hapMat = ex_hapMat_data, focalSNV = 2, minWindow = 1, sep = "-" )
rdistMatrix(rdend)


# }

Run the code above in your browser using DataLab