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
<p>In the representation that we have chosen, a <aclass="reference internal" href="../reference/reference_tree.html#ete4.Tree" title="ete4.Tree"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tree</span></code></a> is a
51
+
<p>In the representation that we have chosen, a <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tree</span></code> is a
52
52
structure with some content (internally stored in a dictionary
53
53
<codeclass="docutils literal notranslate"><spanclass="pre">props</span></code> of properties) and a list of <codeclass="docutils literal notranslate"><spanclass="pre">children</span></code>, which can be
54
54
viewed as trees themselves. It can have a parent (<codeclass="docutils literal notranslate"><spanclass="pre">up</span></code>), which is
<h2>Size<aclass="headerlink" href="#size" title="Link to this heading">¶</a></h2>
67
-
<p>A <aclass="reference internal" href="../reference/reference_tree.html#ete4.Tree" title="ete4.Tree"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tree</span></code></a> also has a <codeclass="docutils literal notranslate"><spanclass="pre">size</span></code>, which is a tuple <codeclass="docutils literal notranslate"><spanclass="pre">(dx,</span><spanclass="pre">dy)</span></code>
67
+
<p>A <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tree</span></code> also has a <codeclass="docutils literal notranslate"><spanclass="pre">size</span></code>, which is a tuple <codeclass="docutils literal notranslate"><spanclass="pre">(dx,</span><spanclass="pre">dy)</span></code>
68
68
formed by the distance to its further leaf (including its own length),
69
69
and the total number of descendant leaves.</p>
70
70
<p>This concept is exploited when drawing with different representations,
Copy file name to clipboardExpand all lines: reference/reference_parsers.html
+92Lines changed: 92 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,98 @@ <h1>Parsers<a class="headerlink" href="#parsers" title="Link to this heading">¶
40
40
<sectionid="module-ete4.parser.newick">
41
41
<spanid="newick"></span><h2>Newick<aclass="headerlink" href="#module-ete4.parser.newick" title="Link to this heading">¶</a></h2>
42
42
<p>Parser for trees represented in newick format.</p>
43
+
<p>The main functions are <codeclass="docutils literal notranslate"><spanclass="pre">loads()</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">dumps()</span></code>, which read/write a tree
44
+
from/to its newick text representation.</p>
45
+
<p>When reading a newick file, the argument <codeclass="docutils literal notranslate"><spanclass="pre">parser=...</span></code> specifies
46
+
which kind of parser to use.</p>
47
+
<p>The classical ones in ete are the following:</p>
<p>There are other valid values for <codeclass="docutils literal notranslate"><spanclass="pre">parser</span></code>:</p>
113
+
<ulclass="simple">
114
+
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">'name'</span></code>, same as 1</p></li>
115
+
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">'support'</span></code>, same as 0</p></li>
116
+
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">'multisupport'</span></code>, internal nodes look like <codeclass="docutils literal notranslate"><spanclass="pre">((X:5)80/100:7)...</span></code>, that is,
117
+
have multiple values of support separated by <codeclass="docutils literal notranslate"><spanclass="pre">/</span></code></p></li>
118
+
</ul>
119
+
<p>More generally, <codeclass="docutils literal notranslate"><spanclass="pre">parser</span></code> can be a dictionary that specifies in
120
+
detail how to read/write each field. It must say, for leaf and internal
121
+
nodes, what <codeclass="docutils literal notranslate"><spanclass="pre">p0:p1</span></code> means (which properties they are, including how
122
+
to read and write them). For example, the default parser looks like:</p>
<p>where <codeclass="docutils literal notranslate"><spanclass="pre">NAME</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">DIST</span></code> are “property dicts”, that have all the
130
+
information for a property (<codeclass="docutils literal notranslate"><spanclass="pre">pname</span></code>) to know which function to apply
131
+
to read/write from/to a string. For example, <codeclass="docutils literal notranslate"><spanclass="pre">DIST</span></code> is:</p>
<emclass="property"><spanclass="k"><spanclass="pre">exception</span></span><spanclass="w"></span></em><spanclass="sig-name descname"><spanclass="pre">NewickError</span></span><aclass="headerlink" href="#ete4.parser.newick.NewickError" title="Link to this definition">¶</a></dt>
<p>Extends the standard <aclass="reference internal" href="reference_tree.html#ete4.Tree" title="ete4.Tree"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tree</span></code></a> instance by adding
47
+
<p>Extends the standard <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Tree</span></code> instance by adding
48
48
specific properties and methods to work with phylogentic trees.</p>
0 commit comments