Skip to main content
Fig. 6 | BMC Bioinformatics

Fig. 6

From: JPhyloIO: a Java library for event-based reading and writing of different phylogenetic file formats through a common interface

Fig. 6

Example code for format-independent metadata writing. The code examples in the two boxes on top show how metadata can be written in JPhyloIO. In the lower of the two boxes two support values are attached to a node as literal metadata elements using predicates from a fictional ontology http://example.com/someOntology. The used convenience method writeSimpleLiteralMetadata internally writes a literal metadata start event followed by a respective content and end event as defined by the grammar node LiteralMeta in Fig. 3. The upper box contains an example where literal metadata elements are nested within resource metadata elements. In the concrete example respective predicates for phyloXML are used to write an NCBI taxonomy ID. The metadata trees attached to the node (in purple) and the branch (in red) are shown on top of the figure. All predicates linking metadata are shown in green, while the actual metadata values are shown in blue. Below the resulting output is shown for three formats. The first box contains NeXML, which uses its meta tags to represent the metadata and the linking predicates. The second contains phyloXML that uses its specific taxonomy-related elements to represent the node metadata and its property tags to model the branch metadata. (In contrast to NeXML, using fully qualified predicates with namespace declarations is not supported.) The box on the bottom contains the NEXUS output, where only the metadata from the lowest level is represented using hot comments within the Newick string. (Using fully qualified predicates is not possible here either). The full source code and output of this example can be found at http://r.bioinfweb.info/JPhyloIODemoSimpleMetadata. Additional examples for processing data and metadata are also available on the JPhyloIO website

Back to article page