forked from bioruby/bioruby
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_report.rb
42 lines (32 loc) · 1.25 KB
/
test_report.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# test/unit/bio/appl/paml/codeml/test_report.rb - Unit test for Bio::PAML::Codeml::Report
#
# Copyright:: Copyright (C) 2008 Michael D. Barton <mail@michaelbarton.me.uk>
# License:: The Ruby License
#
require 'pathname'
libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 6, 'lib'))).cleanpath.to_s
$:.unshift(libpath) unless $:.include?(libpath)
require 'test/unit'
require 'bio/appl/paml/codeml/report'
class TestCodemlReport < Test::Unit::TestCase
bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 6)).cleanpath.to_s
TEST_DATA = Pathname.new(File.join(bioruby_root, 'test', 'data', 'paml', 'codeml')).cleanpath.to_s
def setup
str = File.read(File.join(TEST_DATA, 'output.txt'))
@example_report = Bio::PAML::Codeml::Report.new(str)
end
def test_tree_log_likelihood
assert_equal(-1817.465211, @example_report.tree_log_likelihood)
end
def test_tree_length
assert_equal(0.77902, @example_report.tree_length)
end
def test_alpha
assert_equal(0.58871, @example_report.alpha)
end
def test_tree
tree = "(((rabbit: 0.082889, rat: 0.187866): 0.038008, human: 0.055050): 0.033639, goat-cow: 0.096992, marsupial: 0.284574);"
assert_equal(tree, @example_report.tree)
end
end