You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<dt><strong>dm</strong><spanclass="classifier">skbio.DistanceMatrix</span></dt><dd><p>Input distance matrix containing distances between taxa.</p>
673
+
<ddclass="field-odd"><dl>
674
+
<dt><strong>dm</strong><spanclass="classifier">skbio.DistanceMatrix</span></dt><dd><p>Input distance matrix containing pairwise distances among taxa.</p>
675
675
</dd>
676
-
<dt><strong>disallow_negative_branch_length</strong><spanclass="classifier">bool, optional</span></dt><dd><p>Neighbor joining can result in negative branch lengths, which don’t
677
-
make sense in an evolutionary context. If <cite>True</cite>, negative branch
678
-
lengths will be returned as zero, a common strategy for handling this
679
-
issue that was proposed by the original developers of the algorithm.</p>
676
+
<dt><strong>clip_to_zero</strong><spanclass="classifier">bool, optional</span></dt><dd><p>If True (default), convert negative branch lengths into zeros.</p>
677
+
<divclass="versionadded">
678
+
<p><spanclass="versionmodified added">Added in version 0.6.3.</span></p>
679
+
</div>
680
680
</dd>
681
681
<dt><strong>result_constructor</strong><spanclass="classifier">function, optional</span></dt><dd><p>Function to apply to construct the result object. This must take a
682
-
newick-formatted string as input. The result of applying this function
683
-
to a newick-formatted string will be returned from this function. This
684
-
defaults to <codeclass="docutils literal notranslate"><spanclass="pre">lambda</span><spanclass="pre">x:</span><spanclass="pre">TreeNode.read(StringIO(x),</span><spanclass="pre">format='newick')</span></code>.</p>
682
+
newick-formatted string as input. Deprecated and to be removed in a
683
+
future release.</p>
684
+
<divclass="deprecated">
685
+
<p><spanclass="versionmodified deprecated">Deprecated since version 0.6.3.</span></p>
686
+
</div>
687
+
</dd>
688
+
<dt><strong>disallow_negative_branch_length</strong><spanclass="classifier">bool, optional</span></dt><dd><p>Alias of <codeclass="docutils literal notranslate"><spanclass="pre">clip_to_zero</span></code> for backward compatibility. Deprecated and to be
689
+
removed in a future release.</p>
690
+
<divclass="deprecated">
691
+
<p><spanclass="versionmodified deprecated">Deprecated since version 0.6.3.</span></p>
<p>Neighbor joining, by definition, creates unrooted trees with varying tip heights,
724
+
which contrasts UPGMA (<aclass="reference internal" href="skbio.tree.upgma.html#skbio.tree.upgma" title="skbio.tree.upgma"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">upgma()</span></code></a>). One strategy for rooting the resulting tree
725
+
is midpoint rooting, which is accessible as <aclass="reference internal" href="skbio.tree.TreeNode.root_at_midpoint.html#skbio.tree.TreeNode.root_at_midpoint" title="skbio.tree.TreeNode.root_at_midpoint"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">TreeNode.root_at_midpoint()</span></code></a>.</p>
726
+
<p>Note that the tree constructed using neighbor joining is not rooted at a tip,
727
+
unlike minimum evolution (<aclass="reference internal" href="skbio.tree.bme.html#skbio.tree.bme" title="skbio.tree.bme"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">bme()</span></code></a>), so re-rooting is required before tree
728
+
re-arrangement operations such as nearest neighbor interchange (NNI) (<aclass="reference internal" href="skbio.tree.nni.html#skbio.tree.nni" title="skbio.tree.nni"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">nni()</span></code></a>)
729
+
can be performed.</p>
730
+
<p>Neighbor joining is most accurate when distances are additive – the distance
731
+
between two taxa in the matrix equals to the sum of branch lengths connecting them
732
+
in the tree. When this assumption is violated, which is common in real-world data,
733
+
negative branch lengths may be produced, which cause challenges in interpretation
734
+
and subsequent analyses. This function converts negative branch lengths into zeros
735
+
by default, but this behavior can be disabled by setting <codeclass="docutils literal notranslate"><spanclass="pre">clip_to_zero</span></code> to False.</p>
736
+
<p>The example presented here is derived from the Wikipedia page on neighbor joining
0 commit comments