The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--  
    This file shows encodings of character state data.
-->
<!--
    For more discussion of the structure of the root element,
    refer to 'taxa.xml' 
-->
<nex:nexml 
    version="0.8" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.nexml.org/1.0 ../../nexml/xsd/nexml.xsd"
    xmlns:nex="http://www.nexml.org/1.0"
    xmlns="http://www.nexml.org/1.0">         
    
    <!--  
        For more discussion of the structure of the taxa
        element, refer to 'taxa.xml'
    -->    
    <otus id="taxa1" label="Primary taxa block">
        <otu id="t1" label="Homo sapiens"/>
        <otu id="t2" label="Pan paniscus"/>
        <otu id="t3" label="Pan troglodytes"/>
        <otu id="t4" label="Gorilla gorilla"/>
        <otu id="t5" label="Pongo pygmaeus"/>
    </otus>
    <otus id="tax1" label="TreeTaxaBlock">
		<otu id="t1" label="human"/>
		<otu id="t2" label="mouse"/>
		<otu id="t3" label="dog"/>
		<otu id="t4" label="worm"/>
		<otu id="t5" label="bird"/>
	</otus>
    <!--
        This characters block encodes restriction site data, i.e.
        presence (1) / absence (0) observations. Because the states
        that can occur - and what they mean - are known, there is no
        'format' element to define states (see below for examples of
        that). In this example, restriction site data is encoded
        as a sequence of characters (rather than individual cells),
        hence we use the subclass xsi:type="RestrictionSeqs".
        
        All characters blocks must have an id attribute and a 
        reference to a taxa block that precedes it. In addition,
        it may have the same additional attributes (label, xml:base, 
        xml:lang, xml:id, xlink:href and class) as the taxa element. 
    -->
    <characters otus="taxa1" id="m1" xsi:type="nex:RestrictionSeqs">
    	<format>
	      <states id="states3">
	        <state id="s1" symbol="0"/>
	        <state id="s2" symbol="1"/>
	      </states>
	      <char id="c1" states="states3"/>
	      <char id="c2" states="states3"/>
	      <char id="c3" states="states3"/>
	      <char id="c4" states="states3"/>
        </format>
        <matrix>
        <!--
            The matrix element is a container for row elements. 
        -->        
            <!--
                Each row element must have an id and a reference
                to a taxon element that precedes it. 
            -->
            <row otu="t1" id="r1">
                <!--
                    Because this characters block is an instance
                    of the subclass RestrictionSeqs it contains
                    'seq' elements with 1's and 0's. 
                -->
                <seq>0101</seq>
            </row>
            <row otu="t2" id="r2">
                <seq>0101</seq>
            </row>
            <row otu="t3" id="r3">
                <seq>0101</seq>
            </row>
            <row otu="t4" id="r4">
                <seq>0101</seq>
            </row>
            <row otu="t5" id="r5">
                <seq>0101</seq>
            </row>
        </matrix>
    </characters>
    <!--
        This characters block encodes 'standard' categorical characters,
        marked up granularly, as cells. 
    -->
    <characters otus="taxa1" id="m2" xsi:type="nex:StandardCells" label="Categorical characters">
        <!--
            Because categorical characters in instances of this subclass
            don't have a priori known numbers of states, they must be
            defined using the 'format' element. 
        -->
        <format>
            <!--
                The first elements inside a format element are stateset
                definitions. In this example, there is a set of four
                states, each tagged with an id. The symbol attribute is
                a shorthand token. 
            -->
            <states id="states1">
                <state id="s1" symbol="1"/>                                
                <state id="s2" symbol="2"/>                
                <state id="s3" symbol="3"/>                 
                <polymorphic_state_set symbol="4" id="s4">                    
                    <member state="s1"/>
                    <member state="s2"/>                    
                </polymorphic_state_set>
                <uncertain_state_set symbol="5" id="s5">
                    <member state="s3"/>
                    <member state="s1"/>
                </uncertain_state_set>      
            </states>
            <!--
                The matrix in this example contains two columns, both
                referring to the same stateset - and so cells in both
                columns can occupy one of four states. 
             -->
            <char states="states1" id="c1"/>
            <char states="states1" id="c2"/>
        </format>
        <!--
            In this subclass, the matrix contains rows consisting of
            individual cells. 
        -->
        <matrix>
            <row id="r1" otu="t1">
                <!--
                    Each cell must contain a reference to the column 
                    it belongs to, and to a state allowed within that
                    column. 
                 -->
                <cell char="c1" state="s1"/>
                <cell char="c2" state="s2"/>
            </row>
            <row id="r2" otu="t2">
                <cell char="c1" state="s2"/>
                <cell char="c2" state="s2"/>
            </row>
            <row id="r3" otu="t3">
                <cell char="c1" state="s3"/>
                <cell char="c2" state="s4"/>
            </row>
            <row id="r4" otu="t4">
                <cell char="c1" state="s2"/>
                <cell char="c2" state="s3"/>
            </row>
            <row id="r5" otu="t5">
                <cell char="c1" state="s4"/>
                <cell char="c2" state="s1"/>
            </row>
        </matrix>
    </characters>
    <!--
        This example is a characters block for continuous characters, marked
        up as individual cells. 
    -->
    <characters otus="taxa1" id="m3" xsi:type="nex:ContinuousCells" label="Continuous characters">
        <format>
            <!--
                Because in this subclass, characters are marked up granularly -
                as cells - we must define the columns these cells belong to.
                Because this is continuous data, we don't (can't) define the
                states cells in these columns may occupy, hence there are no
                'states' elements in this subclass.  
            -->
            <char id="c1" label="this is character 1" class="something"/>
            <char id="c2"/>
            <char id="c3"/>
            <char id="c4"/>
            <char id="c5"/>
        </format>
        <matrix>
            <row id="r1" otu="t1">
                <!--  
                    In this subclass, the 'state' attribute holds the raw
                    value of the cell (i.e. a floating point number), not
                    a reference to a state defined previously.
                -->
                <cell char="c1" state="-1.545414144070023"/>
                <cell char="c2" state="-2.3905621575431044"/>
                <cell char="c3" state="-2.9610221833467265"/>
                <cell char="c4" state="0.7868662069161243"/>
                <cell char="c5" state="0.22968509237534918"/>
            </row>
            <row id="r2" otu="t2">
                <cell char="c1" state="-1.6259836379710066"/>
                <cell char="c2" state="3.649352410850134"/>
                <cell char="c3" state="1.778885099660406"/>
                <cell char="c4" state="-1.2580877968480846"/>
                <cell char="c5" state="0.22335354995610862"/>
            </row>
            <row id="r3" otu="t3">
                <cell char="c1" state="-1.5798979984134964"/>
                <cell char="c2" state="2.9548251411133157"/>
                <cell char="c3" state="1.522005675256233"/>
                <cell char="c4" state="-0.8642016921755289"/>
                <cell char="c5" state="-0.938129801832388"/>
            </row>
            <row id="r4" otu="t4">
                <cell char="c1" state="2.7436692306788086"/>
                <cell char="c2" state="-0.7151148143399818"/>
                <cell char="c3" state="4.592207937774776"/>
                <cell char="c4" state="-0.6898841440534845"/>
                <cell char="c5" state="0.5769509574453064"/>
            </row>
            <row id="r5" otu="t5">
                <cell char="c1" state="3.1060827493657683"/>
                <cell char="c2" state="-1.0453787389160105"/>
                <cell char="c3" state="2.67416332763427"/>
                <cell char="c4" state="-1.4045634106692808"/>
                <cell char="c5" state="0.019890469925520196"/>
            </row>
        </matrix>
    </characters>
    <!--
        This subclass encodes DNA as sequences (not cells). Like the restriction
        site data block shown above, the states are known (being IUPAC single
        character nucleotide symbols), hence there is no 'format' element. In 
        addition to the IUPAC symbols, '-' is used for gaps, '?' is used for
        missing. Spaces are allowed (so that long lines can be broken up, some
        parsers might otherwise complain) but have no meaning.
    -->
    <characters otus="taxa1" id="c3" xsi:type="nex:DnaSeqs" label="DNA sequences">
    <format>
    	<states id="states7">
    		<state id="s1" symbol="A" />
    		<state id="s2" symbol="C" />
    		<state id="s3" symbol="G" />
    		<state id="s4" symbol="T" />
    		<uncertain_state_set id="s5" symbol="K">
    			<member state="s3" />
    			<member state="s4" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s6" symbol="M">
    			<member state="s1" />
    			<member state="s2" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s7" symbol="R">
    			<member state="s1" />
    			<member state="s3" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s8" symbol="S">
    			<member state="s2" />
    			<member state="s3" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s9" symbol="W">
    			<member state="s1" />
    			<member state="s4" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s10" symbol="Y">
    			<member state="s2" />
    			<member state="s4" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s11" symbol="B">
    			<member state="s2" />
    			<member state="s3" />
    			<member state="s4" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s12" symbol="D">
    			<member state="s1" />
    			<member state="s3" />
    			<member state="s4" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s13" symbol="H">
    			<member state="s1" />
    			<member state="s2" />
    			<member state="s4" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s14" symbol="V">
    			<member state="s1" />
    			<member state="s2" />
    			<member state="s3" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s15" symbol="N">
    			<member state="s3" />
    			<member state="s1" />
    			<member state="s4" />
    			<member state="s2" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s16" symbol="X">
    			<member state="s3" />
    			<member state="s1" />
    			<member state="s4" />
    			<member state="s2" />
    		</uncertain_state_set>
    		<uncertain_state_set id="s17" symbol="-" />
    		<uncertain_state_set id="s18" symbol="?">
    			<member state="s1" />
    			<member state="s2" />
    			<member state="s3" />
    			<member state="s4" />
    			<member state="s5" />
    			<member state="s6" />
    			<member state="s7" />
    			<member state="s8" />
    			<member state="s9" />
    			<member state="s10" />
    			<member state="s11" />
    			<member state="s12" />
    			<member state="s13" />
    			<member state="s14" />
    			<member state="s15" />
    			<member state="s16" />
    			<member state="s17" />
    		</uncertain_state_set>
    	</states>
    	<char id="c1" states="states7" />
    	<char id="c2" states="states7" />
    	<char id="c3" states="states7" />
    	<char id="c4" states="states7" />
    	<char id="c5" states="states7" />
    	<char id="c6" states="states7" />
    	<char id="c7" states="states7" />
    	<char id="c8" states="states7" />
    	<char id="c9" states="states7" />
    	<char id="c10" states="states7" />
    	<char id="c11" states="states7" />
    	<char id="c12" states="states7" />
    	<char id="c13" states="states7" />
    	<char id="c14" states="states7" />
    	<char id="c15" states="states7" />
    	<char id="c16" states="states7" />
    </format>
    <matrix>
            <row otu="t1" id="r1" label="dna_seq_1">
                <seq>A C G C T C G C A T C G C A T C</seq>
            </row>
            <row otu="t2" id="r2" label="dna_seq_2">
                <seq>A C G C T C G C A T C G C A T T</seq>
            </row>
            <row otu="t3" id="r3" label="dna_seq_3">
                <seq>A C G C T C G C A T C G C A T G</seq>
            </row>
        </matrix>
    </characters>
    <!--
        RNA only differs from the previous example by using U instead of T 
    -->
    <characters otus="taxa1" id="rnaseqs4" xsi:type="nex:RnaSeqs" label="RNA sequences">
    <format>
      <states id="states3">
        <state id="s1" symbol="A"/>
        <state id="s2" symbol="C"/>
        <state id="s3" symbol="G"/>
        <state id="s4" symbol="U"/>
        <uncertain_state_set id="s5" symbol="K">
          <member state="s3"/>
          <member state="s4"/>
        </uncertain_state_set>
        <uncertain_state_set id="s6" symbol="M">
          <member state="s1"/>
          <member state="s2"/>
        </uncertain_state_set>
        <uncertain_state_set id="s7" symbol="R">
          <member state="s1"/>
          <member state="s3"/>
        </uncertain_state_set>
        <uncertain_state_set id="s8" symbol="S">
          <member state="s2"/>
          <member state="s3"/>
        </uncertain_state_set>
        <uncertain_state_set id="s9" symbol="W">
          <member state="s1"/>
          <member state="s4"/>
        </uncertain_state_set>
        <uncertain_state_set id="s10" symbol="Y">
          <member state="s2"/>
          <member state="s4"/>
        </uncertain_state_set>
        <uncertain_state_set id="s11" symbol="B">
          <member state="s2"/>
          <member state="s3"/>
          <member state="s4"/>
        </uncertain_state_set>
        <uncertain_state_set id="s12" symbol="D">
          <member state="s1"/>
          <member state="s3"/>
          <member state="s4"/>
        </uncertain_state_set>
        <uncertain_state_set id="s13" symbol="H">
          <member state="s1"/>
          <member state="s2"/>
          <member state="s4"/>
        </uncertain_state_set>
        <uncertain_state_set id="s14" symbol="V">
          <member state="s1"/>
          <member state="s2"/>
          <member state="s3"/>
        </uncertain_state_set>
        <uncertain_state_set id="s15" symbol="N">
          <member state="s3"/>
          <member state="s1"/>
          <member state="s4"/>
          <member state="s2"/>
        </uncertain_state_set>
        <uncertain_state_set id="s16" symbol="X">
          <member state="s3"/>
          <member state="s1"/>
          <member state="s4"/>
          <member state="s2"/>
        </uncertain_state_set>
        <uncertain_state_set id="s17" symbol="-"/>
        <uncertain_state_set id="s18" symbol="?">
          <member state="s1"/>
          <member state="s2"/>
          <member state="s3"/>
          <member state="s4"/>
          <member state="s5"/>
          <member state="s6"/>
          <member state="s7"/>
          <member state="s8"/>
          <member state="s9"/>
          <member state="s10"/>
          <member state="s11"/>
          <member state="s12"/>
          <member state="s13"/>
          <member state="s14"/>
          <member state="s15"/>
          <member state="s16"/>
          <member state="s17"/>
        </uncertain_state_set>
      </states>
      <char id="c1" states="states3"/>
      <char id="c2" states="states3"/>
      <char id="c3" states="states3"/>
      <char id="c4" states="states3"/>
      <char id="c5" states="states3"/>
      <char id="c6" states="states3"/>
      <char id="c7" states="states3"/>
      <char id="c8" states="states3"/>
      <char id="c9" states="states3"/>
      <char id="c10" states="states3"/>
      <char id="c11" states="states3"/>
      <char id="c12" states="states3"/>
      <char id="c13" states="states3"/>
      <char id="c14" states="states3"/>
      <char id="c15" states="states3"/>
      <char id="c16" states="states3"/>
      <char id="c17" states="states3"/>
      <char id="c18" states="states3"/>
      <char id="c19" states="states3"/>
      <char id="c20" states="states3"/>    
      </format>
        <matrix>
            <row otu="t1" id="r1">
                <seq>ACGCUCGCAUCGCAUC</seq>
            </row>
            <row otu="t2" id="r2">
                <seq>ACGCUCGCAUCGCAUC</seq>
            </row>
            <row otu="t3" id="r3">
                <seq>ACGCUCGCAUCGCAUC</seq>
            </row>
        </matrix>
    </characters>
    <!-- 
        A more compact example of encoding of continuous characters as raw sequences.    
    -->
    <characters otus="taxa1" id="c5" xsi:type="nex:ContinuousSeqs" label="Continuous sequences">
	    <format>
	      <char id="c1"/>
	      <char id="c2"/>
	      <char id="c3"/>
	      <char id="c4"/>
	      <char id="c5"/>	      	      
	    </format>    
        <matrix>
            <row id="r1" otu="t1">
                <seq>-1.545414144070023 -2.3905621575431044 -2.9610221833467265 0.7868662069161243 0.22968509237534918</seq>
            </row>
            <row id="r2" otu="t2">
                <seq>-1.6259836379710066 3.649352410850134 1.778885099660406 -1.2580877968480846 0.22335354995610862</seq>
            </row>
            <row id="r3" otu="t3">
                <seq>-1.5798979984134964 2.9548251411133157 1.522005675256233 -0.8642016921755289 -0.938129801832388</seq>
            </row>
            <row id="r4" otu="t4">
                <seq>2.7436692306788086 -0.7151148143399818 4.592207937774776 -0.6898841440534845 0.5769509574453064</seq>
            </row>
            <row id="r5" otu="t5">
                <seq>3.1060827493657683 -1.0453787389160105 2.67416332763427 -1.4045634106692808 0.019890469925520196</seq>
            </row>
        </matrix>
    </characters>
    <!-- 
        A more compact example of encoding of standard data. Note that the symbols used here
        are integers (also above 9) and so characters must be space-separated. The symbols used
        here are the same as the symbol attributes used in characters block m2, earlier.    
    -->
    <characters otus="taxa1" id="c6" xsi:type="nex:StandardSeqs" label="Standard sequences">
        <format>
            <!--
                The first elements inside a format element are stateset
                definitions. In this example, there is a set of four
                states, each tagged with an id. The symbol attribute is
                a shorthand token. 
            -->
            <states id="states1">
                <state id="s1" symbol="1"/>                                
                <state id="s2" symbol="2"/>                
                <state id="s3" symbol="3"/>                 
                <polymorphic_state_set symbol="4" id="s4">                    
                    <member state="s1"/>
                    <member state="s2"/>                    
                </polymorphic_state_set>
                <uncertain_state_set symbol="5" id="s5">
                    <member state="s3"/>
                    <member state="s1"/>
                </uncertain_state_set>      
            </states>
            <!--
                The matrix in this example contains two columns, both
                referring to the same stateset - and so cells in both
                columns can occupy one of four states. 
             -->
            <char states="states1" id="c1"/>
            <char states="states1" id="c2"/>
        </format>    
        <matrix>
            <row id="r1" otu="t1">
                <seq>1 2</seq>
            </row>
            <row id="r2" otu="t2">
                <seq>2 2</seq>
            </row>
            <row id="r3" otu="t3">
                <seq>3 4</seq>
            </row>
            <row id="r4" otu="t4">
                <seq>2 3</seq>
            </row>
            <row id="r5" otu="t5">
                <seq>4 1</seq>
            </row>
        </matrix>
    </characters>
    <trees otus="tax1" id="Trees" label="TreesBlockFromXML">
		<!--
			A tree with float edges. 
		-->
		<tree id="tree1" xsi:type="nex:FloatTree" label="tree1">
			<node id="n1" label="n1" root="true"/>
			<node id="n2" label="n2" otu="t1"/>
			<node id="n3" label="n3"/>
			<node id="n4" label="n4"/>
			<node id="n5" label="n5" otu="t3"/>
			<node id="n6" label="n6" otu="t2"/>
			<node id="n7" label="n7"/>
			<node id="n8" label="n8" otu="t5"/>
			<node id="n9" label="n9" otu="t4"/>
			<edge source="n1" target="n3" id="e1" length="0.34534"/>			
			<edge source="n1" target="n2" id="e2" length="0.4353"/>
			<edge source="n3" target="n4" id="e3" length="0.324"/>
			<edge source="n3" target="n7" id="e4" length="0.3247"/>
			<edge source="n4" target="n5" id="e5" length="0.234"/>
			<edge source="n4" target="n6" id="e6" length="0.3243"/>
			<edge source="n7" target="n8" id="e7" length="0.32443"/>
			<edge source="n7" target="n9" id="e8" length="0.2342"/>
		</tree>
		<!--  
			A tree with int edges.
		-->
		<tree id="tree2" xsi:type="nex:IntTree" label="tree2">
			<node id="n1" label="n1"/>
			<node id="n2" label="n2" otu="t1"/>
			<node id="n3" label="n3"/>
			<node id="n4" label="n4"/>
			<node id="n5" label="n5" otu="t3"/>
			<node id="n6" label="n6" otu="t2"/>
			<node id="n7" label="n7"/>
			<node id="n8" label="n8" otu="t5"/>
			<node id="n9" label="n9" otu="t4"/>
			<edge source="n1" target="n3" id="e1" length="1"/>			
			<edge source="n1" target="n2" id="e2" length="2"/>
			<edge source="n3" target="n4" id="e3" length="3"/>
			<edge source="n3" target="n7" id="e4" length="1"/>
			<edge source="n4" target="n5" id="e5" length="2"/>
			<edge source="n4" target="n6" id="e6" length="1"/>
			<edge source="n7" target="n8" id="e7" length="1"/>
			<edge source="n7" target="n9" id="e8" length="1"/>
		</tree>	
		<!--  
			A network with int edges.
		-->
		<network id="tree3" xsi:type="nex:IntNetwork" label="tree3">
			<node id="n1" label="n1"/>
			<node id="n2" label="n2" otu="t1"/>
			<node id="n3" label="n3"/>
			<node id="n4" label="n4"/>
			<node id="n5" label="n5" otu="t3"/>
			<node id="n6" label="n6" otu="t2"/>
			<node id="n7" label="n7"/>
			<node id="n8" label="n8" otu="t5"/>
			<node id="n9" label="n9" otu="t4"/>
			<edge source="n1" target="n3" id="e1" length="1"/>			
			<edge source="n1" target="n2" id="e2" length="2"/>
			<edge source="n3" target="n4" id="e3" length="3"/>
			<edge source="n3" target="n7" id="e4" length="1"/>
			<edge source="n4" target="n5" id="e5" length="2"/>
			<edge source="n4" target="n6" id="e6" length="1"/>
			<edge source="n7" target="n6" id="e7" length="1"/> <!-- extra edge -->
			<edge source="n7" target="n8" id="e9" length="1"/>
			<edge source="n7" target="n9" id="e8" length="1"/>
		</network>				
	</trees>
</nex:nexml>