Sha256: 308735dc5edd2a077059972e5d8431fd5ca5478df902ed883dc6bb2f1ff1da13
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
# # = test/bio/db/newick.rb - Unit test for Bio::Newick # # Copyright:: Copyright (C) 2004-2006 # Daniel Amelang <dan@amelang.net> # Naohisa Goto <ng@bioruby.org> # License:: The Ruby License # # $Id: test_newick.rb,v 1.5 2007/04/05 23:35:43 trevor Exp $ # require 'test/unit' require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), [".."] * 4, "lib")).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'bio' require 'bio/tree' require 'bio/db/newick' module Bio class TestNewick < Test::Unit::TestCase TREE_STRING = <<-END_OF_TREE_STRING ( ( HexLEZ35:0.00263, HexMCZ42:0.00788 ):0.00854, ( HexFLZ48:0.00457, ( HexFLZ83:0.00217, HexFLZ13:0.00574 ):0.00100 ):0.04692, HexLEZ73:0.00268 )[0.1250]; END_OF_TREE_STRING def test_string_tree newick = Bio::Newick.new(TREE_STRING) tree = newick.tree assert_equal(3, tree.children(tree.root).size) assert_equal(9, tree.descendents(tree.root).size) assert_equal(6, tree.leaves.size) leaf = tree.get_node_by_name('HexFLZ83') assert_equal(3, tree.ancestors(leaf).size) assert_equal(tree.path(tree.root, leaf)[1], tree.ancestors(leaf)[1]) assert_equal(0.00217, tree.get_edge(leaf, tree.parent(leaf)).distance) assert_equal("HexFLZ83", leaf.name) end end #class TestNewick end #module Bio
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bio-1.1.0 | test/unit/bio/db/test_newick.rb |