Perform agglomerative hierarchical clustering on a distance matrix.
Input:
- A PHYLIP format distance matrix (strict or relaxed).
- For pairwise list input (
name1\tname2\tdist), usenecom mat to-phylipfirst.
Output:
- A Newick tree string written to stdout or
--outfile.
Notes:
- Internal node height is half the linkage distance (
height = distance / 2); branch length from child to parent isparent_height - child_height. --method <METHOD>: linkage method (default:ward). Supported:single,complete,average(upgma),weighted(wpgma),centroid(upgmc),median(wpgmc),ward(ward.d2).- For reducible methods (
single,complete,average,weighted,ward), the default NN-chain implementation may produce a different merge order than the primitive algorithm, but the resulting partition sequence is equivalent. centroidandmedianlinkage may produce non-monotonic merge heights (inversions); branch lengths are clamped at0.0so the resulting Newick tree remains valid. The same clamp is applied to all methods as a safety net.- For Ward’s method, the input is assumed to be Euclidean distances or similar.
- Alias:
necom clust hclustis equivalent tonecom clust hier.
Examples:
-
Ward’s method (default)
necom clust hier matrix.phy > tree.nwk -
Average linkage (UPGMA)
necom clust hier matrix.phy --method average > tree.nwk -
Single linkage (nearest neighbor)
necom clust hier matrix.phy --method single > tree.nwk