Skip to content

Distance Metrics

Tony edited this page Dec 1, 2026 · 2 revisions

A distance metric is a number for each pair of sequences that says how different they are. MicrobeTrace computes it from your sequences, and links the pairs whose distance is at or below the Link Threshold. You choose the metric on the Files view, in the Distance Metric setting.

The metrics

The default is TN93. The list is grouped as the Files view groups it.

Evolutionary models

These are corrected distances. They estimate the number of substitutions per site, allowing for changes that happened more than once at the same site and, for some, for unequal base frequencies or for transitions and transversions counted apart. Their units are substitutions per site, so 0.015 means 1.5%.

  • TN93 (Tamura-Nei): corrects for multiple hits, unequal base frequencies, and transitions and transversions. The usual choice for HIV.
  • TN92 (Tamura 1992): like K2P, but also allows for an uneven share of G and C bases.
  • K2P (Kimura): the Kimura two-parameter model, which counts transitions and transversions separately.
  • JC69 (Jukes-Cantor): assumes every change is equally likely.

Basic

These are uncorrected counts or proportions of sites that differ.

  • SNPs: a count of the sites that differ.
  • Hamming: the fraction of sites that differ.
  • P-Distance: the fraction of the compared sites that differ. It ignores sites that cannot be compared.

Diagnostics

These help you look at your data.

  • Transitions: a count of purine-to-purine (A and G) or pyrimidine-to-pyrimidine (C and T) changes.
  • Transversions: a count of changes between a purine and a pyrimidine.
  • Ts/Tv Ratio: transitions divided by transversions.

The Link Threshold defaults to 0.015, which suits the proportion metrics. Each metric also has its own default threshold, used when links are stored only within a threshold: 0.015 for the proportions, 16 for the counts (SNPs, Transitions, Transversions) and 2 for Ts/Tv Ratio. Set the threshold to suit your data.

Ambiguous bases

Ambiguity codes (such as N, R or Y) stand for more than one base. The Ambiguities setting says how a pair of sequences with one is compared. The default is Average.

  • Average: an ambiguous base counts as the average over every base it could be.
  • Resolve: an ambiguous base is taken as whichever base it could be that matches the other sequence.
  • Skip: a site with an ambiguous base is left out of the comparison.
  • GapMM: like Average, but a gap facing a base counts as an N, so mostly as a mismatch. This is how earlier MicrobeTrace versions worked.
  • HIV-TRACE -g: resolves ambiguous bases, unless too many sites in the pair are ambiguous. Then it averages. "Too many" is set by the Ambiguity Threshold, which appears only for this choice. Its default is 0.015, the fraction of ambiguous sites in a pair (1.5%). This follows the -g option of HIV-TRACE's tn93.

Unusual values

Some distances are not ordinary numbers.

  • NaN (not a number) means the two sequences have no comparable sites, so no distance can be computed. A NaN pair never passes a threshold, so it does not become a link.
  • Infinity means the distance is saturated. The sequences differ so much that the model cannot estimate a distance. An infinite distance is above any threshold, so it is not a link. The Heatmap shows saturated distances in its highest color, and the link threshold scale leaves them out.
  • Above 1: corrected distances can be greater than 1 when there is a lot of change. This is not an error. The Link Threshold is just a number, so the threshold applies to these values as it does to the rest.

Other metrics and link lists

Under Also Compute, you can compute more metrics for the same sequences. Each one is kept on the links, so you can filter, color or plot by it later.

Distances you computed elsewhere can be loaded as a link list or a distance matrix, with any metric you like. MicrobeTrace does not check which metric produced them.

References

  • TN93: K Tamura, M Nei, "Estimation of the number of nucleotide substitutions in the control region of mitochondrial DNA in humans and chimpanzees", Molecular Biology and Evolution 10(3):512-526, 1993. https://doi.org/10.1093/oxfordjournals.molbev.a040023
  • K2P: M Kimura, "A simple method for estimating evolutionary rates of base substitutions through comparative studies of nucleotide sequences", Journal of Molecular Evolution 16:111-120, 1980.
  • JC69: T H Jukes, C R Cantor, "Evolution of protein molecules", in Mammalian Protein Metabolism (H N Munro, ed.), Academic Press, 1969, pp. 21-132.
  • TN92: K Tamura, "Estimation of the number of nucleotide substitutions when there are strong transition-transversion and G+C-content biases", Molecular Biology and Evolution 9(4):678-687, 1992.

Clone this wiki locally