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/2009 ../xsd/nexml.xsd"
13 xmlns:nex="http://www.nexml.org/2009"
14 xmlns="http://www.nexml.org/2009">
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"/>
28 This characters block encodes restriction site data, i.e.
29 presence (1) / absence (0) observations. Because the states
30 that can occur - and what they mean - are known, there is no
31 'format' element to define states (see below for examples of
32 that). In this example, restriction site data is encoded
33 as a sequence of characters (rather than individual cells),
34 hence we use the subclass xsi:type="RestrictionSeqs".
36 All characters blocks must have an id attribute and a
37 reference to a taxa block that precedes it. In addition,
38 it may have the same additional attributes (label, xml:base,
39 xml:lang, xml:id, xlink:href and class) as the taxa element.
41 <characters otus="taxa1" id="m1" xsi:type="nex:RestrictionSeqs" label="Restriction site sequences">
43 <states id="RestrictionSiteStateSet">
44 <state id="Absent" symbol="0"/>
45 <state id="Present" symbol="1"/>
47 <char id="Site1" states="RestrictionSiteStateSet"/>
48 <char id="Site2" states="RestrictionSiteStateSet"/>
49 <char id="Site3" states="RestrictionSiteStateSet"/>
50 <char id="Site4" states="RestrictionSiteStateSet"/>
54 The matrix element is a container for row elements.
57 Each row element must have an id and a reference
58 to a taxon element that precedes it.
60 <row otu="t1" id="RestrictionSiteRow1">
62 Because this characters block is an instance
63 of the subclass RestrictionSeqs it contains
64 'seq' elements with 1's and 0's.
68 <row otu="t2" id="RestrictionSiteRow2">
71 <row otu="t3" id="RestrictionSiteRow3">
74 <row otu="t4" id="RestrictionSiteRow4">
77 <row otu="t5" id="RestrictionSiteRow5">
83 This characters block encodes 'standard' categorical characters,
84 marked up granularly, as cells.
86 <characters otus="taxa1" id="m2" xsi:type="nex:StandardCells" label="Categorical characters">
88 Because categorical characters in instances of this subclass
89 don't have a priori known numbers of states, they must be
90 defined using the 'format' element.
94 The first elements inside a format element are stateset
95 definitions. In this example, there is a set of four
96 states, each tagged with an id. The symbol attribute is
97 a shorthand token that would be used when serializing to
100 <states id="StandardCategoricalStateSet1">
101 <state id="StandardCategoricalState1" symbol="1"/>
102 <state id="StandardCategoricalState2" symbol="2"/>
103 <state id="StandardCategoricalState3" symbol="3"/>
104 <polymorphic_state_set symbol="4" id="StandardCategoricalState4">
105 <member state="StandardCategoricalState2"/>
106 <member state="StandardCategoricalState3"/>
107 </polymorphic_state_set>
108 <uncertain_state_set symbol="5" id="StandardCategoricalState5">
109 <member state="StandardCategoricalState1"/>
110 <member state="StandardCategoricalState2"/>
111 </uncertain_state_set>
114 The matrix in this example contains two columns, both
115 referring to the same stateset - and so cells in both
116 columns can occupy one of four states.
118 <char states="StandardCategoricalStateSet1" id="StandardCharacter1"/>
119 <char states="StandardCategoricalStateSet1" id="StandardCharacter2"/>
122 In this subclass, the matrix contains rows consisting of
126 <row id="StandardCategoricalStateCellsRow1" otu="t1">
128 Each cell must contain a reference to the column
129 it belongs to, and to a state allowed within that
132 <cell char="StandardCharacter1" state="StandardCategoricalState1"/>
133 <cell char="StandardCharacter2" state="StandardCategoricalState2"/>
135 <row id="StandardCategoricalStateCellsRow2" otu="t2">
136 <cell char="StandardCharacter1" state="StandardCategoricalState2"/>
137 <cell char="StandardCharacter2" state="StandardCategoricalState2"/>
139 <row id="StandardCategoricalStateCellsRow3" otu="t3">
140 <cell char="StandardCharacter1" state="StandardCategoricalState3"/>
141 <cell char="StandardCharacter2" state="StandardCategoricalState4"/>
143 <row id="StandardCategoricalStateCellsRow4" otu="t4">
144 <cell char="StandardCharacter1" state="StandardCategoricalState2"/>
145 <cell char="StandardCharacter2" state="StandardCategoricalState3"/>
147 <row id="StandardCategoricalStateCellsRow5" otu="t5">
148 <cell char="StandardCharacter1" state="StandardCategoricalState4"/>
149 <cell char="StandardCharacter2" state="StandardCategoricalState1"/>
154 This example is a characters block for continuous characters, marked
155 up as individual cells.
157 <characters otus="taxa1" id="m3" xsi:type="nex:ContinuousCells" label="Continuous characters">
160 Because in this subclass, characters are marked up granularly -
161 as cells - we must define the columns these cells belong to.
162 Because this is continuous data, we don't (can't) define the
163 states cells in these columns may occupy, hence there are no
164 'states' elements in this subclass.
166 <char id="ContinuousCharacter1" label="this is character 1"/>
167 <char id="ContinuousCharacter2"/>
168 <char id="ContinuousCharacter3"/>
169 <char id="ContinuousCharacter4"/>
170 <char id="ContinuousCharacter5"/>
173 <row id="ContinuousCellsRow1" otu="t1">
175 In this subclass, the 'state' attribute holds the raw
176 value of the cell (i.e. a floating point number), not
177 a reference to a state defined previously.
179 <cell char="ContinuousCharacter1" state="-1.545414144070023"/>
180 <cell char="ContinuousCharacter2" state="-2.3905621575431044"/>
181 <cell char="ContinuousCharacter3" state="-2.9610221833467265"/>
182 <cell char="ContinuousCharacter4" state="0.7868662069161243"/>
183 <cell char="ContinuousCharacter5" state="0.22968509237534918"/>
185 <row id="ContinuousCellsRow2" otu="t2">
186 <cell char="ContinuousCharacter1" state="-1.6259836379710066"/>
187 <cell char="ContinuousCharacter2" state="3.649352410850134"/>
188 <cell char="ContinuousCharacter3" state="1.778885099660406"/>
189 <cell char="ContinuousCharacter4" state="-1.2580877968480846"/>
190 <cell char="ContinuousCharacter5" state="0.22335354995610862"/>
192 <row id="ContinuousCellsRow3" otu="t3">
193 <cell char="ContinuousCharacter1" state="-1.5798979984134964"/>
194 <cell char="ContinuousCharacter2" state="2.9548251411133157"/>
195 <cell char="ContinuousCharacter3" state="1.522005675256233"/>
196 <cell char="ContinuousCharacter4" state="-0.8642016921755289"/>
197 <cell char="ContinuousCharacter5" state="-0.938129801832388"/>
199 <row id="ContinuousCellsRow4" otu="t4">
200 <cell char="ContinuousCharacter1" state="2.7436692306788086"/>
201 <cell char="ContinuousCharacter2" state="-0.7151148143399818"/>
202 <cell char="ContinuousCharacter3" state="4.592207937774776"/>
203 <cell char="ContinuousCharacter4" state="-0.6898841440534845"/>
204 <cell char="ContinuousCharacter5" state="0.5769509574453064"/>
206 <row id="ContinuousCellsRow5" otu="t5">
207 <cell char="ContinuousCharacter1" state="3.1060827493657683"/>
208 <cell char="ContinuousCharacter2" state="-1.0453787389160105"/>
209 <cell char="ContinuousCharacter3" state="2.67416332763427"/>
210 <cell char="ContinuousCharacter4" state="-1.4045634106692808"/>
211 <cell char="ContinuousCharacter5" state="0.019890469925520196"/>
216 This subclass encodes DNA as sequences (not cells). Like the restriction
217 site data block shown above, the states are known (being IUPAC single
218 character nucleotide symbols), hence there is no 'format' element. In
219 addition to the IUPAC symbols, '-' is used for gaps, '?' is used for
220 missing. Spaces are allowed (so that long lines can be broken up, some
221 parsers might otherwise complain) but have no meaning.
223 <characters otus="taxa1" id="characters3" xsi:type="nex:DnaSeqs" label="DNA sequences">
225 <states id="IUPACDNAStateSet1">
226 <state id="NucA" symbol="A" />
227 <state id="NucC" symbol="C" />
228 <state id="NucG" symbol="G" />
229 <state id="NucT" symbol="T" />
230 <uncertain_state_set id="SymK" symbol="K">
231 <member state="NucG" />
232 <member state="NucT" />
233 </uncertain_state_set>
234 <uncertain_state_set id="SymM" symbol="M">
235 <member state="NucA" />
236 <member state="NucC" />
237 </uncertain_state_set>
238 <uncertain_state_set id="SymR" symbol="R">
239 <member state="NucA" />
240 <member state="NucG" />
241 </uncertain_state_set>
242 <uncertain_state_set id="SymS" symbol="S">
243 <member state="NucC" />
244 <member state="NucG" />
245 </uncertain_state_set>
246 <uncertain_state_set id="SymW" symbol="W">
247 <member state="NucA" />
248 <member state="NucT" />
249 </uncertain_state_set>
250 <uncertain_state_set id="SymY" symbol="Y">
251 <member state="NucC" />
252 <member state="NucT" />
253 </uncertain_state_set>
254 <uncertain_state_set id="SymB" symbol="B">
255 <member state="NucC" />
256 <member state="NucG" />
257 <member state="NucT" />
258 </uncertain_state_set>
259 <uncertain_state_set id="SymD" symbol="D">
260 <member state="NucA" />
261 <member state="NucG" />
262 <member state="NucT" />
263 </uncertain_state_set>
264 <uncertain_state_set id="SymH" symbol="H">
265 <member state="NucA" />
266 <member state="NucC" />
267 <member state="NucT" />
268 </uncertain_state_set>
269 <uncertain_state_set id="SymV" symbol="V">
270 <member state="NucA" />
271 <member state="NucC" />
272 <member state="NucG" />
273 </uncertain_state_set>
274 <uncertain_state_set id="SymN" symbol="N">
275 <member state="NucA" />
276 <member state="NucC" />
277 <member state="NucG" />
278 <member state="NucT" />
279 </uncertain_state_set>
280 <uncertain_state_set id="SymX" symbol="X">
281 <member state="NucA" />
282 <member state="NucC" />
283 <member state="NucG" />
284 <member state="NucT" />
285 </uncertain_state_set>
286 <uncertain_state_set id="SymGap" symbol="-" />
287 <uncertain_state_set id="SymMiss" symbol="?">
288 <member state="NucA" />
289 <member state="NucC" />
290 <member state="NucG" />
291 <member state="NucT" />
292 <member state="SymK" />
293 <member state="SymM" />
294 <member state="SymR" />
295 <member state="SymS" />
296 <member state="SymW" />
297 <member state="SymY" />
298 <member state="SymB" />
299 <member state="SymD" />
300 <member state="SymH" />
301 <member state="SymV" />
302 <member state="SymN" />
303 <member state="SymX" />
304 <member state="SymGap" />
305 </uncertain_state_set>
307 <char id="ResidueCol1" states="IUPACDNAStateSet1" />
308 <char id="ResidueCol2" states="IUPACDNAStateSet1" />
309 <char id="ResidueCol3" states="IUPACDNAStateSet1" />
310 <char id="ResidueCol4" states="IUPACDNAStateSet1" />
311 <char id="ResidueCol5" states="IUPACDNAStateSet1" />
312 <char id="ResidueCol6" states="IUPACDNAStateSet1" />
313 <char id="ResidueCol7" states="IUPACDNAStateSet1" />
314 <char id="ResidueCol8" states="IUPACDNAStateSet1" />
315 <char id="ResidueCol9" states="IUPACDNAStateSet1" />
316 <char id="ResidueCol10" states="IUPACDNAStateSet1" />
317 <char id="ResidueCol11" states="IUPACDNAStateSet1" />
318 <char id="ResidueCol12" states="IUPACDNAStateSet1" />
319 <char id="ResidueCol13" states="IUPACDNAStateSet1" />
320 <char id="ResidueCol14" states="IUPACDNAStateSet1" />
321 <char id="ResidueCol15" states="IUPACDNAStateSet1" />
322 <char id="ResidueCol16" states="IUPACDNAStateSet1" />
325 <row otu="t1" id="DNASequence1"><seq>A C G C T C G C A T C G C A T C</seq></row>
326 <row otu="t2" id="DNASequence2"><seq>A C G C T C G C A T C G C A T C</seq></row>
327 <row otu="t3" id="DNASequence3"><seq>A C G C T C G C A T C G C A T C</seq></row>
331 RNA only differs from the previous example by using U instead of T
333 <characters otus="taxa1" id="rnaseqs4" xsi:type="nex:RnaSeqs" label="RNA sequences">
335 <states id="rnastates">
336 <state id="rna1" symbol="A"/>
337 <state id="rna2" symbol="C"/>
338 <state id="rna3" symbol="G"/>
339 <state id="rna4" symbol="U"/>
340 <uncertain_state_set id="rna5" symbol="K">
341 <member state="rna3"/>
342 <member state="rna4"/>
343 </uncertain_state_set>
344 <uncertain_state_set id="rna6" symbol="M">
345 <member state="rna1"/>
346 <member state="rna2"/>
347 </uncertain_state_set>
348 <uncertain_state_set id="rna7" symbol="R">
349 <member state="rna1"/>
350 <member state="rna3"/>
351 </uncertain_state_set>
352 <uncertain_state_set id="rna8" symbol="S">
353 <member state="rna2"/>
354 <member state="rna3"/>
355 </uncertain_state_set>
356 <uncertain_state_set id="rna9" symbol="W">
357 <member state="rna1"/>
358 <member state="rna4"/>
359 </uncertain_state_set>
360 <uncertain_state_set id="rna10" symbol="Y">
361 <member state="rna2"/>
362 <member state="rna4"/>
363 </uncertain_state_set>
364 <uncertain_state_set id="rna11" symbol="B">
365 <member state="rna2"/>
366 <member state="rna3"/>
367 <member state="rna4"/>
368 </uncertain_state_set>
369 <uncertain_state_set id="rna12" symbol="D">
370 <member state="rna1"/>
371 <member state="rna3"/>
372 <member state="rna4"/>
373 </uncertain_state_set>
374 <uncertain_state_set id="rna13" symbol="H">
375 <member state="rna1"/>
376 <member state="rna2"/>
377 <member state="rna4"/>
378 </uncertain_state_set>
379 <uncertain_state_set id="rna14" symbol="V">
380 <member state="rna1"/>
381 <member state="rna2"/>
382 <member state="rna3"/>
383 </uncertain_state_set>
384 <uncertain_state_set id="rna15" symbol="N">
385 <member state="rna3"/>
386 <member state="rna1"/>
387 <member state="rna4"/>
388 <member state="rna2"/>
389 </uncertain_state_set>
390 <uncertain_state_set id="rna16" symbol="X">
391 <member state="rna3"/>
392 <member state="rna1"/>
393 <member state="rna4"/>
394 <member state="rna2"/>
395 </uncertain_state_set>
396 <uncertain_state_set id="rna17" symbol="-"/>
397 <uncertain_state_set id="rna18" symbol="?">
398 <member state="rna1"/>
399 <member state="rna2"/>
400 <member state="rna3"/>
401 <member state="rna4"/>
402 <member state="rna5"/>
403 <member state="rna6"/>
404 <member state="rna7"/>
405 <member state="rna8"/>
406 <member state="rna9"/>
407 <member state="rna10"/>
408 <member state="rna11"/>
409 <member state="rna12"/>
410 <member state="rna13"/>
411 <member state="rna14"/>
412 <member state="rna15"/>
413 <member state="rna16"/>
414 <member state="rna17"/>
415 </uncertain_state_set>
417 <char id="rnachar1" states="rnastates"/>
418 <char id="rnachar2" states="rnastates"/>
419 <char id="rnachar3" states="rnastates"/>
420 <char id="rnachar4" states="rnastates"/>
421 <char id="rnachar5" states="rnastates"/>
422 <char id="rnachar6" states="rnastates"/>
423 <char id="rnachar7" states="rnastates"/>
424 <char id="rnachar8" states="rnastates"/>
425 <char id="rnachar9" states="rnastates"/>
426 <char id="rnachar10" states="rnastates"/>
427 <char id="rnachar11" states="rnastates"/>
428 <char id="rnachar12" states="rnastates"/>
429 <char id="rnachar13" states="rnastates"/>
430 <char id="rnachar14" states="rnastates"/>
431 <char id="rnachar15" states="rnastates"/>
432 <char id="rnachar16" states="rnastates"/>
433 <char id="rnachar17" states="rnastates"/>
434 <char id="rnachar18" states="rnastates"/>
435 <char id="rnachar19" states="rnastates"/>
436 <char id="rnachar20" states="rnastates"/>
439 <row otu="t1" id="rnarow1">
440 <seq>ACGCUCGCAUCGCAUC</seq>
442 <row otu="t2" id="rnarow2">
443 <seq>ACGCUCGCAUCGCAUC</seq>
445 <row otu="t3" id="rnarow3">
446 <seq>ACGCUCGCAUCGCAUC</seq>
451 A more compact example of encoding of continuous characters as raw sequences.
453 <characters otus="taxa1" id="contchars5" xsi:type="nex:ContinuousSeqs" label="Continuous sequences">
455 <char id="contchar1"/>
456 <char id="contchar2"/>
457 <char id="contchar3"/>
458 <char id="contchar4"/>
459 <char id="contchar5"/>
462 <row id="controw1" otu="t1">
463 <seq>-1.545414144070023 -2.3905621575431044 -2.9610221833467265 0.7868662069161243 0.22968509237534918</seq>
465 <row id="controw2" otu="t2">
466 <seq>-1.6259836379710066 3.649352410850134 1.778885099660406 -1.2580877968480846 0.22335354995610862</seq>
468 <row id="controw3" otu="t3">
469 <seq>-1.5798979984134964 2.9548251411133157 1.522005675256233 -0.8642016921755289 -0.938129801832388</seq>
471 <row id="controw4" otu="t4">
472 <seq>2.7436692306788086 -0.7151148143399818 4.592207937774776 -0.6898841440534845 0.5769509574453064</seq>
474 <row id="controw5" otu="t5">
475 <seq>3.1060827493657683 -1.0453787389160105 2.67416332763427 -1.4045634106692808 0.019890469925520196</seq>
480 A more compact example of encoding of standard data. Note that the symbols used here
481 are integers (also above 9) and so characters must be space-separated. The symbols used
482 here are the same as the symbol attributes used in characters block m2, earlier.
484 <characters otus="taxa1" id="standardchars6" xsi:type="nex:StandardSeqs" label="Standard sequences">
487 The first elements inside a format element are stateset
488 definitions. In this example, there is a set of four
489 states, each tagged with an id. The symbol attribute is
492 <states id="standardstateset1">
493 <state id="standardstates1" symbol="1"/>
494 <state id="standardstates2" symbol="2"/>
495 <state id="standardstates3" symbol="3"/>
496 <polymorphic_state_set symbol="4" id="standardstates4">
497 <member state="standardstates1"/>
498 <member state="standardstates2"/>
499 </polymorphic_state_set>
500 <uncertain_state_set symbol="5" id="standardstates5">
501 <member state="standardstates3"/>
502 <member state="standardstates1"/>
503 </uncertain_state_set>
506 The matrix in this example contains two columns, both
507 referring to the same stateset - and so cells in both
508 columns can occupy one of four states.
510 <char states="standardstateset1" id="standardc1"/>
511 <char states="standardstateset1" id="standardc2"/>
514 <row id="standardr1" otu="t1">
517 <row id="standardr2" otu="t2">
520 <row id="standardr3" otu="t3">
523 <row id="standardr4" otu="t4">
526 <row id="standardr5" otu="t5">