Difference between revisions of "BioRuby PhyloXML HowTo documentation"

From Phyloinformatics
Jump to: navigation, search
m (How to parse a file)
m (How to parse a file)
Line 14: Line 14:
 
<code>
 
<code>
 
  require 'bio'
 
  require 'bio'
 
+
 
 
  # Create new phyloxml parser
 
  # Create new phyloxml parser
 
  phyloxml = Bio::PhyloXML::Parser.new('example.xml')
 
  phyloxml = Bio::PhyloXML::Parser.new('example.xml')
 
+
 
 
  # Print the names of all trees in the file
 
  # Print the names of all trees in the file
 
  phyloxml.each do |tree|
 
  phyloxml.each do |tree|

Revision as of 20:44, 11 August 2009

Intro

PhyloXML is a tree format for saving and exchanging data of annotated phylogenetic trees. PhyloXML parsers and writers are implemented in BioRuby, BioPython and BioPerl. More information at www.phyloxml.org

Requirements

In addition to BioRuby library you need a libxml ruby bindings. To install:

gem install -r libxml-ruby

How to parse a file

require 'bio'
 
# Create new phyloxml parser
phyloxml = Bio::PhyloXML::Parser.new('example.xml')
 
# Print the names of all trees in the file
phyloxml.each do |tree|
  puts tree.name
end