Skip to content

Commit

Permalink
deploy: 0fa2085
Browse files Browse the repository at this point in the history
  • Loading branch information
jordibc committed Jan 19, 2024
1 parent d44526f commit 69b7b07
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 57 deletions.
42 changes: 21 additions & 21 deletions _sources/tutorial/tutorial_trees.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ Solving multifurcations

When a tree contains a polytomy (a node with more than 2 children),
the method :func:`resolve_polytomy` can be used to convert the node
into a randomly bifurcated structure. This is really not a solution
into an arbitrarily bifurcated structure. This is really not a solution
for the polytomy but it allows to export the tree as a strictly
bifurcated newick structure, which is a requirement for some external
software.
Expand All @@ -1396,7 +1396,7 @@ of the tree intact by disabling the :attr:`recursive` flag.

Example::

t = Tree('(((a,b,c),(d,e,f,g)),(f,i,h));')
t = Tree('(((a,b,c),(d,e,f,g)),(h,i,j));')

print(t)
# ╭╴a
Expand All @@ -1406,38 +1406,38 @@ Example::
# │ ╰─┼╴e
# ─┤ ├╴f
# │ ╰╴g
# │ ╭╴f
# │ ╭╴h
# ╰─┼╴i
# ╰╴h
# ╰╴j

polynode = t.common_ancestor(['a', 'b'])
polynode.resolve_polytomy(recursive=False)
polynode.resolve_polytomy(descendants=False)

print(t)
# ╭─┬╴b
# ╭─┤ ╰╴c
# ╭─┤ ╰╴a
# ╭─┬╴a
# ╭─┤ ╰╴b
# ╭─┤ ╰╴c
# │ │ ╭╴d
# │ ╰─┼╴e
# ─┤ ├╴f
# │ ╰╴g
# │ ╭╴f
# │ ╭╴h
# ╰─┼╴i
# ╰╴h
# ╰╴j

t.resolve_polytomy(recursive=True)
t.resolve_polytomy(descendants=True)

print(t)
# ╭─┬╴b
# ╭─┤ ╰╴c
# │ ╰╴a
# ╭─┤ ╭─┬╴f
# │ │ ╭─┤ ╰╴g
# ─┤ ╰─┤ ╰╴e
# │ ╰╴d
# │ ╭─┬╴i
# ╰─┤ ╰╴h
# ╰╴f
# ╭─┬╴a
# ╭─┤ ╰╴b
# │ ╰╴c
# ╭─┤ ╭─┬╴d
# │ │ ╭─┤ ╰╴e
# ─┤ ╰─┤ ╰╴f
# │ ╰╴g
# │ ╭─┬╴h
# ╰─┤ ╰╴i
# ╰╴j


Tree rooting
Expand Down
2 changes: 1 addition & 1 deletion reference/reference_smartview.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h1><a class="toc-backref" href="#id1" role="doc-backlink">Smartview (web graphi

<dl class="py class">
<dt class="sig sig-object py" id="ete4.smartview.gui.server.TreeData">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">TreeData</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tree:</span> <span class="pre">ete4.core.tree.Tree</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name:</span> <span class="pre">str</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">style:</span> <span class="pre">ete4.smartview.renderer.treestyle.TreeStyle</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nodestyles:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_props:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exclude_props:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">layouts:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timer:</span> <span class="pre">float</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ultrametric:</span> <span class="pre">bool</span> <span class="pre">=</span> <span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initialized:</span> <span class="pre">bool</span> <span class="pre">=</span> <span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">selected:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">active:</span> <span class="pre">&lt;function</span> <span class="pre">namedtuple</span> <span class="pre">at</span> <span class="pre">0x7f0749f42a20&gt;</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">searches:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ete4/smartview/gui/server.html#TreeData"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#ete4.smartview.gui.server.TreeData" title="Link to this definition"></a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">TreeData</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tree:</span> <span class="pre">ete4.core.tree.Tree</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name:</span> <span class="pre">str</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">style:</span> <span class="pre">ete4.smartview.renderer.treestyle.TreeStyle</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nodestyles:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_props:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exclude_props:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">layouts:</span> <span class="pre">list</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timer:</span> <span class="pre">float</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ultrametric:</span> <span class="pre">bool</span> <span class="pre">=</span> <span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initialized:</span> <span class="pre">bool</span> <span class="pre">=</span> <span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">selected:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">active:</span> <span class="pre">&lt;function</span> <span class="pre">namedtuple</span> <span class="pre">at</span> <span class="pre">0x7f9fd8d42a20&gt;</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">searches:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/ete4/smartview/gui/server.html#TreeData"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#ete4.smartview.gui.server.TreeData" title="Link to this definition"></a></dt>
<dd><dl class="py method">
<dt class="sig sig-object py" id="ete4.smartview.gui.server.TreeData.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tree</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="reference_tree.html#ete4.Tree" title="ete4.core.tree.Tree"><span class="pre">Tree</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#ete4.smartview.renderer.treestyle.TreeStyle" title="ete4.smartview.renderer.treestyle.TreeStyle"><span class="pre">TreeStyle</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nodestyles</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">include_props</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exclude_props</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">layouts</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ultrametric</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">initialized</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">selected</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">active</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">namedtuple</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">searches</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#ete4.smartview.gui.server.TreeData.__init__" title="Link to this definition"></a></dt>
Expand Down
20 changes: 7 additions & 13 deletions reference/reference_tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -901,22 +901,16 @@ <h1>Tree (main class)<a class="headerlink" href="#tree-main-class" title="Link t

<dl class="py method">
<dt class="sig sig-object py" id="ete4.Tree.resolve_polytomy">
<span class="sig-name descname"><span class="pre">resolve_polytomy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">recursive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">defaults</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#ete4.Tree.resolve_polytomy" title="Link to this definition"></a></dt>
<dd><p>Resolve all polytomies under the current node, randomly.</p>
<span class="sig-name descname"><span class="pre">resolve_polytomy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">descendants</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#ete4.Tree.resolve_polytomy" title="Link to this definition"></a></dt>
<dd><p>Convert node to a series of dicotomies if it is a polytomy.</p>
<p>A polytomy is a node that has more than 2 children. This
function resolves them by creating an arbitrary dicotomic
structure among the affected nodes. It randomly modifies the
current tree topology and should only be used for
compatibility reasons (like to later use programs that reject
multifurcated nodes).</p>
function changes them to a ladderized series of dicotomic
branches. The tree topology modification is arbitrary (no
important results should depend on it!).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>recursive</strong> – If True, resolve all polytomies under this
node too. Otherwise, only the current node will be
checked and fixed.</p></li>
<li><p><strong>defaults</strong> – Dictionary of properties to use for new nodes.</p></li>
</ul>
<dd class="field-odd"><p><strong>descendants</strong> – If True, resolve all polytomies under this
node too. Otherwise, do it only for the current node.</p>
</dd>
</dl>
</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

Loading

0 comments on commit 69b7b07

Please sign in to comment.