1 <?xml version="1.0" encoding="ISO-8859-1"?>
3 This file shows encodings of character state data.
6 For more discussion of the structure of the root element,
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">
17 For more discussion of the structure of the taxa
18 element, refer to 'taxa.xml'
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"/>
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"/>
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".
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.
48 <characters otus="taxa1" id="m1" xsi:type="nex:RestrictionSeqs">
51 <state id="s1" symbol="0"/>
52 <state id="s2" symbol="1"/>
54 <char id="c1" states="states3"/>
55 <char id="c2" states="states3"/>
56 <char id="c3" states="states3"/>
57 <char id="c4" states="states3"/>
61 The matrix element is a container for row elements.
64 Each row element must have an id and a reference
65 to a taxon element that precedes it.
67 <row otu="t1" id="r1">
69 Because this characters block is an instance
70 of the subclass RestrictionSeqs it contains
71 'seq' elements with 1's and 0's.
75 <row otu="t2" id="r2">
78 <row otu="t3" id="r3">
81 <row otu="t4" id="r4">
84 <row otu="t5" id="r5">
90 This characters block encodes 'standard' categorical characters,
91 marked up granularly, as cells.
93 <characters otus="taxa1" id="m2" xsi:type="nex:StandardCells" label="Categorical characters">
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.
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
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">
113 </polymorphic_state_set>
114 <uncertain_state_set symbol="5" id="s5">
117 </uncertain_state_set>
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.
124 <char states="states1" id="c1"/>
125 <char states="states1" id="c2"/>
128 In this subclass, the matrix contains rows consisting of
132 <row id="r1" otu="t1">
134 Each cell must contain a reference to the column
135 it belongs to, and to a state allowed within that
138 <cell char="c1" state="s1"/>
139 <cell char="c2" state="s2"/>
141 <row id="r2" otu="t2">
142 <cell char="c1" state="s2"/>
143 <cell char="c2" state="s2"/>
145 <row id="r3" otu="t3">
146 <cell char="c1" state="s3"/>
147 <cell char="c2" state="s4"/>
149 <row id="r4" otu="t4">
150 <cell char="c1" state="s2"/>
151 <cell char="c2" state="s3"/>
153 <row id="r5" otu="t5">
154 <cell char="c1" state="s4"/>
155 <cell char="c2" state="s1"/>
160 This example is a characters block for continuous characters, marked
161 up as individual cells.
163 <characters otus="taxa1" id="m3" xsi:type="nex:ContinuousCells" label="Continuous characters">
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.
172 <char id="c1" label="this is character 1" class="something"/>
179 <row id="r1" otu="t1">
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.
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"/>
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"/>
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"/>
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"/>
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"/>
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.
229 <characters otus="taxa1" id="c3" xsi:type="nex:DnaSeqs" label="DNA sequences">
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>
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" />
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>
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>
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>
343 RNA only differs from the previous example by using U instead of T
345 <characters otus="taxa1" id="rnaseqs4" xsi:type="nex:RnaSeqs" label="RNA sequences">
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">
355 </uncertain_state_set>
356 <uncertain_state_set id="s6" symbol="M">
359 </uncertain_state_set>
360 <uncertain_state_set id="s7" symbol="R">
363 </uncertain_state_set>
364 <uncertain_state_set id="s8" symbol="S">
367 </uncertain_state_set>
368 <uncertain_state_set id="s9" symbol="W">
371 </uncertain_state_set>
372 <uncertain_state_set id="s10" symbol="Y">
375 </uncertain_state_set>
376 <uncertain_state_set id="s11" symbol="B">
380 </uncertain_state_set>
381 <uncertain_state_set id="s12" symbol="D">
385 </uncertain_state_set>
386 <uncertain_state_set id="s13" symbol="H">
390 </uncertain_state_set>
391 <uncertain_state_set id="s14" symbol="V">
395 </uncertain_state_set>
396 <uncertain_state_set id="s15" symbol="N">
401 </uncertain_state_set>
402 <uncertain_state_set id="s16" symbol="X">
407 </uncertain_state_set>
408 <uncertain_state_set id="s17" symbol="-"/>
409 <uncertain_state_set id="s18" symbol="?">
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>
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"/>
451 <row otu="t1" id="r1">
452 <seq>ACGCUCGCAUCGCAUC</seq>
454 <row otu="t2" id="r2">
455 <seq>ACGCUCGCAUCGCAUC</seq>
457 <row otu="t3" id="r3">
458 <seq>ACGCUCGCAUCGCAUC</seq>
463 A more compact example of encoding of continuous characters as raw sequences.
465 <characters otus="taxa1" id="c5" xsi:type="nex:ContinuousSeqs" label="Continuous sequences">
474 <row id="r1" otu="t1">
475 <seq>-1.545414144070023 -2.3905621575431044 -2.9610221833467265 0.7868662069161243 0.22968509237534918</seq>
477 <row id="r2" otu="t2">
478 <seq>-1.6259836379710066 3.649352410850134 1.778885099660406 -1.2580877968480846 0.22335354995610862</seq>
480 <row id="r3" otu="t3">
481 <seq>-1.5798979984134964 2.9548251411133157 1.522005675256233 -0.8642016921755289 -0.938129801832388</seq>
483 <row id="r4" otu="t4">
484 <seq>2.7436692306788086 -0.7151148143399818 4.592207937774776 -0.6898841440534845 0.5769509574453064</seq>
486 <row id="r5" otu="t5">
487 <seq>3.1060827493657683 -1.0453787389160105 2.67416332763427 -1.4045634106692808 0.019890469925520196</seq>
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.
496 <characters otus="taxa1" id="c6" xsi:type="nex:StandardSeqs" label="Standard sequences">
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
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">
511 </polymorphic_state_set>
512 <uncertain_state_set symbol="5" id="s5">
515 </uncertain_state_set>
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.
522 <char states="states1" id="c1"/>
523 <char states="states1" id="c2"/>
526 <row id="r1" otu="t1">
529 <row id="r2" otu="t2">
532 <row id="r3" otu="t3">
535 <row id="r4" otu="t4">
538 <row id="r5" otu="t5">
543 <trees otus="tax1" id="Trees" label="TreesBlockFromXML">
545 A tree with float edges.
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"/>
567 A tree with int edges.
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"/>
589 A network with int edges.
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"/>