File: NxsTreesBlock.html

package info (click to toggle)
libncl 2.1.18%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,344 kB
  • ctags: 3,526
  • sloc: xml: 43,716; cpp: 30,400; sh: 10,658; python: 231; makefile: 190
file content (472 lines) | stat: -rw-r--r-- 19,318 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><title>NEXUS CLASS LIBRARY: NxsTreesBlock Class</title>

<style type="text/css">
<!--
@import url(ncl.css);
.quickref {font-family: Arial, sans-serif}
.public {font-weight: bold; color: black; background: white;}
.protected {font-weight: bold; color: teal; background: white;}
.private {font-weight: bold; color: red; background: white;}
.groupheading {font-size: large; font-weight: bold;}
.classy {font-family: Arial, sans-serif; color: navy;}
.variablename {font-weight: bold; color: maroon;}
-->
</style>
</head>
<body>

<table border="1" width="100%">
<tr><td>
<table border="0" width="100%">
<tr>
<td align="left"><span class="classy">NEXUS CLASS LIBRARY</span></td>
<td align="right"><span class="classy"><a href="v2.0index.html">home</a> | <a href="classes.html">classes</a> | <a href="functions.html">functions</a></span></td>
</tr>
</table>
</td></tr>
</table>

<h1>Class NxsTreesBlock</h1>

<h2>Data Members</h2>
<a href="#defaultTree"><span class="quickref">defaultTree</span></a>, <a href="#ntrees"><span class="quickref">ntrees</span></a>, <a href="#rooted"><span class="quickref">rooted</span></a>, <a href="#taxa"><span class="quickref">taxa</span></a>, <a href="#translateList"><span class="quickref">translateList</span></a>, <a href="#treeDescription"><span class="quickref">treeDescription</span></a>, <a href="#treeName"><span class="quickref">treeName</span></a>
<h2>Member Functions</h2>
<a href="#BriefReport542"><span class="quickref">BriefReport</span></a><a href="#GetNumDefaultTree371"><span class="quickref">, GetNumDefaultTree</span></a><a href="#GetNumTrees379"><span class="quickref">, GetNumTrees</span></a><a href="#GetTranslatedTreeDescription402"><span class="quickref">, GetTranslatedTreeDescription</span></a><a href="#GetTreeDescription461"><span class="quickref">, GetTreeDescription</span></a><a href="#GetTreeName388"><span class="quickref">, GetTreeName</span></a><a href="#HandleTreeDescription65"><span class="quickref">, HandleTreeDescription</span></a><a href="#IsDefaultTree474"><span class="quickref">, IsDefaultTree</span></a><a href="#IsRootedTree490"><span class="quickref">, IsRootedTree</span></a><a href="#NxsTreesBlock25"><span class="quickref">, NxsTreesBlock</span></a><a href="#NxsTreesBlock40"><span class="quickref">, ~NxsTreesBlock</span></a><a href="#Read185"><span class="quickref">, Read</span></a><a href="#ReplaceTaxaBlockPtr52"><span class="quickref">, ReplaceTaxaBlockPtr</span></a><a href="#Report503"><span class="quickref">, Report</span></a><a href="#Reset348"><span class="quickref">, Reset</span></a>
<h2>Class Description</h2>

<p>
This class handles reading and storage for the NEXUS block TREES. It overrides the member functions Read and Reset, which are abstract virtual functions in the base class  <a href="NxsBlock.html">NxsBlock</a> . The translation table (if one is supplied) is  stored in the <span class="variablename">translateList</span>. The tree names are stored in <span class="variablename">treeName</span> and the tree descriptions in  <span class="variablename">treeDescription</span>. Information about rooting of trees is stored in <span class="variablename">rooted</span>. Note that no checking is done to  ensure that the tree descriptions are valid. The validity of the tree descriptions could be checked after the TREES block has been read (but before the next block in the file has been read) by overriding the  <a href="NxsReader.html">NxsReader</a> ::ExitingBlock member function, but no functionality for this is provided by the NCL. Below is a table showing the correspondence between the elements of a TREES block and the variables and member functions that can be used to access each piece  of information stored. <pre> NEXUS command     Data members    Member functions
 -----------------------------------------------------
 TRANSLATE         translateList

 TREE              treeName        GetTreeName
                                   GetTreeDescription
                                   GetNumTrees
                                   GetNumDefaultTree
                                   IsDefaultTree

                   rooted          IsRootedTree
 -----------------------------------------------------
</pre>


<h3>Key to symbols and colors</h3>

<p><span class="public">public</span>, <span class="protected">protected</span>, <span class="private">private</span>, <code>A</code> = abstract, <code>C</code> = constructor, <code>D</code> = destructor, <code>I</code> = inline, <code>S</code> = static, <code>V</code> = virtual, <code>F</code> = friend</p>
<p>&nbsp;</p>
<center>
<table border="5" cellpadding="1" cellspacing="0" width="95%">
<tr bgcolor="#CCCCFF">
<td><span class="groupheading">Data Members</span></td>
</table>
<table border="1" cellpadding="3" cellspacing="0" width="95%">
<tr><td>
<table  width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>&nbsp;unsigned</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="defaultTree">defaultTree</a></code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>0-offset index of default tree specified by user, or 0 if user failed to specify a default tree using an asterisk in the NEXUS data file</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table  width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>&nbsp;unsigned</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="ntrees">ntrees</a></code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>number of trees stored</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table  width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>&nbsp;NxsBoolVector</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="rooted">rooted</a></code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>stores information about rooting for each tree</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table  width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>&nbsp;<a href="NxsTaxaBlock.html">NxsTaxaBlock</a></code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="taxa">*taxa</a></code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>pointer to existing NxsTaxaBlock object</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table  width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>&nbsp;NxsStringMap</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="translateList">translateList</a></code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>storage for translation table (if any)</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table  width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>&nbsp;NxsStringVector</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="treeDescription">treeDescription</a></code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>storage for tree descriptions</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table  width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>&nbsp;NxsStringVector</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="treeName">treeName</a></code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>storage for tree names</dd></td>
</tr>
</table>
</td></tr>
</table>
</center>
<p>&nbsp;</p>
<center>
<table border="5" cellpadding="1" cellspacing="0" width="95%">
<tr bgcolor="#CCCCFF">
<td><span class="groupheading">Member Functions</span></td>
</table>
<table border="1" cellpadding="3" cellspacing="0" width="95%">
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>V</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>void</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="BriefReport542">BriefReport</a></code><code>(NxsString &s)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Outputs a brief description of this block's contents to the referenced <a href="NxsString.html">NxsString</a>. An example of the output of this  command is shown below:<pre> TREES block contains 102 trees
</pre></dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>unsigned</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="GetNumDefaultTree371">GetNumDefaultTree</a></code><code>()</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Returns the 0-offset index of the default tree, which will be 0 if there is only one tree stored or no trees  stored. If more than one tree is stored, the default tree will be the one specifically indicated by the user (using an asterisk in the data file), or 0 if the user failed to specify.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>unsigned</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="GetNumTrees379">GetNumTrees</a></code><code>()</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Returns the number of trees stored in this NxsTreesBlock object.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code><a href="NxsString.html">NxsString</a></code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="GetTranslatedTreeDescription402">GetTranslatedTreeDescription</a></code><code>(unsigned i)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Returns the description of the tree stored at position <span class="variablename">i</span> in <span class="variablename">treeName</span>. Assumes that <span class="variablename">i</span> will be in the range  [0..ntrees). Node numbers will be translated to names in the resulting tree description. Use GetTreeDescription if  translation is not desired.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code><a href="NxsString.html">NxsString</a></code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="GetTreeDescription461">GetTreeDescription</a></code><code>(unsigned i)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Returns the description of the tree stored at position <span class="variablename">i</span> in <span class="variablename">treeDescription</span>. Assumes that <span class="variablename">i</span> will be in the  range [0..<span class="variablename">ntrees</span>).</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code><a href="NxsString.html">NxsString</a></code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="GetTreeName388">GetTreeName</a></code><code>(unsigned i)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Returns the name of the tree stored at position <span class="variablename">i</span> in <span class="variablename">treeName</span>. Assumes that <span class="variablename">i</span> will be in the range  [0..<span class="variablename">ntrees</span>).</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>void</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="HandleTreeDescription65">HandleTreeDescription</a></code><code>(NxsToken &token, bool utree)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Takes control from the Read member function when a TREE or UTREE command is encountered. If a TREE command is found, the HandleTreeDescription member function is called with <span class="variablename">utree</span> equal to false. If a UTREE command is found,  <span class="variablename">utree</span> equals true.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>bool</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="IsDefaultTree474">IsDefaultTree</a></code><code>(unsigned i)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Returns true if the <span class="variablename">i</span>th tree (0-offset) is the default tree, false otherwise. Assumes that <span class="variablename">i</span> will be in the  range [0..ntrees).</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>bool</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="IsRootedTree490">IsRootedTree</a></code><code>(unsigned i)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Returns true if the <span class="variablename">i</span>th tree (0-offset) is rooted, false otherwise. Assumes that <span class="variablename">i</span> will be in the  range [0..ntrees).</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>C</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code></code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="NxsTreesBlock25">NxsTreesBlock</a></code><code>(NxsTaxaBlock *tb)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Initializes <span class="variablename">id</span> to "TREES", <span class="variablename">ntrees</span> to 0, <span class="variablename">defaultTree</span> to 0, and <span class="variablename">taxa</span> to <span class="variablename">tb</span>. Assumes <span class="variablename">tb</span> is non-NULL.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>D</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code></code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="NxsTreesBlock40">~NxsTreesBlock</a></code><code>()</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Clears <span class="variablename">translateList</span>, <span class="variablename">rooted</span>, <span class="variablename">treeName</span> and <span class="variablename">treeDescription</span>.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>V</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>void</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="Read185">Read</a></code><code>(NxsToken &token)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>This function provides the ability to read everything following the block name (which is read by the <a href="NxsReader.html">NxsReader</a>  object) to the END or ENDBLOCK command. Characters are read from the input stream <span class="variablename">in</span>. Overrides the abstract  virtual function in the base class.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>void</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="ReplaceTaxaBlockPtr52">ReplaceTaxaBlockPtr</a></code><code>(NxsTaxaBlock *tb)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Makes data member <span class="variablename">taxa</span> point to <span class="variablename">tb</span> rather than the <a href="NxsTaxaBlock.html">NxsTaxaBlock</a> object it was previously pointing to. Assumes  <span class="variablename">tb</span> is non-NULL.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>V</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>void</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="Report503">Report</a></code><code>(ostream &out)</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>This function outputs a brief report of the contents of this block. Overrides the abstract virtual function in the  base class.</dd></td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" border="0" cellpadding="1">
<tr>
<td>V</td>
<td>&nbsp;</td>
<td align="right" valign="top" width="15%"><code>void</code></td>
<td>&nbsp;</td>
<td align="left" valign="top" width="82%"><code class="public"><a name="Reset348">Reset</a></code><code>()</code></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><dd>Flushes <span class="variablename">treeName</span>, <span class="variablename">treeDescription</span>, <span class="variablename">translateList</span> and <span class="variablename">rooted</span>, and sets <span class="variablename">ntrees</span> and <span class="variablename">defaultTree</span> both to 0 in preparation for reading a new TREES block.</dd></td>
</tr>
</table>
</td></tr>
</table>
</center>