From 65cab4a8dc67e82e562572ed5e0f5fa44df6f622 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Tue, 1 Mar 2011 03:57:01 +0000 Subject: [PATCH] Edited wiki page PhyloBioRuby through web user interface. --- wiki/PhyloBioRuby.wiki | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wiki/PhyloBioRuby.wiki b/wiki/PhyloBioRuby.wiki index e7cfbd3..622deb1 100644 --- a/wiki/PhyloBioRuby.wiki +++ b/wiki/PhyloBioRuby.wiki @@ -217,20 +217,22 @@ In addition to !BioRuby, a libxml Ruby binding is also required. This can be ins % gem install -r libxml-ruby }}} +This example reads file "example.xml" and stores its [http://www.phyloxml.org/ phyloXML]-formatted trees in variable 'trees'. + {{{ #!/usr/bin/env ruby require 'bio' # This creates new phyloXML parser. -phyloxml = Bio::PhyloXML::Parser.new('example.xml') +trees = Bio::PhyloXML::Parser.new('example.xml') # This prints the names of all trees in the file. -phyloxml.each do |tree| +trees.each do |tree| puts tree.name end # If there are several trees in the file, you can access the one you wish via index. -tree = phyloxml[3] +tree = trees[3] }}} @@ -258,6 +260,7 @@ In addition to !BioRuby, a libxml Ruby binding is also required. This can be ins % gem install -r libxml-ruby }}} +This example writes trees 'tree1' and 'tree2' to file "tree.xml" in [http://www.phyloxml.org/ phyloXML] format. {{{ #!/usr/bin/env ruby -- 1.7.10.2