Adding basic unit tests for NeXML parser using example files from nexml.org.

This commit is contained in:
bendmorris
2013-01-15 13:24:59 -05:00
committed by Eric Talevich
parent 5390a48460
commit 02e7e0ac91
14 changed files with 3451 additions and 0 deletions

532
Tests/NeXML/characters.xml Normal file
View File

@ -0,0 +1,532 @@
<?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.9"
xml:base="http://example.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd"
xmlns:nex="http://www.nexml.org/2009"
xmlns="http://www.nexml.org/2009">
<!--
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>
<!--
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" label="Restriction site sequences">
<format>
<states id="RestrictionSiteStateSet">
<state id="Absent" symbol="0"/>
<state id="Present" symbol="1"/>
</states>
<char id="Site1" states="RestrictionSiteStateSet"/>
<char id="Site2" states="RestrictionSiteStateSet"/>
<char id="Site3" states="RestrictionSiteStateSet"/>
<char id="Site4" states="RestrictionSiteStateSet"/>
</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="RestrictionSiteRow1">
<!--
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="RestrictionSiteRow2">
<seq>0101</seq>
</row>
<row otu="t3" id="RestrictionSiteRow3">
<seq>0101</seq>
</row>
<row otu="t4" id="RestrictionSiteRow4">
<seq>0101</seq>
</row>
<row otu="t5" id="RestrictionSiteRow5">
<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 that would be used when serializing to
NEXUS, for example.
-->
<states id="StandardCategoricalStateSet1">
<state id="StandardCategoricalState1" symbol="1"/>
<state id="StandardCategoricalState2" symbol="2"/>
<state id="StandardCategoricalState3" symbol="3"/>
<polymorphic_state_set symbol="4" id="StandardCategoricalState4">
<member state="StandardCategoricalState2"/>
<member state="StandardCategoricalState3"/>
</polymorphic_state_set>
<uncertain_state_set symbol="5" id="StandardCategoricalState5">
<member state="StandardCategoricalState1"/>
<member state="StandardCategoricalState2"/>
</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="StandardCategoricalStateSet1" id="StandardCharacter1"/>
<char states="StandardCategoricalStateSet1" id="StandardCharacter2"/>
</format>
<!--
In this subclass, the matrix contains rows consisting of
individual cells.
-->
<matrix>
<row id="StandardCategoricalStateCellsRow1" otu="t1">
<!--
Each cell must contain a reference to the column
it belongs to, and to a state allowed within that
column.
-->
<cell char="StandardCharacter1" state="StandardCategoricalState1"/>
<cell char="StandardCharacter2" state="StandardCategoricalState2"/>
</row>
<row id="StandardCategoricalStateCellsRow2" otu="t2">
<cell char="StandardCharacter1" state="StandardCategoricalState2"/>
<cell char="StandardCharacter2" state="StandardCategoricalState2"/>
</row>
<row id="StandardCategoricalStateCellsRow3" otu="t3">
<cell char="StandardCharacter1" state="StandardCategoricalState3"/>
<cell char="StandardCharacter2" state="StandardCategoricalState4"/>
</row>
<row id="StandardCategoricalStateCellsRow4" otu="t4">
<cell char="StandardCharacter1" state="StandardCategoricalState2"/>
<cell char="StandardCharacter2" state="StandardCategoricalState3"/>
</row>
<row id="StandardCategoricalStateCellsRow5" otu="t5">
<cell char="StandardCharacter1" state="StandardCategoricalState4"/>
<cell char="StandardCharacter2" state="StandardCategoricalState1"/>
</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="ContinuousCharacter1" label="this is character 1"/>
<char id="ContinuousCharacter2"/>
<char id="ContinuousCharacter3"/>
<char id="ContinuousCharacter4"/>
<char id="ContinuousCharacter5"/>
</format>
<matrix>
<row id="ContinuousCellsRow1" 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="ContinuousCharacter1" state="-1.545414144070023"/>
<cell char="ContinuousCharacter2" state="-2.3905621575431044"/>
<cell char="ContinuousCharacter3" state="-2.9610221833467265"/>
<cell char="ContinuousCharacter4" state="0.7868662069161243"/>
<cell char="ContinuousCharacter5" state="0.22968509237534918"/>
</row>
<row id="ContinuousCellsRow2" otu="t2">
<cell char="ContinuousCharacter1" state="-1.6259836379710066"/>
<cell char="ContinuousCharacter2" state="3.649352410850134"/>
<cell char="ContinuousCharacter3" state="1.778885099660406"/>
<cell char="ContinuousCharacter4" state="-1.2580877968480846"/>
<cell char="ContinuousCharacter5" state="0.22335354995610862"/>
</row>
<row id="ContinuousCellsRow3" otu="t3">
<cell char="ContinuousCharacter1" state="-1.5798979984134964"/>
<cell char="ContinuousCharacter2" state="2.9548251411133157"/>
<cell char="ContinuousCharacter3" state="1.522005675256233"/>
<cell char="ContinuousCharacter4" state="-0.8642016921755289"/>
<cell char="ContinuousCharacter5" state="-0.938129801832388"/>
</row>
<row id="ContinuousCellsRow4" otu="t4">
<cell char="ContinuousCharacter1" state="2.7436692306788086"/>
<cell char="ContinuousCharacter2" state="-0.7151148143399818"/>
<cell char="ContinuousCharacter3" state="4.592207937774776"/>
<cell char="ContinuousCharacter4" state="-0.6898841440534845"/>
<cell char="ContinuousCharacter5" state="0.5769509574453064"/>
</row>
<row id="ContinuousCellsRow5" otu="t5">
<cell char="ContinuousCharacter1" state="3.1060827493657683"/>
<cell char="ContinuousCharacter2" state="-1.0453787389160105"/>
<cell char="ContinuousCharacter3" state="2.67416332763427"/>
<cell char="ContinuousCharacter4" state="-1.4045634106692808"/>
<cell char="ContinuousCharacter5" 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="characters3" xsi:type="nex:DnaSeqs" label="DNA sequences">
<format>
<states id="IUPACDNAStateSet1">
<state id="NucA" symbol="A" />
<state id="NucC" symbol="C" />
<state id="NucG" symbol="G" />
<state id="NucT" symbol="T" />
<uncertain_state_set id="SymK" symbol="K">
<member state="NucG" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymM" symbol="M">
<member state="NucA" />
<member state="NucC" />
</uncertain_state_set>
<uncertain_state_set id="SymR" symbol="R">
<member state="NucA" />
<member state="NucG" />
</uncertain_state_set>
<uncertain_state_set id="SymS" symbol="S">
<member state="NucC" />
<member state="NucG" />
</uncertain_state_set>
<uncertain_state_set id="SymW" symbol="W">
<member state="NucA" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymY" symbol="Y">
<member state="NucC" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymB" symbol="B">
<member state="NucC" />
<member state="NucG" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymD" symbol="D">
<member state="NucA" />
<member state="NucG" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymH" symbol="H">
<member state="NucA" />
<member state="NucC" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymV" symbol="V">
<member state="NucA" />
<member state="NucC" />
<member state="NucG" />
</uncertain_state_set>
<uncertain_state_set id="SymN" symbol="N">
<member state="NucA" />
<member state="NucC" />
<member state="NucG" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymX" symbol="X">
<member state="NucA" />
<member state="NucC" />
<member state="NucG" />
<member state="NucT" />
</uncertain_state_set>
<uncertain_state_set id="SymGap" symbol="-" />
<uncertain_state_set id="SymMiss" symbol="?">
<member state="NucA" />
<member state="NucC" />
<member state="NucG" />
<member state="NucT" />
<member state="SymK" />
<member state="SymM" />
<member state="SymR" />
<member state="SymS" />
<member state="SymW" />
<member state="SymY" />
<member state="SymB" />
<member state="SymD" />
<member state="SymH" />
<member state="SymV" />
<member state="SymN" />
<member state="SymX" />
<member state="SymGap" />
</uncertain_state_set>
</states>
<char id="ResidueCol1" states="IUPACDNAStateSet1" />
<char id="ResidueCol2" states="IUPACDNAStateSet1" />
<char id="ResidueCol3" states="IUPACDNAStateSet1" />
<char id="ResidueCol4" states="IUPACDNAStateSet1" />
<char id="ResidueCol5" states="IUPACDNAStateSet1" />
<char id="ResidueCol6" states="IUPACDNAStateSet1" />
<char id="ResidueCol7" states="IUPACDNAStateSet1" />
<char id="ResidueCol8" states="IUPACDNAStateSet1" />
<char id="ResidueCol9" states="IUPACDNAStateSet1" />
<char id="ResidueCol10" states="IUPACDNAStateSet1" />
<char id="ResidueCol11" states="IUPACDNAStateSet1" />
<char id="ResidueCol12" states="IUPACDNAStateSet1" />
<char id="ResidueCol13" states="IUPACDNAStateSet1" />
<char id="ResidueCol14" states="IUPACDNAStateSet1" />
<char id="ResidueCol15" states="IUPACDNAStateSet1" />
<char id="ResidueCol16" states="IUPACDNAStateSet1" />
</format>
<matrix>
<row otu="t1" id="DNASequence1"><seq>A C G C T C G C A T C G C A T C</seq></row>
<row otu="t2" id="DNASequence2"><seq>A C G C T C G C A T C G C A T C</seq></row>
<row otu="t3" id="DNASequence3"><seq>A C G C T C G C A T C G C A T C</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="rnastates">
<state id="rna1" symbol="A"/>
<state id="rna2" symbol="C"/>
<state id="rna3" symbol="G"/>
<state id="rna4" symbol="U"/>
<uncertain_state_set id="rna5" symbol="K">
<member state="rna3"/>
<member state="rna4"/>
</uncertain_state_set>
<uncertain_state_set id="rna6" symbol="M">
<member state="rna1"/>
<member state="rna2"/>
</uncertain_state_set>
<uncertain_state_set id="rna7" symbol="R">
<member state="rna1"/>
<member state="rna3"/>
</uncertain_state_set>
<uncertain_state_set id="rna8" symbol="S">
<member state="rna2"/>
<member state="rna3"/>
</uncertain_state_set>
<uncertain_state_set id="rna9" symbol="W">
<member state="rna1"/>
<member state="rna4"/>
</uncertain_state_set>
<uncertain_state_set id="rna10" symbol="Y">
<member state="rna2"/>
<member state="rna4"/>
</uncertain_state_set>
<uncertain_state_set id="rna11" symbol="B">
<member state="rna2"/>
<member state="rna3"/>
<member state="rna4"/>
</uncertain_state_set>
<uncertain_state_set id="rna12" symbol="D">
<member state="rna1"/>
<member state="rna3"/>
<member state="rna4"/>
</uncertain_state_set>
<uncertain_state_set id="rna13" symbol="H">
<member state="rna1"/>
<member state="rna2"/>
<member state="rna4"/>
</uncertain_state_set>
<uncertain_state_set id="rna14" symbol="V">
<member state="rna1"/>
<member state="rna2"/>
<member state="rna3"/>
</uncertain_state_set>
<uncertain_state_set id="rna15" symbol="N">
<member state="rna3"/>
<member state="rna1"/>
<member state="rna4"/>
<member state="rna2"/>
</uncertain_state_set>
<uncertain_state_set id="rna16" symbol="X">
<member state="rna3"/>
<member state="rna1"/>
<member state="rna4"/>
<member state="rna2"/>
</uncertain_state_set>
<uncertain_state_set id="rna17" symbol="-"/>
<uncertain_state_set id="rna18" symbol="?">
<member state="rna1"/>
<member state="rna2"/>
<member state="rna3"/>
<member state="rna4"/>
<member state="rna5"/>
<member state="rna6"/>
<member state="rna7"/>
<member state="rna8"/>
<member state="rna9"/>
<member state="rna10"/>
<member state="rna11"/>
<member state="rna12"/>
<member state="rna13"/>
<member state="rna14"/>
<member state="rna15"/>
<member state="rna16"/>
<member state="rna17"/>
</uncertain_state_set>
</states>
<char id="rnachar1" states="rnastates"/>
<char id="rnachar2" states="rnastates"/>
<char id="rnachar3" states="rnastates"/>
<char id="rnachar4" states="rnastates"/>
<char id="rnachar5" states="rnastates"/>
<char id="rnachar6" states="rnastates"/>
<char id="rnachar7" states="rnastates"/>
<char id="rnachar8" states="rnastates"/>
<char id="rnachar9" states="rnastates"/>
<char id="rnachar10" states="rnastates"/>
<char id="rnachar11" states="rnastates"/>
<char id="rnachar12" states="rnastates"/>
<char id="rnachar13" states="rnastates"/>
<char id="rnachar14" states="rnastates"/>
<char id="rnachar15" states="rnastates"/>
<char id="rnachar16" states="rnastates"/>
<char id="rnachar17" states="rnastates"/>
<char id="rnachar18" states="rnastates"/>
<char id="rnachar19" states="rnastates"/>
<char id="rnachar20" states="rnastates"/>
</format>
<matrix>
<row otu="t1" id="rnarow1">
<seq>ACGCUCGCAUCGCAUC</seq>
</row>
<row otu="t2" id="rnarow2">
<seq>ACGCUCGCAUCGCAUC</seq>
</row>
<row otu="t3" id="rnarow3">
<seq>ACGCUCGCAUCGCAUC</seq>
</row>
</matrix>
</characters>
<!--
A more compact example of encoding of continuous characters as raw sequences.
-->
<characters otus="taxa1" id="contchars5" xsi:type="nex:ContinuousSeqs" label="Continuous sequences">
<format>
<char id="contchar1"/>
<char id="contchar2"/>
<char id="contchar3"/>
<char id="contchar4"/>
<char id="contchar5"/>
</format>
<matrix>
<row id="controw1" otu="t1">
<seq>-1.545414144070023 -2.3905621575431044 -2.9610221833467265 0.7868662069161243 0.22968509237534918</seq>
</row>
<row id="controw2" otu="t2">
<seq>-1.6259836379710066 3.649352410850134 1.778885099660406 -1.2580877968480846 0.22335354995610862</seq>
</row>
<row id="controw3" otu="t3">
<seq>-1.5798979984134964 2.9548251411133157 1.522005675256233 -0.8642016921755289 -0.938129801832388</seq>
</row>
<row id="controw4" otu="t4">
<seq>2.7436692306788086 -0.7151148143399818 4.592207937774776 -0.6898841440534845 0.5769509574453064</seq>
</row>
<row id="controw5" 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="standardchars6" 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="standardstateset1">
<state id="standardstates1" symbol="1"/>
<state id="standardstates2" symbol="2"/>
<state id="standardstates3" symbol="3"/>
<polymorphic_state_set symbol="4" id="standardstates4">
<member state="standardstates1"/>
<member state="standardstates2"/>
</polymorphic_state_set>
<uncertain_state_set symbol="5" id="standardstates5">
<member state="standardstates3"/>
<member state="standardstates1"/>
</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="standardstateset1" id="standardc1"/>
<char states="standardstateset1" id="standardc2"/>
</format>
<matrix>
<row id="standardr1" otu="t1">
<seq>1 2</seq>
</row>
<row id="standardr2" otu="t2">
<seq>2 2</seq>
</row>
<row id="standardr3" otu="t3">
<seq>3 4</seq>
</row>
<row id="standardr4" otu="t4">
<seq>2 3</seq>
</row>
<row id="standardr5" otu="t5">
<seq>4 1</seq>
</row>
</matrix>
</characters>
</nex:nexml>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<nex:nexml
version="0.9"
xml:base="http://example.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nexml.org/2009 http://www.nexml.org/2009/nexml.xsd"
xmlns:nex="http://www.nexml.org/2009"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.nexml.org/2009">
<otus id="tax1" label="RootTaxaBlock">
<otu id="t1"/>
<otu id="t2"/>
<otu id="t3"/>
<otu id="t4"/>
<otu id="t5"/>
</otus>
<trees otus="tax1" id="Trees" label="TreesBlockFromXML">
<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" label="e1"/>
<edge source="n1" target="n2" id="e2" label="e2"/>
<edge source="n3" target="n4" id="e3" label="e3"/>
<edge source="n3" target="n7" id="e4" label="e4"/>
<edge source="n4" target="n5" id="e5" label="e5"/>
<edge source="n4" target="n6" id="e6" label="e6"/>
<edge source="n7" target="n8" id="e7" label="e7"/>
<edge source="n7" target="n9" id="e8" label="e8"/>
</tree>
</trees>
</nex:nexml>

49
Tests/NeXML/meta_taxa.xml Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<nex:nexml
generator="Bio::Phylo::Project v.0.17_RC9_1175"
version="0.9"
xml:base="http://example.org/"
xmlns="http://www.nexml.org/2009"
xmlns:nex="http://www.nexml.org/2009"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cdao="http://www.evolutionaryontology.org/cdao/1.0/cdao.owl#"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd">
<otus
id="aabef8df4-6968-4d97-961d-b28210c0b318"
about="#aabef8df4-6968-4d97-961d-b28210c0b318"
label="Taxa"
xmlns:dwc="http://I-GUESS-THIS-SHOULD-BE-DARWINCORE.org#">
<meta
href="http://purl.org/obo/owl/TTO#TTO_1030115"
id="ad37ab715-8dc6-4959-9b20-c58d5edaef29"
xsi:type="nex:ResourceMeta"
rel="cdao:has_External_Reference"/>
<meta
id="EDA14D9B-9669-48F1-A79A-761DAA82038B"
about="#EDA14D9B-9669-48F1-A79A-761DAA82038B"
xsi:type="nex:ResourceMeta"
rel="cdao:hasSpecimen">
<meta
id="C9F5CAA3-421B-4830-8DC5-686FD75EB9F3"
xsi:type="nex:ResourceMeta"
rel="dwc:collectionID"
href="http://purl.org/obo/owl/COLLECTION#COLLECTION_0000194"/>
<meta
id="C3E89AAC-AFE3-4225-869C-A2380B6EF83E"
datatype="xsd:string"
xsi:type="nex:LiteralMeta"
property="dwc:catalogNumber"
content="12345"/>
</meta>
<otu
xmlns:cdao="http://evolutionaryontology.org#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
about="#aaa0ec8a9-7b38-411f-9c4d-f4a47bcffac3"
id="aaa0ec8a9-7b38-411f-9c4d-f4a47bcffac3"
label="Nannostomus unifasciatus">
</otu>
</otus>
</nex:nexml>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<nex:nexml
generator="Bio::Phylo::Project v.0.17_RC9_1175"
version="0.9"
xml:base="http://example.org/base/"
xmlns="http://www.nexml.org/2009"
xmlns:kt="http://example.org/knownTypes#"
xmlns:nex="http://www.nexml.org/2009"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd">
<otus about="#otus1" id="otus1">
<otu about="#otu1" id="otu1">
<meta href="http://example.org" id="meta12" rel="kt:hasURL" xsi:type="nex:ResourceMeta"/>
<meta content="bar" datatype="xsd:string" id="meta11" property="kt:hasString" xsi:type="nex:LiteralMeta"/>
<meta content="5" datatype="xsd:short" id="meta10" property="kt:hasShort" xsi:type="nex:LiteralMeta"/>
<meta content="10" datatype="xsd:long" id="meta9" property="kt:hasLong" xsi:type="nex:LiteralMeta"/>
<meta content="1.6" datatype="xsd:float" id="meta8" property="kt:hasFloat" xsi:type="nex:LiteralMeta"/>
<meta content="1.5" datatype="xsd:double" id="meta7" property="kt:hasDouble" xsi:type="nex:LiteralMeta"/>
<meta content="foo" datatype="xsd:QName" id="meta6" property="kt:hasQName" xsi:type="nex:LiteralMeta"/>
<meta content="1" datatype="xsd:byte" id="meta5" property="kt:hasByte" xsi:type="nex:LiteralMeta"/>
<meta content="true" datatype="xsd:boolean" id="meta4" property="kt:hasBoolean" xsi:type="nex:LiteralMeta"/>
<meta content="1" datatype="xsd:integer" id="meta3" property="kt:hasBigInteger" xsi:type="nex:LiteralMeta"/>
<meta content="0.1" datatype="xsd:decimal" id="meta2" property="kt:hasBigDecimal" xsi:type="nex:LiteralMeta"/>
</otu>
</otus>
</nex:nexml>

8
Tests/NeXML/nexml.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<nex:nexml
version="0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd"
xmlns:xi="http://www.w3.org/2003/XInclude"
xmlns:nex="http://www.nexml.org/2009"
xmlns="http://www.nexml.org/2009"/>

View File

@ -0,0 +1,45 @@
<nex:nexml
generator="Bio::Phylo::Project v.0.17_RC9_1175"
version="0.9"
xml:base="http://example.org/"
xmlns="http://www.nexml.org/2009"
xmlns:nex="http://www.nexml.org/2009"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cdao="http://www.evolutionaryontology.org/cdao/1.0/cdao.owl#"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd">
<otus
id="aabef8df4-6968-4d97-961d-b28210c0b318" label="Taxa">
<otu
xmlns:cdao="http://evolutionaryontology.org#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
about="#aaa0ec8a9-7b38-411f-9c4d-f4a47bcffac3"
id="aaa0ec8a9-7b38-411f-9c4d-f4a47bcffac3"
label="Nannostomus unifasciatus"
xmlns:dwc="http://rs.tdwg.org/dwc/terms/">
<meta
href="http://purl.org/obo/owl/TTO#TTO_1030115"
id="ad37ab715-8dc6-4959-9b20-c58d5edaef29"
xsi:type="nex:ResourceMeta"
rel="cdao:has_External_Reference"/>
<meta
id="EDA14D9B-9669-48F1-A79A-761DAA82038B"
xsi:type="nex:ResourceMeta"
rel="cdao:hasSpecimen">
<meta
id="C9F5CAA3-421B-4830-8DC5-686FD75EB9F3"
xsi:type="nex:ResourceMeta"
rel="dwc:collectionID"
href="http://purl.org/obo/owl/COLLECTION#COLLECTION_0000194"/>
<meta
id="C3E89AAC-AFE3-4225-869C-A2380B6EF83E"
datatype="xsd:string"
xsi:type="nex:LiteralMeta"
property="dwc:catalogNumber"
content="12345"/>
</meta>
</otu>
</otus>
</nex:nexml>

36
Tests/NeXML/sets.xml Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<nex:nexml
version="0.9"
xml:base="http://example.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
generator="handmade"
xmlns:nex="http://www.nexml.org/2009"
xmlns="http://www.nexml.org/2009"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd">
<otus
id="taxa1"
label="My taxa block">
<otu id="t1"/>
<otu id="t2"/>
<otu id="t3"/>
<otu id="t4"/>
<otu id="t5"/>
<set otu="t1 t2" id="set1" about="#set1">
<meta id="m1" xsi:type="nex:LiteralMeta" content="1" datatype="xsd:integer" xmlns:foo="http://example.org/foo#" property="foo:hasInt"/>
</set>
</otus>
<trees otus="taxa1" id="trees1">
<tree xsi:type="nex:IntTree" id="tree1">
<node id="n1"/>
<node id="n2"/>
<node id="n3"/>
<rootedge target="n1" id="root"/>
<edge source="n1" target="n2" id="e1"/>
<edge source="n1" target="n3" id="e2"/>
<set edge="e1" rootedge="root" node="n1" id="set2"/>
</tree>
<set tree="tree1" network="tree1" id="set3"/>
</trees>
</nex:nexml>

83
Tests/NeXML/taxa.xml Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
This file is an example of a simple taxa block.
-->
<!--
The nexml root element below is structured as follows:
* there is a required version attribute. Additions where
the 'core' remains backward compatible are identified
by decimal increases (1.1, 1.2, etc.). Changes to the
core standard are identified by integer increases (2.0,
3.0, etc.). The former is somewhat likely to happen in
practice, the latter hopefully isn't.
* In some places in instance documents, snippets of schema
language code are necessary, for example to specify
concrete subclasses. Such snippets are bound to the
http://www.w3.org/2001/XMLSchema-instance namespace, and
by convention identified by the 'xsi' prefix.
http://en.wikipedia.org/wiki/Xsd
* to facilitate validation, the location of the schema is
specified in the root element. Such a specification is
done using the schema language snippet xsi:schemaLocation
* by convention, root elements of nexml fragments are
pre-fixed with 'nex', which is bound to the namespace
http://www.nexml.org/1.0
* the optional 'generator' attribute can be used to specify
which program wrote out the file.
* other xml namespaces (i.e. attributes with the 'xmlns'
prefix) can be specified here, in case they're used
in child elements. For example, the xlink namespace
is used for links ('href' attributes, as in html), so
that child elements may contain links to other resources.
http://en.wikipedia.org/wiki/XLink
-->
<nex:nexml
version="0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
generator="mesquite"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:nex="http://www.nexml.org/2009"
xmlns="http://www.nexml.org/2009"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd">
<!--
The taxa element is analogous to the taxa block in nexus
files. Like all elements that capture things that might
need to be referred to elsewhere, it requires an 'id'
attribute, whose value must consist of a string of alpha-
numeric characters, starting with a letter. In addition,
it may (optionally) have the following attributes:
* 'label', a free form string, only meant for humans
* 'xml:base', indicating the base url of the resource
* 'xml:lang', indicating a two-letter language code
* 'xml:id', a file-scope unique ID
* 'xlink:href', a link to somewhere else
* 'class', a vector of nexml id references pointing
to classes the element belongs to (this is analogous
to 'sets' in nexus, but using the xml idiom to do
the same thing).
-->
<otus
id="taxa1"
label="My taxa block"
xml:base="http://example.org/"
xml:id="taxa1"
xml:lang="EN"
xlink:href="#taxa1">
<!--
The taxon element is analogous to a single label in
a nexus taxa block. It may have the same additional
attributes (label, xml:base, xml:lang, xml:id, xlink:href
and class) as the taxa element.
-->
<otu id="t1"/>
<otu id="t2"/>
<otu id="t3"/>
<otu id="t4"/>
<otu id="t5"/>
</otus>
</nex:nexml>

283
Tests/NeXML/timetree.xml Normal file
View File

@ -0,0 +1,283 @@
<nex:nexml
generator="Bio::Phylo::Project v.0.17_RC9_841"
version="0.9"
xml:base="http://example.org/"
xmlns:nex="http://www.nexml.org/2009"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd"
xmlns="http://www.nexml.org/2009">
<otus id="otus3">
<otu id="taxona"/>
<otu id="taxonb"/>
</otus>
<trees id="trees2" otus="otus3">
<tree id="tree6" xsi:type="nex:FloatTree">
<node id="node12" root="true"/>
<node id="node13" label="Pan" otu="taxona"/>
<node id="node14" label="Homo" otu="taxonb"/>
<edge id="edge13" length="6.6" source="node12" target="node13"/>
<edge id="edge14" length="6.6" source="node12" target="node14"/>
</tree>
<tree id="tree15" xsi:type="nex:FloatTree">
<node id="node21" root="true"/>
<node id="node22" label="Pan" otu="taxona"/>
<node id="node23" label="Homo" otu="taxonb"/>
<edge id="edge22" length="5.8" source="node21" target="node22"/>
<edge id="edge23" length="5.8" source="node21" target="node23"/>
</tree>
<tree id="tree24" xsi:type="nex:FloatTree">
<node id="node30" root="true"/>
<node id="node31" label="Pan" otu="taxona"/>
<node id="node32" label="Homo" otu="taxonb"/>
<edge id="edge31" length="6.1" source="node30" target="node31"/>
<edge id="edge32" length="6.1" source="node30" target="node32"/>
</tree>
<tree id="tree33" xsi:type="nex:FloatTree">
<node id="node39" root="true"/>
<node id="node40" label="Pan" otu="taxona"/>
<node id="node41" label="Homo" otu="taxonb"/>
<edge id="edge40" length="6.8" source="node39" target="node40"/>
<edge id="edge41" length="6.8" source="node39" target="node41"/>
</tree>
<tree id="tree42" xsi:type="nex:FloatTree">
<node id="node48" root="true"/>
<node id="node49" label="Pan" otu="taxona"/>
<node id="node50" label="Homo sapiens" otu="taxonb"/>
<edge id="edge49" length="6.3" source="node48" target="node49"/>
<edge id="edge50" length="6.3" source="node48" target="node50"/>
</tree>
<tree id="tree51" xsi:type="nex:FloatTree">
<node id="node57" root="true"/>
<node id="node58" label="Pan" otu="taxona"/>
<node id="node59" label="Homo sapiens" otu="taxonb"/>
<edge id="edge58" length="8.1" source="node57" target="node58"/>
<edge id="edge59" length="8.1" source="node57" target="node59"/>
</tree>
<tree id="tree60" xsi:type="nex:IntTree">
<node id="node66" root="true"/>
<node id="node67" label="Pan" otu="taxona"/>
<node id="node68" label="Homo" otu="taxonb"/>
<edge id="edge67" length="6" source="node66" target="node67"/>
<edge id="edge68" length="6" source="node66" target="node68"/>
</tree>
<tree id="tree69" xsi:type="nex:FloatTree">
<node id="node75" root="true"/>
<node id="node76" label="Pan troglodytes" otu="taxona"/>
<node id="node77" label="Homo sapiens" otu="taxonb"/>
<edge id="edge76" length="5.1" source="node75" target="node76"/>
<edge id="edge77" length="5.1" source="node75" target="node77"/>
</tree>
<tree id="tree78" xsi:type="nex:FloatTree">
<node id="node84" root="true"/>
<node id="node85" label="Pan troglodytes" otu="taxona"/>
<node id="node86" label="Homo sapiens" otu="taxonb"/>
<edge id="edge85" length="5.1" source="node84" target="node85"/>
<edge id="edge86" length="5.1" source="node84" target="node86"/>
</tree>
<tree id="tree87" xsi:type="nex:FloatTree">
<node id="node93" root="true"/>
<node id="node94" label="Pan troglodytes" otu="taxona"/>
<node id="node95" label="Homo sapiens" otu="taxonb"/>
<edge id="edge94" length="5.4" source="node93" target="node94"/>
<edge id="edge95" length="5.4" source="node93" target="node95"/>
</tree>
<tree id="tree96" xsi:type="nex:FloatTree">
<node id="node102" root="true"/>
<node id="node103" label="Pan troglodytes" otu="taxona"/>
<node id="node104" label="Homo sapiens" otu="taxonb"/>
<edge id="edge103" length="7.5" source="node102" target="node103"/>
<edge id="edge104" length="7.5" source="node102" target="node104"/>
</tree>
<tree id="tree105" xsi:type="nex:FloatTree">
<node id="node111" root="true"/>
<node id="node112" label="Pan troglodytes" otu="taxona"/>
<node id="node113" label="Homo sapiens" otu="taxonb"/>
<edge id="edge112" length="7.6" source="node111" target="node112"/>
<edge id="edge113" length="7.6" source="node111" target="node113"/>
</tree>
<tree id="tree114" xsi:type="nex:FloatTree">
<node id="node120" root="true"/>
<node id="node121" label="Pan" otu="taxona"/>
<node id="node122" label="Homo sapiens" otu="taxonb"/>
<edge id="edge121" length="7.4" source="node120" target="node121"/>
<edge id="edge122" length="7.4" source="node120" target="node122"/>
</tree>
<tree id="tree123" xsi:type="nex:FloatTree">
<node id="node129" root="true"/>
<node id="node130" label="Pan troglodytes" otu="taxona"/>
<node id="node131" label="Homo sapiens" otu="taxonb"/>
<edge id="edge130" length="7.1" source="node129" target="node130"/>
<edge id="edge131" length="7.1" source="node129" target="node131"/>
</tree>
<tree id="tree132" xsi:type="nex:FloatTree">
<node id="node138" root="true"/>
<node id="node139" label="Pan troglodytes" otu="taxona"/>
<node id="node140" label="Homo sapiens" otu="taxonb"/>
<edge id="edge139" length="7.1" source="node138" target="node139"/>
<edge id="edge140" length="7.1" source="node138" target="node140"/>
</tree>
<tree id="tree141" xsi:type="nex:FloatTree">
<node id="node147" root="true"/>
<node id="node148" label="Pan troglodytes" otu="taxona"/>
<node id="node149" label="Homo sapiens" otu="taxonb"/>
<edge id="edge148" length="8.3" source="node147" target="node148"/>
<edge id="edge149" length="8.3" source="node147" target="node149"/>
</tree>
<tree id="tree150" xsi:type="nex:FloatTree">
<node id="node156" root="true"/>
<node id="node157" label="Pan troglodytes" otu="taxona"/>
<node id="node158" label="Homo sapiens" otu="taxonb"/>
<edge id="edge157" length="9.2" source="node156" target="node157"/>
<edge id="edge158" length="9.2" source="node156" target="node158"/>
</tree>
<tree id="tree159" xsi:type="nex:IntTree">
<node id="node165" root="true"/>
<node id="node166" label="Pan" otu="taxona"/>
<node id="node167" label="Homo" otu="taxonb"/>
<edge id="edge166" length="11" source="node165" target="node166"/>
<edge id="edge167" length="11" source="node165" target="node167"/>
</tree>
<tree id="tree168" xsi:type="nex:FloatTree">
<node id="node174" root="true"/>
<node id="node175" label="Pan troglodytes" otu="taxona"/>
<node id="node176" label="Homo sapiens" otu="taxonb"/>
<edge id="edge175" length="6.2" source="node174" target="node175"/>
<edge id="edge176" length="6.2" source="node174" target="node176"/>
</tree>
<tree id="tree177" xsi:type="nex:FloatTree">
<node id="node183" root="true"/>
<node id="node184" label="Pan troglodytes" otu="taxona"/>
<node id="node185" label="Homo sapiens" otu="taxonb"/>
<edge id="edge184" length="5.2" source="node183" target="node184"/>
<edge id="edge185" length="5.2" source="node183" target="node185"/>
</tree>
<tree id="tree186" xsi:type="nex:FloatTree">
<node id="node192" root="true"/>
<node id="node193" label="Pan troglodytes" otu="taxona"/>
<node id="node194" label="Homo sapiens" otu="taxonb"/>
<edge id="edge193" length="5.4" source="node192" target="node193"/>
<edge id="edge194" length="5.4" source="node192" target="node194"/>
</tree>
<tree id="tree195" xsi:type="nex:FloatTree">
<node id="node201" root="true"/>
<node id="node202" label="Pan troglodytes" otu="taxona"/>
<node id="node203" label="Homo sapiens" otu="taxonb"/>
<edge id="edge202" length="5.6" source="node201" target="node202"/>
<edge id="edge203" length="5.6" source="node201" target="node203"/>
</tree>
<tree id="tree204" xsi:type="nex:FloatTree">
<node id="node210" root="true"/>
<node id="node211" label="Pan troglodytes" otu="taxona"/>
<node id="node212" label="Homo sapiens" otu="taxonb"/>
<edge id="edge211" length="7.3" source="node210" target="node211"/>
<edge id="edge212" length="7.3" source="node210" target="node212"/>
</tree>
<tree id="tree213" xsi:type="nex:FloatTree">
<node id="node219" root="true"/>
<node id="node220" label="Pan troglodytes" otu="taxona"/>
<node id="node221" label="Homo sapiens" otu="taxonb"/>
<edge id="edge220" length="7.4" source="node219" target="node220"/>
<edge id="edge221" length="7.4" source="node219" target="node221"/>
</tree>
<tree id="tree222" xsi:type="nex:FloatTree">
<node id="node228" root="true"/>
<node id="node229" label="Pan" otu="taxona"/>
<node id="node230" label="Homo sapiens" otu="taxonb"/>
<edge id="edge229" length="6.6" source="node228" target="node229"/>
<edge id="edge230" length="6.6" source="node228" target="node230"/>
</tree>
<tree id="tree231" xsi:type="nex:FloatTree">
<node id="node237" root="true"/>
<node id="node238" label="Pan troglodytes" otu="taxona"/>
<node id="node239" label="Homo sapiens" otu="taxonb"/>
<edge id="edge238" length="5.41" source="node237" target="node238"/>
<edge id="edge239" length="5.41" source="node237" target="node239"/>
</tree>
<tree id="tree240" xsi:type="nex:FloatTree">
<node id="node246" root="true"/>
<node id="node247" label="Pan troglodytes" otu="taxona"/>
<node id="node248" label="Homo sapiens" otu="taxonb"/>
<edge id="edge247" length="6.7" source="node246" target="node247"/>
<edge id="edge248" length="6.7" source="node246" target="node248"/>
</tree>
<tree id="tree249" xsi:type="nex:FloatTree">
<node id="node255" root="true"/>
<node id="node256" label="Pan" otu="taxona"/>
<node id="node257" label="Homo" otu="taxonb"/>
<edge id="edge256" length="4.3" source="node255" target="node256"/>
<edge id="edge257" length="4.3" source="node255" target="node257"/>
</tree>
<tree id="tree258" xsi:type="nex:IntTree">
<node id="node264" root="true"/>
<node id="node265" label="Pan" otu="taxona"/>
<node id="node266" label="Homo" otu="taxonb"/>
<edge id="edge265" length="13" source="node264" target="node265"/>
<edge id="edge266" length="13" source="node264" target="node266"/>
</tree>
<tree id="tree267" xsi:type="nex:FloatTree">
<node id="node273" root="true"/>
<node id="node274" label="Pan troglodytes" otu="taxona"/>
<node id="node275" label="Homo sapiens" otu="taxonb"/>
<edge id="edge274" length="5.5" source="node273" target="node274"/>
<edge id="edge275" length="5.5" source="node273" target="node275"/>
</tree>
<tree id="tree276" xsi:type="nex:FloatTree">
<node id="node282" root="true"/>
<node id="node283" label="Pan troglodytes" otu="taxona"/>
<node id="node284" label="Homo sapiens" otu="taxonb"/>
<edge id="edge283" length="3.6" source="node282" target="node283"/>
<edge id="edge284" length="3.6" source="node282" target="node284"/>
</tree>
<tree id="tree285" xsi:type="nex:IntTree">
<node id="node291" root="true"/>
<node id="node292" label="Pan troglodytes" otu="taxona"/>
<node id="node293" label="Homo sapiens" otu="taxonb"/>
<edge id="edge292" length="4" source="node291" target="node292"/>
<edge id="edge293" length="4" source="node291" target="node293"/>
</tree>
<tree id="tree294" xsi:type="nex:FloatTree">
<node id="node300" root="true"/>
<node id="node301" label="Pan" otu="taxona"/>
<node id="node302" label="Homo sapiens" otu="taxonb"/>
<edge id="edge301" length="5.12" source="node300" target="node301"/>
<edge id="edge302" length="5.12" source="node300" target="node302"/>
</tree>
<tree id="tree303" xsi:type="nex:FloatTree">
<node id="node309" root="true"/>
<node id="node310" label="Pan" otu="taxona"/>
<node id="node311" label="Homo sapiens" otu="taxonb"/>
<edge id="edge310" length="5.55" source="node309" target="node310"/>
<edge id="edge311" length="5.55" source="node309" target="node311"/>
</tree>
<tree id="tree312" xsi:type="nex:FloatTree">
<node id="node318" root="true"/>
<node id="node319" label="Pan troglodytes" otu="taxona"/>
<node id="node320" label="Homo sapiens" otu="taxonb"/>
<edge id="edge319" length="4.87" source="node318" target="node319"/>
<edge id="edge320" length="4.87" source="node318" target="node320"/>
</tree>
<tree id="tree321" xsi:type="nex:FloatTree">
<node id="node327" root="true"/>
<node id="node328" label="Pan troglodytes" otu="taxona"/>
<node id="node329" label="Homo sapiens" otu="taxonb"/>
<edge id="edge328" length="6.4" source="node327" target="node328"/>
<edge id="edge329" length="6.4" source="node327" target="node329"/>
</tree>
<tree id="tree330" xsi:type="nex:FloatTree">
<node id="node336" root="true"/>
<node id="node337" label="Pan" otu="taxona"/>
<node id="node338" label="Homo sapiens" otu="taxonb"/>
<edge id="edge337" length="10.4" source="node336" target="node337"/>
<edge id="edge338" length="10.4" source="node336" target="node338"/>
</tree>
<tree id="tree339" xsi:type="nex:FloatTree">
<node id="node345" root="true"/>
<node id="node346" label="Pan" otu="taxona"/>
<node id="node347" label="Homo sapiens" otu="taxonb"/>
<edge id="edge346" length="13.7" source="node345" target="node346"/>
<edge id="edge347" length="13.7" source="node345" target="node347"/>
</tree>
</trees>
</nex:nexml>

49
Tests/NeXML/tolweb.xml Normal file
View File

@ -0,0 +1,49 @@
<nex:nexml
generator="Bio::Phylo::Project v.0.21_1265"
version="0.9"
xmlns="http://www.nexml.org/2009"
xml:base="http://example.org/"
xmlns:dc="http://purl.org/dc/elements/1.1/contributor"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:nex="http://www.nexml.org/2009"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:tba="http://tolweb.org/tree/home.pages/downloadtree.html#"
xmlns:tbe="http://tolweb.org/tree/home.pages/downloadtree.html#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd">
<otus id="otus26">
<otu id="otu27" label="Eurysphindus"/>
</otus>
<trees about="#trees22" id="trees22" otus="otus26">
<meta content="117855" datatype="xsd:integer" id="meta24" property="dcterms:identifier" xsi:type="nex:LiteralMeta"/>
<meta href="http://tolweb.org/117855" id="meta25" rel="owl:sameAs" xsi:type="nex:ResourceMeta"/>
<tree id="tree1" xsi:type="nex:IntTree">
<node about="#node2" id="node2" root="true">
<meta content="117851" datatype="xsd:integer" id="meta21" property="tba:ID" xsi:type="nex:LiteralMeta"/>
</node>
<node about="#node3" id="node3" label="Eurysphindus" otu="otu27">
<meta content="" datatype="xsd:string" id="meta4" property="dc:description" xsi:type="nex:LiteralMeta"/>
<meta content="Leconte" datatype="xsd:string" id="meta5" property="tbe:AUTHORITY" xsi:type="nex:LiteralMeta"/>
<meta content="1878" datatype="xsd:integer" id="meta6" property="tbe:AUTHDATE" xsi:type="nex:LiteralMeta"/>
<meta content="117851" datatype="xsd:integer" id="meta7" property="tba:ANCESTORWITHPAGE" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta8" property="tba:CHILDCOUNT" xsi:type="nex:LiteralMeta"/>
<meta content="null" datatype="xsd:string" id="meta9" property="tba:COMBINATION_DATE" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta10" property="tba:CONFIDENCE" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta11" property="tba:EXTINCT" xsi:type="nex:LiteralMeta"/>
<meta content="1" datatype="xsd:integer" id="meta12" property="tba:HASPAGE" xsi:type="nex:LiteralMeta"/>
<meta content="117855" datatype="xsd:integer" id="meta13" property="tba:ID" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta14" property="tba:INCOMPLETESUBGROUPS" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta15" property="tba:IS_NEW_COMBINATION" xsi:type="nex:LiteralMeta"/>
<meta content="1" datatype="xsd:integer" id="meta16" property="tba:ITALICIZENAME" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta17" property="tba:LEAF" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta18" property="tba:PHYLESIS" xsi:type="nex:LiteralMeta"/>
<meta content="0" datatype="xsd:integer" id="meta19" property="tba:SHOWAUTHORITY" xsi:type="nex:LiteralMeta"/>
<meta content="1" datatype="xsd:integer" id="meta20" property="tba:SHOWAUTHORITYCONTAINING" xsi:type="nex:LiteralMeta"/>
</node>
<edge id="edge3" source="node2" target="node3"/>
</tree>
</trees>
</nex:nexml>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<nex:nexml
version="0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd"
xmlns:nex="http://www.nexml.org/2009"
xmlns:cdao="http://www.evolutionaryontology.org/cdao/1.0/cdao.owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.nexml.org/2009">
<otus id="tax1" xml:base="http://example.org/taxon/TB2:">
<otu id="t1"/>
<otu id="t2"/>
<otu id="t3"/>
<otu id="t4"/>
<otu id="t5"/>
</otus>
<trees otus="tax1" id="Trees" xml:base="http://example.org/tree/TB2:">
<tree id="tree1" xsi:type="nex:FloatTree">
<node id="n1" root="true"/>
<node id="n2" otu="t1"/>
<node id="n3"/>
<node id="n4"/>
<node id="n5" otu="t3"/>
<node id="n6" otu="t2"/>
<node id="n7"/>
<node id="n8" otu="t5"/>
<node id="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>
</trees>
</nex:nexml>

127
Tests/NeXML/trees.xml Normal file
View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
For an explanation of the structure of the root element
and the taxa element refer to the file taxa.xml.
-->
<nex:nexml
version="0.9"
xml:base="http://example.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xsi:schemaLocation="http://www.nexml.org/2009 ../xsd/nexml.xsd"
xmlns:nex="http://www.nexml.org/2009"
xmlns:cdao="http://www.evolutionaryontology.org/cdao/1.0/cdao.owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns="http://www.nexml.org/2009">
<otus id="tax1" label="RootTaxaBlock">
<otu id="t1"/>
<otu id="t2"/>
<otu id="t3"/>
<otu id="t4"/>
<otu id="t5"/>
</otus>
<!--
The trees block is structured as follows:
* the root element takes the same attributes as
characters elements do: an id, a reference
to a taxa element, and various optional
attributes.
* the trees element contains one or more tree/network
elements, which are the same structure as
GraphML documents (http://graphml.graphdrawing.org/),
with the following extentions:
- there are two subclasses (xsi:type="nex:Tree" and
xsi:type="nex:Network"), which only differ in the
constrained in-degree of node elements (one for
trees, one or more for networks)
- node elements can have an additional taxon attribute
to refer to a taxon element defined earlier
- edge elements can have a 'length' attribute
to specify edge length/weight, which is a
IEEE 754-1985 compliant floating point number on
trees of type FloatTree.
-->
<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" about="#n4">
<meta
id="dict1"
property="cdao:has_tag"
content="true"
xsi:type="nex:LiteralMeta"
datatype="xsd:boolean"/>
</node>
<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="tree2n1" label="n1"/>
<node id="tree2n2" label="n2" otu="t1"/>
<node id="tree2n3" label="n3"/>
<node id="tree2n4" about="#tree2n4" label="n4">
<meta
id="tree2dict1"
property="cdao:has_tag"
content="true"
xsi:type="nex:LiteralMeta"
datatype="xsd:boolean"/>
</node>
<node id="tree2n5" label="n5" otu="t3"/>
<node id="tree2n6" label="n6" otu="t2"/>
<node id="tree2n7" label="n7"/>
<node id="tree2n8" label="n8" otu="t5"/>
<node id="tree2n9" label="n9" otu="t4"/>
<edge source="tree2n1" target="tree2n3" id="tree2e1" length="1"/>
<edge source="tree2n1" target="tree2n2" id="tree2e2" length="2"/>
<edge source="tree2n3" target="tree2n4" id="tree2e3" length="3"/>
<edge source="tree2n3" target="tree2n7" id="tree2e4" length="1"/>
<edge source="tree2n4" target="tree2n5" id="tree2e5" length="2"/>
<edge source="tree2n4" target="tree2n6" id="tree2e6" length="1"/>
<edge source="tree2n7" target="tree2n8" id="tree2e7" length="1"/>
<edge source="tree2n7" target="tree2n9" id="tree2e8" length="1"/>
</tree>
<!--
A network with int edges.
-->
<network id="tree3" xsi:type="nex:IntNetwork" label="tree2">
<node id="tree3n1" label="tree3n1"/>
<node id="tree3n2" label="tree3n2" otu="t1"/>
<node id="tree3n3" label="tree3n3"/>
<node id="tree3n4" label="tree3n4"/>
<node id="tree3n5" label="tree3n5" otu="t3"/>
<node id="tree3n6" label="tree3n6" otu="t2"/>
<node id="tree3n7" label="tree3n7"/>
<node id="tree3n8" label="tree3n8" otu="t5"/>
<node id="tree3n9" label="tree3n9" otu="t4"/>
<edge source="tree3n1" target="tree3n3" id="tree3e1" length="1"/>
<edge source="tree3n1" target="tree3n2" id="tree3e2" length="2"/>
<edge source="tree3n3" target="tree3n4" id="tree3e3" length="3"/>
<edge source="tree3n3" target="tree3n7" id="tree3e4" length="1"/>
<edge source="tree3n4" target="tree3n5" id="tree3e5" length="2"/>
<edge source="tree3n4" target="tree3n6" id="tree3e6" length="1"/>
<edge source="tree3n7" target="tree3n6" id="tree3e7" length="1"/> <!-- extra edge -->
<edge source="tree3n7" target="tree3n8" id="tree3e9" length="1"/>
<edge source="tree3n7" target="tree3n9" id="tree3e8" length="1"/>
</network>
</trees>
</nex:nexml>

73
Tests/test_Phylo_NeXML.py Normal file
View File

@ -0,0 +1,73 @@
# Copyright (C) 2013 by Ben Morris (ben@bendmorris.com)
# based on code by Eric Talevich (eric.talevich@gmail.com)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Unit tests for the NeXML and NeXMLIO modules.
"""
import os
import tempfile
import unittest
import Bio.Phylo as bp
from Bio.Phylo import NeXML, NeXMLIO
# Example NeXML files
example_files = ['NeXML/%s' % f
for f in (
'characters.xml',
'edgelabels.xml',
'meta_taxa.xml',
'meta_types.xml',
'nexml.xml',
'phenoscape.xml',
'sets.xml',
'taxa.xml',
'timetree.xml',
'tolweb.xml',
'treebase-record.xml',
'trees-uris.xml',
'trees.xml',
)]
# Temporary file name for Writer tests below
DUMMY = tempfile.mktemp()
# ---------------------------------------------------------
# Parser tests
def _test_parse_factory(source, count=0):
"""Generate a test method for parse()ing the given source.
The generated function extracts each phylogenetic tree using the parse()
function and counts the total number of trees extracted.
"""
fname = os.path.basename(source)
def test_parse(self):
trees = bp._io.parse(source, 'nexml')
#self.assertEqual(len(list(trees)), count)
test_parse.__doc__ = "Parse the phylogenies in %s." % fname
return test_parse
class ParseTests(unittest.TestCase):
"""Tests for proper parsing of example phyloXML files."""
for n, ex in enumerate(example_files):
parse_test = _test_parse_factory(ex)
parse_test.__name__ = 'test_parse_%s' % n
setattr(ParseTests, parse_test.__name__, parse_test)
if __name__ == '__main__':
runner = unittest.TextTestRunner(verbosity=2)
unittest.main(testRunner=runner)
# Clean up the temporary file
if os.path.exists(DUMMY):
os.remove(DUMMY)