Add tests for memory leaks and weaken for Issue #81
[bioperl-live.git] / t / data / characters+trees.nexml.xml
blob7ecdef1f36654a54a1160057a9e2b1c349ceaaea
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!--  
3     This file shows encodings of character state data.
4 -->
5 <!--
6     For more discussion of the structure of the root element,
7     refer to 'taxa.xml' 
8 -->
9 <nex:nexml 
10     version="0.8" 
11     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12     xsi:schemaLocation="http://www.nexml.org/1.0 ../../nexml/xsd/nexml.xsd"
13     xmlns:nex="http://www.nexml.org/1.0"
14     xmlns="http://www.nexml.org/1.0">         
15     
16     <!--  
17         For more discussion of the structure of the taxa
18         element, refer to 'taxa.xml'
19     -->    
20     <otus id="taxa1" label="Primary taxa block">
21         <otu id="t1" label="Homo sapiens"/>
22         <otu id="t2" label="Pan paniscus"/>
23         <otu id="t3" label="Pan troglodytes"/>
24         <otu id="t4" label="Gorilla gorilla"/>
25         <otu id="t5" label="Pongo pygmaeus"/>
26     </otus>
27     <otus id="tax1" label="TreeTaxaBlock">
28                 <otu id="t1" label="human"/>
29                 <otu id="t2" label="mouse"/>
30                 <otu id="t3" label="dog"/>
31                 <otu id="t4" label="worm"/>
32                 <otu id="t5" label="bird"/>
33         </otus>
34     <!--
35         This characters block encodes restriction site data, i.e.
36         presence (1) / absence (0) observations. Because the states
37         that can occur - and what they mean - are known, there is no
38         'format' element to define states (see below for examples of
39         that). In this example, restriction site data is encoded
40         as a sequence of characters (rather than individual cells),
41         hence we use the subclass xsi:type="RestrictionSeqs".
42         
43         All characters blocks must have an id attribute and a 
44         reference to a taxa block that precedes it. In addition,
45         it may have the same additional attributes (label, xml:base, 
46         xml:lang, xml:id, xlink:href and class) as the taxa element. 
47     -->
48     <characters otus="taxa1" id="m1" xsi:type="nex:RestrictionSeqs">
49         <format>
50               <states id="states3">
51                 <state id="s1" symbol="0"/>
52                 <state id="s2" symbol="1"/>
53               </states>
54               <char id="c1" states="states3"/>
55               <char id="c2" states="states3"/>
56               <char id="c3" states="states3"/>
57               <char id="c4" states="states3"/>
58         </format>
59         <matrix>
60         <!--
61             The matrix element is a container for row elements. 
62         -->        
63             <!--
64                 Each row element must have an id and a reference
65                 to a taxon element that precedes it. 
66             -->
67             <row otu="t1" id="r1">
68                 <!--
69                     Because this characters block is an instance
70                     of the subclass RestrictionSeqs it contains
71                     'seq' elements with 1's and 0's. 
72                 -->
73                 <seq>0101</seq>
74             </row>
75             <row otu="t2" id="r2">
76                 <seq>0101</seq>
77             </row>
78             <row otu="t3" id="r3">
79                 <seq>0101</seq>
80             </row>
81             <row otu="t4" id="r4">
82                 <seq>0101</seq>
83             </row>
84             <row otu="t5" id="r5">
85                 <seq>0101</seq>
86             </row>
87         </matrix>
88     </characters>
89     <!--
90         This characters block encodes 'standard' categorical characters,
91         marked up granularly, as cells. 
92     -->
93     <characters otus="taxa1" id="m2" xsi:type="nex:StandardCells" label="Categorical characters">
94         <!--
95             Because categorical characters in instances of this subclass
96             don't have a priori known numbers of states, they must be
97             defined using the 'format' element. 
98         -->
99         <format>
100             <!--
101                 The first elements inside a format element are stateset
102                 definitions. In this example, there is a set of four
103                 states, each tagged with an id. The symbol attribute is
104                 a shorthand token. 
105             -->
106             <states id="states1">
107                 <state id="s1" symbol="1"/>                                
108                 <state id="s2" symbol="2"/>                
109                 <state id="s3" symbol="3"/>                 
110                 <polymorphic_state_set symbol="4" id="s4">                    
111                     <member state="s1"/>
112                     <member state="s2"/>                    
113                 </polymorphic_state_set>
114                 <uncertain_state_set symbol="5" id="s5">
115                     <member state="s3"/>
116                     <member state="s1"/>
117                 </uncertain_state_set>      
118             </states>
119             <!--
120                 The matrix in this example contains two columns, both
121                 referring to the same stateset - and so cells in both
122                 columns can occupy one of four states. 
123              -->
124             <char states="states1" id="c1"/>
125             <char states="states1" id="c2"/>
126         </format>
127         <!--
128             In this subclass, the matrix contains rows consisting of
129             individual cells. 
130         -->
131         <matrix>
132             <row id="r1" otu="t1">
133                 <!--
134                     Each cell must contain a reference to the column 
135                     it belongs to, and to a state allowed within that
136                     column. 
137                  -->
138                 <cell char="c1" state="s1"/>
139                 <cell char="c2" state="s2"/>
140             </row>
141             <row id="r2" otu="t2">
142                 <cell char="c1" state="s2"/>
143                 <cell char="c2" state="s2"/>
144             </row>
145             <row id="r3" otu="t3">
146                 <cell char="c1" state="s3"/>
147                 <cell char="c2" state="s4"/>
148             </row>
149             <row id="r4" otu="t4">
150                 <cell char="c1" state="s2"/>
151                 <cell char="c2" state="s3"/>
152             </row>
153             <row id="r5" otu="t5">
154                 <cell char="c1" state="s4"/>
155                 <cell char="c2" state="s1"/>
156             </row>
157         </matrix>
158     </characters>
159     <!--
160         This example is a characters block for continuous characters, marked
161         up as individual cells. 
162     -->
163     <characters otus="taxa1" id="m3" xsi:type="nex:ContinuousCells" label="Continuous characters">
164         <format>
165             <!--
166                 Because in this subclass, characters are marked up granularly -
167                 as cells - we must define the columns these cells belong to.
168                 Because this is continuous data, we don't (can't) define the
169                 states cells in these columns may occupy, hence there are no
170                 'states' elements in this subclass.  
171             -->
172             <char id="c1" label="this is character 1" class="something"/>
173             <char id="c2"/>
174             <char id="c3"/>
175             <char id="c4"/>
176             <char id="c5"/>
177         </format>
178         <matrix>
179             <row id="r1" otu="t1">
180                 <!--  
181                     In this subclass, the 'state' attribute holds the raw
182                     value of the cell (i.e. a floating point number), not
183                     a reference to a state defined previously.
184                 -->
185                 <cell char="c1" state="-1.545414144070023"/>
186                 <cell char="c2" state="-2.3905621575431044"/>
187                 <cell char="c3" state="-2.9610221833467265"/>
188                 <cell char="c4" state="0.7868662069161243"/>
189                 <cell char="c5" state="0.22968509237534918"/>
190             </row>
191             <row id="r2" otu="t2">
192                 <cell char="c1" state="-1.6259836379710066"/>
193                 <cell char="c2" state="3.649352410850134"/>
194                 <cell char="c3" state="1.778885099660406"/>
195                 <cell char="c4" state="-1.2580877968480846"/>
196                 <cell char="c5" state="0.22335354995610862"/>
197             </row>
198             <row id="r3" otu="t3">
199                 <cell char="c1" state="-1.5798979984134964"/>
200                 <cell char="c2" state="2.9548251411133157"/>
201                 <cell char="c3" state="1.522005675256233"/>
202                 <cell char="c4" state="-0.8642016921755289"/>
203                 <cell char="c5" state="-0.938129801832388"/>
204             </row>
205             <row id="r4" otu="t4">
206                 <cell char="c1" state="2.7436692306788086"/>
207                 <cell char="c2" state="-0.7151148143399818"/>
208                 <cell char="c3" state="4.592207937774776"/>
209                 <cell char="c4" state="-0.6898841440534845"/>
210                 <cell char="c5" state="0.5769509574453064"/>
211             </row>
212             <row id="r5" otu="t5">
213                 <cell char="c1" state="3.1060827493657683"/>
214                 <cell char="c2" state="-1.0453787389160105"/>
215                 <cell char="c3" state="2.67416332763427"/>
216                 <cell char="c4" state="-1.4045634106692808"/>
217                 <cell char="c5" state="0.019890469925520196"/>
218             </row>
219         </matrix>
220     </characters>
221     <!--
222         This subclass encodes DNA as sequences (not cells). Like the restriction
223         site data block shown above, the states are known (being IUPAC single
224         character nucleotide symbols), hence there is no 'format' element. In 
225         addition to the IUPAC symbols, '-' is used for gaps, '?' is used for
226         missing. Spaces are allowed (so that long lines can be broken up, some
227         parsers might otherwise complain) but have no meaning.
228     -->
229     <characters otus="taxa1" id="c3" xsi:type="nex:DnaSeqs" label="DNA sequences">
230     <format>
231         <states id="states7">
232                 <state id="s1" symbol="A" />
233                 <state id="s2" symbol="C" />
234                 <state id="s3" symbol="G" />
235                 <state id="s4" symbol="T" />
236                 <uncertain_state_set id="s5" symbol="K">
237                         <member state="s3" />
238                         <member state="s4" />
239                 </uncertain_state_set>
240                 <uncertain_state_set id="s6" symbol="M">
241                         <member state="s1" />
242                         <member state="s2" />
243                 </uncertain_state_set>
244                 <uncertain_state_set id="s7" symbol="R">
245                         <member state="s1" />
246                         <member state="s3" />
247                 </uncertain_state_set>
248                 <uncertain_state_set id="s8" symbol="S">
249                         <member state="s2" />
250                         <member state="s3" />
251                 </uncertain_state_set>
252                 <uncertain_state_set id="s9" symbol="W">
253                         <member state="s1" />
254                         <member state="s4" />
255                 </uncertain_state_set>
256                 <uncertain_state_set id="s10" symbol="Y">
257                         <member state="s2" />
258                         <member state="s4" />
259                 </uncertain_state_set>
260                 <uncertain_state_set id="s11" symbol="B">
261                         <member state="s2" />
262                         <member state="s3" />
263                         <member state="s4" />
264                 </uncertain_state_set>
265                 <uncertain_state_set id="s12" symbol="D">
266                         <member state="s1" />
267                         <member state="s3" />
268                         <member state="s4" />
269                 </uncertain_state_set>
270                 <uncertain_state_set id="s13" symbol="H">
271                         <member state="s1" />
272                         <member state="s2" />
273                         <member state="s4" />
274                 </uncertain_state_set>
275                 <uncertain_state_set id="s14" symbol="V">
276                         <member state="s1" />
277                         <member state="s2" />
278                         <member state="s3" />
279                 </uncertain_state_set>
280                 <uncertain_state_set id="s15" symbol="N">
281                         <member state="s3" />
282                         <member state="s1" />
283                         <member state="s4" />
284                         <member state="s2" />
285                 </uncertain_state_set>
286                 <uncertain_state_set id="s16" symbol="X">
287                         <member state="s3" />
288                         <member state="s1" />
289                         <member state="s4" />
290                         <member state="s2" />
291                 </uncertain_state_set>
292                 <uncertain_state_set id="s17" symbol="-" />
293                 <uncertain_state_set id="s18" symbol="?">
294                         <member state="s1" />
295                         <member state="s2" />
296                         <member state="s3" />
297                         <member state="s4" />
298                         <member state="s5" />
299                         <member state="s6" />
300                         <member state="s7" />
301                         <member state="s8" />
302                         <member state="s9" />
303                         <member state="s10" />
304                         <member state="s11" />
305                         <member state="s12" />
306                         <member state="s13" />
307                         <member state="s14" />
308                         <member state="s15" />
309                         <member state="s16" />
310                         <member state="s17" />
311                 </uncertain_state_set>
312         </states>
313         <char id="c1" states="states7" />
314         <char id="c2" states="states7" />
315         <char id="c3" states="states7" />
316         <char id="c4" states="states7" />
317         <char id="c5" states="states7" />
318         <char id="c6" states="states7" />
319         <char id="c7" states="states7" />
320         <char id="c8" states="states7" />
321         <char id="c9" states="states7" />
322         <char id="c10" states="states7" />
323         <char id="c11" states="states7" />
324         <char id="c12" states="states7" />
325         <char id="c13" states="states7" />
326         <char id="c14" states="states7" />
327         <char id="c15" states="states7" />
328         <char id="c16" states="states7" />
329     </format>
330     <matrix>
331             <row otu="t1" id="r1" label="dna_seq_1">
332                 <seq>A C G C T C G C A T C G C A T C</seq>
333             </row>
334             <row otu="t2" id="r2" label="dna_seq_2">
335                 <seq>A C G C T C G C A T C G C A T T</seq>
336             </row>
337             <row otu="t3" id="r3" label="dna_seq_3">
338                 <seq>A C G C T C G C A T C G C A T G</seq>
339             </row>
340         </matrix>
341     </characters>
342     <!--
343         RNA only differs from the previous example by using U instead of T 
344     -->
345     <characters otus="taxa1" id="rnaseqs4" xsi:type="nex:RnaSeqs" label="RNA sequences">
346     <format>
347       <states id="states3">
348         <state id="s1" symbol="A"/>
349         <state id="s2" symbol="C"/>
350         <state id="s3" symbol="G"/>
351         <state id="s4" symbol="U"/>
352         <uncertain_state_set id="s5" symbol="K">
353           <member state="s3"/>
354           <member state="s4"/>
355         </uncertain_state_set>
356         <uncertain_state_set id="s6" symbol="M">
357           <member state="s1"/>
358           <member state="s2"/>
359         </uncertain_state_set>
360         <uncertain_state_set id="s7" symbol="R">
361           <member state="s1"/>
362           <member state="s3"/>
363         </uncertain_state_set>
364         <uncertain_state_set id="s8" symbol="S">
365           <member state="s2"/>
366           <member state="s3"/>
367         </uncertain_state_set>
368         <uncertain_state_set id="s9" symbol="W">
369           <member state="s1"/>
370           <member state="s4"/>
371         </uncertain_state_set>
372         <uncertain_state_set id="s10" symbol="Y">
373           <member state="s2"/>
374           <member state="s4"/>
375         </uncertain_state_set>
376         <uncertain_state_set id="s11" symbol="B">
377           <member state="s2"/>
378           <member state="s3"/>
379           <member state="s4"/>
380         </uncertain_state_set>
381         <uncertain_state_set id="s12" symbol="D">
382           <member state="s1"/>
383           <member state="s3"/>
384           <member state="s4"/>
385         </uncertain_state_set>
386         <uncertain_state_set id="s13" symbol="H">
387           <member state="s1"/>
388           <member state="s2"/>
389           <member state="s4"/>
390         </uncertain_state_set>
391         <uncertain_state_set id="s14" symbol="V">
392           <member state="s1"/>
393           <member state="s2"/>
394           <member state="s3"/>
395         </uncertain_state_set>
396         <uncertain_state_set id="s15" symbol="N">
397           <member state="s3"/>
398           <member state="s1"/>
399           <member state="s4"/>
400           <member state="s2"/>
401         </uncertain_state_set>
402         <uncertain_state_set id="s16" symbol="X">
403           <member state="s3"/>
404           <member state="s1"/>
405           <member state="s4"/>
406           <member state="s2"/>
407         </uncertain_state_set>
408         <uncertain_state_set id="s17" symbol="-"/>
409         <uncertain_state_set id="s18" symbol="?">
410           <member state="s1"/>
411           <member state="s2"/>
412           <member state="s3"/>
413           <member state="s4"/>
414           <member state="s5"/>
415           <member state="s6"/>
416           <member state="s7"/>
417           <member state="s8"/>
418           <member state="s9"/>
419           <member state="s10"/>
420           <member state="s11"/>
421           <member state="s12"/>
422           <member state="s13"/>
423           <member state="s14"/>
424           <member state="s15"/>
425           <member state="s16"/>
426           <member state="s17"/>
427         </uncertain_state_set>
428       </states>
429       <char id="c1" states="states3"/>
430       <char id="c2" states="states3"/>
431       <char id="c3" states="states3"/>
432       <char id="c4" states="states3"/>
433       <char id="c5" states="states3"/>
434       <char id="c6" states="states3"/>
435       <char id="c7" states="states3"/>
436       <char id="c8" states="states3"/>
437       <char id="c9" states="states3"/>
438       <char id="c10" states="states3"/>
439       <char id="c11" states="states3"/>
440       <char id="c12" states="states3"/>
441       <char id="c13" states="states3"/>
442       <char id="c14" states="states3"/>
443       <char id="c15" states="states3"/>
444       <char id="c16" states="states3"/>
445       <char id="c17" states="states3"/>
446       <char id="c18" states="states3"/>
447       <char id="c19" states="states3"/>
448       <char id="c20" states="states3"/>    
449       </format>
450         <matrix>
451             <row otu="t1" id="r1">
452                 <seq>ACGCUCGCAUCGCAUC</seq>
453             </row>
454             <row otu="t2" id="r2">
455                 <seq>ACGCUCGCAUCGCAUC</seq>
456             </row>
457             <row otu="t3" id="r3">
458                 <seq>ACGCUCGCAUCGCAUC</seq>
459             </row>
460         </matrix>
461     </characters>
462     <!-- 
463         A more compact example of encoding of continuous characters as raw sequences.    
464     -->
465     <characters otus="taxa1" id="c5" xsi:type="nex:ContinuousSeqs" label="Continuous sequences">
466             <format>
467               <char id="c1"/>
468               <char id="c2"/>
469               <char id="c3"/>
470               <char id="c4"/>
471               <char id="c5"/>                 
472             </format>    
473         <matrix>
474             <row id="r1" otu="t1">
475                 <seq>-1.545414144070023 -2.3905621575431044 -2.9610221833467265 0.7868662069161243 0.22968509237534918</seq>
476             </row>
477             <row id="r2" otu="t2">
478                 <seq>-1.6259836379710066 3.649352410850134 1.778885099660406 -1.2580877968480846 0.22335354995610862</seq>
479             </row>
480             <row id="r3" otu="t3">
481                 <seq>-1.5798979984134964 2.9548251411133157 1.522005675256233 -0.8642016921755289 -0.938129801832388</seq>
482             </row>
483             <row id="r4" otu="t4">
484                 <seq>2.7436692306788086 -0.7151148143399818 4.592207937774776 -0.6898841440534845 0.5769509574453064</seq>
485             </row>
486             <row id="r5" otu="t5">
487                 <seq>3.1060827493657683 -1.0453787389160105 2.67416332763427 -1.4045634106692808 0.019890469925520196</seq>
488             </row>
489         </matrix>
490     </characters>
491     <!-- 
492         A more compact example of encoding of standard data. Note that the symbols used here
493         are integers (also above 9) and so characters must be space-separated. The symbols used
494         here are the same as the symbol attributes used in characters block m2, earlier.    
495     -->
496     <characters otus="taxa1" id="c6" xsi:type="nex:StandardSeqs" label="Standard sequences">
497         <format>
498             <!--
499                 The first elements inside a format element are stateset
500                 definitions. In this example, there is a set of four
501                 states, each tagged with an id. The symbol attribute is
502                 a shorthand token. 
503             -->
504             <states id="states1">
505                 <state id="s1" symbol="1"/>                                
506                 <state id="s2" symbol="2"/>                
507                 <state id="s3" symbol="3"/>                 
508                 <polymorphic_state_set symbol="4" id="s4">                    
509                     <member state="s1"/>
510                     <member state="s2"/>                    
511                 </polymorphic_state_set>
512                 <uncertain_state_set symbol="5" id="s5">
513                     <member state="s3"/>
514                     <member state="s1"/>
515                 </uncertain_state_set>      
516             </states>
517             <!--
518                 The matrix in this example contains two columns, both
519                 referring to the same stateset - and so cells in both
520                 columns can occupy one of four states. 
521              -->
522             <char states="states1" id="c1"/>
523             <char states="states1" id="c2"/>
524         </format>    
525         <matrix>
526             <row id="r1" otu="t1">
527                 <seq>1 2</seq>
528             </row>
529             <row id="r2" otu="t2">
530                 <seq>2 2</seq>
531             </row>
532             <row id="r3" otu="t3">
533                 <seq>3 4</seq>
534             </row>
535             <row id="r4" otu="t4">
536                 <seq>2 3</seq>
537             </row>
538             <row id="r5" otu="t5">
539                 <seq>4 1</seq>
540             </row>
541         </matrix>
542     </characters>
543     <trees otus="tax1" id="Trees" label="TreesBlockFromXML">
544                 <!--
545                         A tree with float edges. 
546                 -->
547                 <tree id="tree1" xsi:type="nex:FloatTree" label="tree1">
548                         <node id="n1" label="n1" root="true"/>
549                         <node id="n2" label="n2" otu="t1"/>
550                         <node id="n3" label="n3"/>
551                         <node id="n4" label="n4"/>
552                         <node id="n5" label="n5" otu="t3"/>
553                         <node id="n6" label="n6" otu="t2"/>
554                         <node id="n7" label="n7"/>
555                         <node id="n8" label="n8" otu="t5"/>
556                         <node id="n9" label="n9" otu="t4"/>
557                         <edge source="n1" target="n3" id="e1" length="0.34534"/>                        
558                         <edge source="n1" target="n2" id="e2" length="0.4353"/>
559                         <edge source="n3" target="n4" id="e3" length="0.324"/>
560                         <edge source="n3" target="n7" id="e4" length="0.3247"/>
561                         <edge source="n4" target="n5" id="e5" length="0.234"/>
562                         <edge source="n4" target="n6" id="e6" length="0.3243"/>
563                         <edge source="n7" target="n8" id="e7" length="0.32443"/>
564                         <edge source="n7" target="n9" id="e8" length="0.2342"/>
565                 </tree>
566                 <!--  
567                         A tree with int edges.
568                 -->
569                 <tree id="tree2" xsi:type="nex:IntTree" label="tree2">
570                         <node id="n1" label="n1"/>
571                         <node id="n2" label="n2" otu="t1"/>
572                         <node id="n3" label="n3"/>
573                         <node id="n4" label="n4"/>
574                         <node id="n5" label="n5" otu="t3"/>
575                         <node id="n6" label="n6" otu="t2"/>
576                         <node id="n7" label="n7"/>
577                         <node id="n8" label="n8" otu="t5"/>
578                         <node id="n9" label="n9" otu="t4"/>
579                         <edge source="n1" target="n3" id="e1" length="1"/>                      
580                         <edge source="n1" target="n2" id="e2" length="2"/>
581                         <edge source="n3" target="n4" id="e3" length="3"/>
582                         <edge source="n3" target="n7" id="e4" length="1"/>
583                         <edge source="n4" target="n5" id="e5" length="2"/>
584                         <edge source="n4" target="n6" id="e6" length="1"/>
585                         <edge source="n7" target="n8" id="e7" length="1"/>
586                         <edge source="n7" target="n9" id="e8" length="1"/>
587                 </tree> 
588                 <!--  
589                         A network with int edges.
590                 -->
591                 <network id="tree3" xsi:type="nex:IntNetwork" label="tree3">
592                         <node id="n1" label="n1"/>
593                         <node id="n2" label="n2" otu="t1"/>
594                         <node id="n3" label="n3"/>
595                         <node id="n4" label="n4"/>
596                         <node id="n5" label="n5" otu="t3"/>
597                         <node id="n6" label="n6" otu="t2"/>
598                         <node id="n7" label="n7"/>
599                         <node id="n8" label="n8" otu="t5"/>
600                         <node id="n9" label="n9" otu="t4"/>
601                         <edge source="n1" target="n3" id="e1" length="1"/>                      
602                         <edge source="n1" target="n2" id="e2" length="2"/>
603                         <edge source="n3" target="n4" id="e3" length="3"/>
604                         <edge source="n3" target="n7" id="e4" length="1"/>
605                         <edge source="n4" target="n5" id="e5" length="2"/>
606                         <edge source="n4" target="n6" id="e6" length="1"/>
607                         <edge source="n7" target="n6" id="e7" length="1"/> <!-- extra edge -->
608                         <edge source="n7" target="n8" id="e9" length="1"/>
609                         <edge source="n7" target="n9" id="e8" length="1"/>
610                 </network>                              
611         </trees>
612 </nex:nexml>