bio 1.5.2 → 1.6.0.pre.20181210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +12 -11
- data/ChangeLog +14 -3106
- data/{gemfiles/Gemfile.travis-ruby2.2 → Gemfile} +0 -1
- data/KNOWN_ISSUES.rdoc +0 -5
- data/README.rdoc +11 -18
- data/RELEASE_NOTES.rdoc +34 -291
- data/Rakefile +13 -9
- data/appveyor.yml +21 -0
- data/bioruby.gemspec +7 -78
- data/bioruby.gemspec.erb +8 -27
- data/doc/ChangeLog-1.5.0 +2919 -0
- data/doc/RELEASE_NOTES-1.5.0.rdoc +285 -0
- data/doc/Tutorial.rd +6 -108
- data/doc/Tutorial.rd.html +19 -98
- data/gemfiles/Gemfile.travis-jruby1.8 +3 -5
- data/gemfiles/Gemfile.travis-jruby1.9 +0 -3
- data/gemfiles/Gemfile.travis-rbx +0 -1
- data/gemfiles/Gemfile.travis-ruby1.8 +4 -4
- data/gemfiles/Gemfile.travis-ruby1.9 +0 -1
- data/gemfiles/prepare-gemspec.rb +4 -0
- data/lib/bio.rb +0 -10
- data/lib/bio/data/codontable.rb +99 -3
- data/lib/bio/io/togows.rb +5 -5
- data/lib/bio/version.rb +6 -8
- data/sample/test_restriction_enzyme_long.rb +1 -1
- data/test/unit/bio/data/test_codontable.rb +3 -0
- metadata +11 -77
- data/bin/bioruby +0 -47
- data/bin/br_biofetch.rb +0 -71
- data/bin/br_bioflat.rb +0 -293
- data/bin/br_biogetseq.rb +0 -45
- data/bin/br_pmfetch.rb +0 -422
- data/lib/bio/db/biosql/biosql_to_biosequence.rb +0 -78
- data/lib/bio/db/biosql/sequence.rb +0 -444
- data/lib/bio/db/phyloxml/phyloxml.xsd +0 -582
- data/lib/bio/db/phyloxml/phyloxml_elements.rb +0 -1197
- data/lib/bio/db/phyloxml/phyloxml_parser.rb +0 -1001
- data/lib/bio/db/phyloxml/phyloxml_writer.rb +0 -227
- data/lib/bio/io/biosql/ar-biosql.rb +0 -257
- data/lib/bio/io/biosql/biosql.rb +0 -39
- data/lib/bio/io/biosql/config/database.yml +0 -21
- data/lib/bio/io/sql.rb +0 -79
- data/lib/bio/shell.rb +0 -44
- data/lib/bio/shell/core.rb +0 -578
- data/lib/bio/shell/demo.rb +0 -146
- data/lib/bio/shell/interface.rb +0 -217
- data/lib/bio/shell/irb.rb +0 -94
- data/lib/bio/shell/object.rb +0 -71
- data/lib/bio/shell/plugin/blast.rb +0 -42
- data/lib/bio/shell/plugin/codon.rb +0 -218
- data/lib/bio/shell/plugin/das.rb +0 -58
- data/lib/bio/shell/plugin/emboss.rb +0 -23
- data/lib/bio/shell/plugin/entry.rb +0 -137
- data/lib/bio/shell/plugin/flatfile.rb +0 -101
- data/lib/bio/shell/plugin/midi.rb +0 -430
- data/lib/bio/shell/plugin/ncbirest.rb +0 -68
- data/lib/bio/shell/plugin/obda.rb +0 -45
- data/lib/bio/shell/plugin/psort.rb +0 -56
- data/lib/bio/shell/plugin/seq.rb +0 -248
- data/lib/bio/shell/plugin/togows.rb +0 -40
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb +0 -29
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml +0 -4
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml +0 -27
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_methods.rhtml +0 -11
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_modules.rhtml +0 -4
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_variables.rhtml +0 -7
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-bg.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-gem.png +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-link.gif +0 -0
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.css +0 -368
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.rhtml +0 -47
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_controller.rb +0 -144
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb +0 -47
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/commands.rhtml +0 -8
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/history.rhtml +0 -10
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/index.rhtml +0 -26
- data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/spinner.gif +0 -0
- data/lib/bio/shell/script.rb +0 -25
- data/lib/bio/shell/setup.rb +0 -108
- data/lib/bio/shell/web.rb +0 -102
- data/sample/test_phyloxml_big.rb +0 -205
- data/test/data/phyloxml/apaf.xml +0 -666
- data/test/data/phyloxml/bcl_2.xml +0 -2097
- data/test/data/phyloxml/made_up.xml +0 -144
- data/test/data/phyloxml/ncbi_taxonomy_mollusca_short.xml +0 -65
- data/test/data/phyloxml/phyloxml_examples.xml +0 -415
- data/test/unit/bio/db/biosql/tc_biosql.rb +0 -114
- data/test/unit/bio/db/biosql/ts_suite_biosql.rb +0 -8
- data/test/unit/bio/db/test_phyloxml.rb +0 -821
- data/test/unit/bio/db/test_phyloxml_writer.rb +0 -334
- data/test/unit/bio/shell/plugin/test_seq.rb +0 -187
- data/test/unit/bio/test_shell.rb +0 -20
@@ -1,114 +0,0 @@
|
|
1
|
-
# To change this template, choose Tools | Templates
|
2
|
-
# and open the template in the editor.
|
3
|
-
|
4
|
-
# loading helper routine for testing bioruby
|
5
|
-
require 'pathname'
|
6
|
-
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
|
7
|
-
'bioruby_test_helper.rb')).cleanpath.to_s
|
8
|
-
|
9
|
-
# libraries needed for the tests
|
10
|
-
require 'test/unit'
|
11
|
-
require 'bio'
|
12
|
-
|
13
|
-
module Bio
|
14
|
-
class TestBiosqlIO < Test::Unit::TestCase
|
15
|
-
def setup
|
16
|
-
@connection = Bio::SQL.establish_connection({'development'=>{'hostname'=>'localhost','database'=>"bioseq", 'adapter'=>"jdbcmysql", 'username'=>"febo", 'password'=>nil}},'development')
|
17
|
-
@str_genbank=<<END
|
18
|
-
LOCUS X64011 756 bp DNA linear BCT 26-SEP-2006
|
19
|
-
DEFINITION Listeria ivanovii sod gene for superoxide dismutase.
|
20
|
-
ACCESSION X64011 S78972
|
21
|
-
VERSION X64011.1 GI:44010
|
22
|
-
KEYWORDS sod gene; superoxide dismutase.
|
23
|
-
SOURCE Listeria ivanovii
|
24
|
-
ORGANISM Listeria ivanovii
|
25
|
-
Bacteria; Firmicutes; Bacillales; Listeriaceae; Listeria.
|
26
|
-
REFERENCE 1
|
27
|
-
AUTHORS Haas,A. and Goebel,W.
|
28
|
-
TITLE Cloning of a superoxide dismutase gene from Listeria ivanovii by
|
29
|
-
functional complementation in Escherichia coli and characterization
|
30
|
-
of the gene product
|
31
|
-
JOURNAL Mol. Gen. Genet. 231 (2), 313-322 (1992)
|
32
|
-
PUBMED 1736100
|
33
|
-
REFERENCE 2 (bases 1 to 756)
|
34
|
-
AUTHORS Kreft,J.
|
35
|
-
TITLE Direct Submission
|
36
|
-
JOURNAL Submitted (21-APR-1992) J. Kreft, Institut f. Mikrobiologie,
|
37
|
-
Universitaet Wuerzburg, Biozentrum Am Hubland, 8700 Wuerzburg, FRG
|
38
|
-
COMMENT On Jun 23, 2005 this sequence version replaced gi:244394.
|
39
|
-
FEATURES Location/Qualifiers
|
40
|
-
source 1..756
|
41
|
-
/organism="Listeria ivanovii"
|
42
|
-
/mol_type="genomic DNA"
|
43
|
-
/strain="ATCC 19119"
|
44
|
-
/db_xref="taxon:1638"
|
45
|
-
gene 95..746
|
46
|
-
/gene="sod"
|
47
|
-
RBS 95..100
|
48
|
-
/gene="sod"
|
49
|
-
CDS 109..717
|
50
|
-
/gene="sod"
|
51
|
-
/EC_number="1.15.1.1"
|
52
|
-
/codon_start=1
|
53
|
-
/transl_table=11
|
54
|
-
/product="superoxide dismutase"
|
55
|
-
/protein_id="CAA45406.1"
|
56
|
-
/db_xref="GI:44011"
|
57
|
-
/db_xref="GOA:P28763"
|
58
|
-
/db_xref="InterPro:IPR001189"
|
59
|
-
/db_xref="UniProtKB/Swiss-Prot:P28763"
|
60
|
-
/translation="MTYELPKLPYTYDALEPNFDKETMEIHYTKHHNIYVTKLNEAVS
|
61
|
-
GHAELASKPGEELVANLDSVPEEIRGAVRNHGGGHANHTLFWSSLSPNGGGAPTGNLK
|
62
|
-
AAIESEFGTFDEFKEKFNAAAAARFGSGWAWLVVNNGKLEIVSTANQDSPLSEGKTPV
|
63
|
-
LGLDVWEHAYYLKFQNRRPEYIDTFWNVINWDERNKRFDAAK"
|
64
|
-
terminator 723..746
|
65
|
-
/gene="sod"
|
66
|
-
ORIGIN
|
67
|
-
1 cgttatttaa ggtgttacat agttctatgg aaatagggtc tatacctttc gccttacaat
|
68
|
-
61 gtaatttctt ttcacataaa taataaacaa tccgaggagg aatttttaat gacttacgaa
|
69
|
-
121 ttaccaaaat taccttatac ttatgatgct ttggagccga attttgataa agaaacaatg
|
70
|
-
181 gaaattcact atacaaagca ccacaatatt tatgtaacaa aactaaatga agcagtctca
|
71
|
-
241 ggacacgcag aacttgcaag taaacctggg gaagaattag ttgctaatct agatagcgtt
|
72
|
-
301 cctgaagaaa ttcgtggcgc agtacgtaac cacggtggtg gacatgctaa ccatacttta
|
73
|
-
361 ttctggtcta gtcttagccc aaatggtggt ggtgctccaa ctggtaactt aaaagcagca
|
74
|
-
421 atcgaaagcg aattcggcac atttgatgaa ttcaaagaaa aattcaatgc ggcagctgcg
|
75
|
-
481 gctcgttttg gttcaggatg ggcatggcta gtagtgaaca atggtaaact agaaattgtt
|
76
|
-
541 tccactgcta accaagattc tccacttagc gaaggtaaaa ctccagttct tggcttagat
|
77
|
-
601 gtttgggaac atgcttatta tcttaaattc caaaaccgtc gtcctgaata cattgacaca
|
78
|
-
661 ttttggaatg taattaactg ggatgaacga aataaacgct ttgacgcagc aaaataatta
|
79
|
-
721 tcgaaaggct cacttaggtg ggtcttttta tttcta
|
80
|
-
//
|
81
|
-
END
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_00_connection
|
85
|
-
assert_instance_of(ActiveRecord::ConnectionAdapters::ConnectionPool, @connection)
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_01_input_is_genbank
|
89
|
-
assert_instance_of(Bio::GenBank,Bio::GenBank.new(@str_genbank))
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_02_insert_bioentry
|
93
|
-
@@x = Bio::SQL::Sequence.new(:biosequence=>Bio::GenBank.new(@str_genbank).to_biosequence, :biodatabase=>Bio::SQL::Biodatabase.find(:first))
|
94
|
-
assert_not_nil(@@x)
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_03_input_output
|
98
|
-
bioseq = Bio::SQL.fetch_accession("X64011")
|
99
|
-
assert_not_nil bioseq
|
100
|
-
assert_equal(@str_genbank, bioseq.to_biosequence.output(:genbank))
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_04_bioentry_data_format
|
104
|
-
assert_equal('26-SEP-2006', @@x.date_modified.to_s)
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_05_title
|
108
|
-
assert_equal('Cloning of a superoxide dismutase gene from Listeria ivanovii by functional complementation in Escherichia coli and characterization of the gene product',@@x.references.first.title)
|
109
|
-
end
|
110
|
-
def test_99_delete_bioentry
|
111
|
-
assert_not_nil(@@x.delete)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
@@ -1,821 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# = test/unit/bio/db/test_phyloxml.rb - Unit test for Bio::PhyloXML::Parser
|
3
|
-
#
|
4
|
-
# Copyright:: Copyright (C) 2009
|
5
|
-
# Diana Jaunzeikare <latvianlinuxgirl@gmail.com>
|
6
|
-
# License:: The Ruby License
|
7
|
-
#
|
8
|
-
|
9
|
-
# loading helper routine for testing bioruby
|
10
|
-
require 'pathname'
|
11
|
-
load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3,
|
12
|
-
'bioruby_test_helper.rb')).cleanpath.to_s
|
13
|
-
|
14
|
-
# libraries needed for the tests
|
15
|
-
require 'test/unit'
|
16
|
-
|
17
|
-
begin
|
18
|
-
require 'libxml'
|
19
|
-
rescue LoadError
|
20
|
-
end
|
21
|
-
|
22
|
-
if defined?(LibXML) then
|
23
|
-
require 'bio/db/phyloxml/phyloxml_parser'
|
24
|
-
end
|
25
|
-
|
26
|
-
module Bio
|
27
|
-
class TestPhyloXML_Check_LibXML < Test::Unit::TestCase
|
28
|
-
def test_libxml
|
29
|
-
assert(defined?(LibXML),
|
30
|
-
"Error: libxml-ruby library is not present. Please install libxml-ruby library. It is needed for Bio::PhyloXML module. Unit test for PhyloXML will not be performed.")
|
31
|
-
end
|
32
|
-
end #class TestPhyloXML_LibXMLCheck
|
33
|
-
end #module Bio
|
34
|
-
|
35
|
-
module Bio
|
36
|
-
|
37
|
-
module TestPhyloXMLData
|
38
|
-
|
39
|
-
PHYLOXML_TEST_DATA = Pathname.new(File.join(BioRubyTestDataPath, 'phyloxml')).cleanpath.to_s
|
40
|
-
|
41
|
-
def self.example_xml
|
42
|
-
File.join PHYLOXML_TEST_DATA, 'phyloxml_examples.xml'
|
43
|
-
#If you want to test the output of writer, then do this:
|
44
|
-
#File.join PHYLOXML_TEST_DATA, 'phyloxml_examples_test.xml'
|
45
|
-
# But make sure you run ruby test/unit/bio/db/test_phyloxml_writer.rb before
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.made_up_xml
|
49
|
-
File.join PHYLOXML_TEST_DATA, 'made_up.xml'
|
50
|
-
#If you want to test the output of writer, then do this:
|
51
|
-
#File.join PHYLOXML_TEST_DATA, 'made_up_test.xml'
|
52
|
-
# But make sure you run ruby test/unit/bio/db/test_phyloxml_writer.rb before
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.metazoa_xml
|
56
|
-
File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_metazoa.xml'
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.mollusca_xml
|
60
|
-
File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_mollusca.xml'
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.life_xml
|
64
|
-
File.join PHYLOXML_TEST_DATA, 'tol_life_on_earth_1.xml'
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.dollo_xml
|
68
|
-
File.join PHYLOXML_TEST_DATA, 'o_tol_332_d_dollo.xml'
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.mollusca_short_xml
|
72
|
-
File.join PHYLOXML_TEST_DATA, 'ncbi_taxonomy_mollusca_short.xml'
|
73
|
-
end
|
74
|
-
|
75
|
-
end #end module TestPhyloXMLData
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
class TestPhyloXML_class_methods < Test::Unit::TestCase
|
80
|
-
|
81
|
-
def test_open
|
82
|
-
filename = TestPhyloXMLData.example_xml
|
83
|
-
assert_instance_of(Bio::PhyloXML::Parser,
|
84
|
-
phyloxml = Bio::PhyloXML::Parser.open(filename))
|
85
|
-
common_test_next_tree(phyloxml)
|
86
|
-
phyloxml.close
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_open_with_block
|
90
|
-
filename = TestPhyloXMLData.example_xml
|
91
|
-
phyloxml_bak = nil
|
92
|
-
ret = Bio::PhyloXML::Parser.open(filename) do |phyloxml|
|
93
|
-
assert_instance_of(Bio::PhyloXML::Parser, phyloxml)
|
94
|
-
common_test_next_tree(phyloxml)
|
95
|
-
phyloxml_bak = phyloxml
|
96
|
-
"ok"
|
97
|
-
end
|
98
|
-
assert_equal("ok", ret)
|
99
|
-
assert_equal(true, phyloxml_bak.closed?)
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_new
|
103
|
-
str = File.open(TestPhyloXMLData.example_xml, "rb") { |f| f.read }
|
104
|
-
assert_instance_of(Bio::PhyloXML::Parser,
|
105
|
-
phyloxml = Bio::PhyloXML::Parser.new(str))
|
106
|
-
common_test_next_tree(phyloxml)
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_for_io
|
110
|
-
io = File.open(TestPhyloXMLData.example_xml)
|
111
|
-
assert_instance_of(Bio::PhyloXML::Parser,
|
112
|
-
phyloxml = Bio::PhyloXML::Parser.for_io(io))
|
113
|
-
common_test_next_tree(phyloxml)
|
114
|
-
io.close
|
115
|
-
end
|
116
|
-
|
117
|
-
def common_test_next_tree(phyloxml)
|
118
|
-
tree = phyloxml.next_tree
|
119
|
-
tree_arr = []
|
120
|
-
while tree != nil do
|
121
|
-
tree_arr[tree_arr.length] = tree.name
|
122
|
-
tree = phyloxml.next_tree
|
123
|
-
end
|
124
|
-
assert_equal(13, tree_arr.length)
|
125
|
-
end
|
126
|
-
private :common_test_next_tree
|
127
|
-
|
128
|
-
end #class TestPhyloXML_class_methods
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
class TestPhyloXML_private_methods < Test::Unit::TestCase
|
133
|
-
def setup
|
134
|
-
@phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
135
|
-
end
|
136
|
-
|
137
|
-
def teardown
|
138
|
-
@phyloxml.close
|
139
|
-
end
|
140
|
-
|
141
|
-
def test__validate
|
142
|
-
assert_nothing_raised {
|
143
|
-
@phyloxml.instance_eval {
|
144
|
-
_validate(:file, TestPhyloXMLData.example_xml)
|
145
|
-
}
|
146
|
-
}
|
147
|
-
end
|
148
|
-
|
149
|
-
def test__validate_string
|
150
|
-
assert_nothing_raised {
|
151
|
-
@phyloxml.instance_eval {
|
152
|
-
_validate(:string, '<?xml version="1.0"?><phyloxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.phyloxml.org http://www.phyloxml.org/1.10/phyloxml.xsd" xmlns="http://www.phyloxml.org"/>')
|
153
|
-
}
|
154
|
-
}
|
155
|
-
end
|
156
|
-
|
157
|
-
def test__validate_validation_error
|
158
|
-
libxml_set_handler_quiet
|
159
|
-
assert_raise(RuntimeError) {
|
160
|
-
@phyloxml.instance_eval {
|
161
|
-
_validate(:string, '<a>test</a>')
|
162
|
-
}
|
163
|
-
}
|
164
|
-
libxml_set_handler_verbose
|
165
|
-
end
|
166
|
-
|
167
|
-
def test__schema
|
168
|
-
s = @phyloxml.instance_eval { _schema }
|
169
|
-
assert_instance_of(LibXML::XML::Schema, s)
|
170
|
-
end
|
171
|
-
|
172
|
-
def test__secure_filename
|
173
|
-
assert_equal('http:/bioruby.org/test.xml',
|
174
|
-
@phyloxml.instance_eval {
|
175
|
-
_secure_filename('http://bioruby.org/test.xml')
|
176
|
-
})
|
177
|
-
end
|
178
|
-
|
179
|
-
def test__secure_filename_unchanged
|
180
|
-
assert_equal('test/test.xml',
|
181
|
-
@phyloxml.instance_eval {
|
182
|
-
_secure_filename('test/test.xml')
|
183
|
-
})
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_ClosedPhyloXMLParser
|
187
|
-
cp = Bio::PhyloXML::Parser::ClosedPhyloXMLParser.new
|
188
|
-
assert_raise(LibXML::XML::Error) { cp.next_tree }
|
189
|
-
end
|
190
|
-
|
191
|
-
private
|
192
|
-
|
193
|
-
def libxml_set_handler_quiet
|
194
|
-
# Sets quiet handler.
|
195
|
-
# Note that there are no way to get current handler.
|
196
|
-
LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER)
|
197
|
-
end
|
198
|
-
|
199
|
-
def libxml_set_handler_verbose
|
200
|
-
# Sets verbose handler (default LibXML error handler).
|
201
|
-
# Note that there are no way to get current handler.
|
202
|
-
LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
|
203
|
-
end
|
204
|
-
end #class TestPhyloXML_private_methods
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
class TestPhyloXML_close < Test::Unit::TestCase
|
209
|
-
def phyloxml_open(&block)
|
210
|
-
Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml, &block)
|
211
|
-
end
|
212
|
-
private :phyloxml_open
|
213
|
-
|
214
|
-
def test_close
|
215
|
-
phyloxml = phyloxml_open
|
216
|
-
phyloxml.next_tree
|
217
|
-
assert_nil(phyloxml.close)
|
218
|
-
end
|
219
|
-
|
220
|
-
def test_closed?
|
221
|
-
phyloxml = phyloxml_open
|
222
|
-
assert_equal(false, phyloxml.closed?)
|
223
|
-
phyloxml.next_tree
|
224
|
-
assert_equal(false, phyloxml.closed?)
|
225
|
-
phyloxml.close
|
226
|
-
assert_equal(true, phyloxml.closed?)
|
227
|
-
end
|
228
|
-
|
229
|
-
def test_closed_with_block
|
230
|
-
ret = phyloxml_open do |phyloxml|
|
231
|
-
assert_equal(false, phyloxml.closed?)
|
232
|
-
phyloxml.next_tree
|
233
|
-
assert_equal(false, phyloxml.closed?)
|
234
|
-
phyloxml
|
235
|
-
end
|
236
|
-
assert_equal(true, ret.closed?)
|
237
|
-
end
|
238
|
-
|
239
|
-
def test_close_after_close
|
240
|
-
phyloxml = phyloxml_open
|
241
|
-
phyloxml.close
|
242
|
-
assert_raise(LibXML::XML::Error) { phyloxml.close }
|
243
|
-
end
|
244
|
-
|
245
|
-
def test_next_tree_after_close
|
246
|
-
phyloxml = phyloxml_open
|
247
|
-
phyloxml.close
|
248
|
-
assert_raise(LibXML::XML::Error) { phyloxml.next_tree }
|
249
|
-
end
|
250
|
-
|
251
|
-
def test_next_tree_after_open_with_block
|
252
|
-
phyloxml = phyloxml_open { |arg| arg }
|
253
|
-
assert_raise(LibXML::XML::Error) { phyloxml.next_tree }
|
254
|
-
end
|
255
|
-
|
256
|
-
def test_close_after_open_with_block
|
257
|
-
phyloxml = phyloxml_open { |arg| arg }
|
258
|
-
assert_raise(LibXML::XML::Error) { phyloxml.close }
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_close_in_open_with_block
|
262
|
-
phyloxml = phyloxml_open do |arg|
|
263
|
-
ret = arg
|
264
|
-
assert_nil(arg.close)
|
265
|
-
ret
|
266
|
-
end
|
267
|
-
assert_raise(LibXML::XML::Error) { phyloxml.close }
|
268
|
-
end
|
269
|
-
|
270
|
-
def test_close_does_not_affect_io
|
271
|
-
io = File.open(TestPhyloXMLData.example_xml)
|
272
|
-
phyloxml = Bio::PhyloXML::Parser.for_io(io)
|
273
|
-
phyloxml.next_tree
|
274
|
-
phyloxml.close
|
275
|
-
assert(!io.closed?)
|
276
|
-
end
|
277
|
-
end #class TestPhyloXML_close
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
class TestPhyloXML1 < Test::Unit::TestCase
|
282
|
-
|
283
|
-
def setup
|
284
|
-
@phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
285
|
-
end
|
286
|
-
|
287
|
-
def teardown
|
288
|
-
@phyloxml.close
|
289
|
-
end
|
290
|
-
|
291
|
-
def test_initialize
|
292
|
-
assert_instance_of(Bio::PhyloXML::Parser, @phyloxml)
|
293
|
-
end
|
294
|
-
|
295
|
-
def test_next_tree()
|
296
|
-
tree = @phyloxml.next_tree
|
297
|
-
tree_arr = []
|
298
|
-
while tree != nil do
|
299
|
-
|
300
|
-
tree_arr[tree_arr.length] = tree.name
|
301
|
-
tree = @phyloxml.next_tree
|
302
|
-
end
|
303
|
-
assert_equal(13, tree_arr.length)
|
304
|
-
end
|
305
|
-
|
306
|
-
end #class TestPhyloXML1
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
class TestPhyloXML2 < Test::Unit::TestCase
|
311
|
-
|
312
|
-
#setup is called before and every time any function es executed.
|
313
|
-
def setup
|
314
|
-
@phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
315
|
-
@tree = @phyloxml.next_tree
|
316
|
-
end
|
317
|
-
|
318
|
-
def test_tree_name
|
319
|
-
assert_equal("example from Prof. Joe Felsenstein's book \"Inferring Phylogenies\"", @tree.name)
|
320
|
-
end
|
321
|
-
|
322
|
-
def test_tree_description
|
323
|
-
assert_equal("phyloXML allows to use either a \"branch_length\" attribute or element to indicate branch lengths.", @tree.description)
|
324
|
-
end
|
325
|
-
|
326
|
-
def test_branch_length_attribute
|
327
|
-
assert_equal(0.792, @tree.total_distance)
|
328
|
-
end
|
329
|
-
|
330
|
-
def test_rooted_atr
|
331
|
-
assert_equal(true, @tree.rooted)
|
332
|
-
end
|
333
|
-
|
334
|
-
|
335
|
-
def test_branch_length_tag
|
336
|
-
@tree = @phyloxml.next_tree
|
337
|
-
assert_equal(0.792, @tree.total_distance)
|
338
|
-
end
|
339
|
-
|
340
|
-
def test_bootstrap
|
341
|
-
#iterate throuch first 2 trees to get to the third
|
342
|
-
@tree = @phyloxml.next_tree
|
343
|
-
@tree = @phyloxml.next_tree
|
344
|
-
node = @tree.get_node_by_name("AB")
|
345
|
-
assert_equal('bootstrap', node.confidences[0].type)
|
346
|
-
assert_equal(89, node.confidences[0].value)
|
347
|
-
end
|
348
|
-
|
349
|
-
def test_to_biotreenode_bootstrap
|
350
|
-
#iterate throuch first 2 trees to get to the third
|
351
|
-
@tree = @phyloxml.next_tree
|
352
|
-
@tree = @phyloxml.next_tree
|
353
|
-
node = @tree.get_node_by_name("AB")
|
354
|
-
bionode = node.to_biotreenode
|
355
|
-
assert_equal(89, bionode.bootstrap)
|
356
|
-
end
|
357
|
-
|
358
|
-
def test_duplications
|
359
|
-
4.times do
|
360
|
-
@tree = @phyloxml.next_tree
|
361
|
-
end
|
362
|
-
node = @tree.root
|
363
|
-
assert_equal(1, node.events.speciations)
|
364
|
-
end
|
365
|
-
|
366
|
-
def test_taxonomy_scientific_name
|
367
|
-
3.times do
|
368
|
-
@tree = @phyloxml.next_tree
|
369
|
-
end
|
370
|
-
t = @tree.get_node_by_name('A').taxonomies[0]
|
371
|
-
assert_equal('E. coli', t.scientific_name)
|
372
|
-
assert_equal("J. G. Cooper, 1863", t.authority)
|
373
|
-
t = @tree.get_node_by_name('C').taxonomies[0]
|
374
|
-
assert_equal('C. elegans', t.scientific_name)
|
375
|
-
end
|
376
|
-
|
377
|
-
def test_taxonomy_id
|
378
|
-
5.times do
|
379
|
-
@tree = @phyloxml.next_tree
|
380
|
-
end
|
381
|
-
leaves = @tree.leaves
|
382
|
-
codes = []
|
383
|
-
ids = []
|
384
|
-
#id_types = []
|
385
|
-
leaves.each { |node|
|
386
|
-
codes[codes.length] = node.taxonomies[0].code
|
387
|
-
ids[ids.length] = node.taxonomies[0].taxonomy_id
|
388
|
-
#id_types[id_types.length] = node.taxonomy.id_type
|
389
|
-
}
|
390
|
-
assert_equal(["CLOAB", "DICDI", "OCTVU"], codes.sort)
|
391
|
-
#@todo assert ids, id_types. or create new class for id.
|
392
|
-
end
|
393
|
-
|
394
|
-
def test_taxonomy2
|
395
|
-
9.times do
|
396
|
-
@tree = @phyloxml.next_tree
|
397
|
-
end
|
398
|
-
taxonomy = @tree.root.taxonomies[0]
|
399
|
-
assert_equal("8556", taxonomy.taxonomy_id.value)
|
400
|
-
assert_equal("NCBI", taxonomy.taxonomy_id.provider)
|
401
|
-
assert_equal("Varanus", taxonomy.scientific_name)
|
402
|
-
assert_equal("genus", taxonomy.rank)
|
403
|
-
assert_equal("EMBL REPTILE DATABASE", taxonomy.uri.desc)
|
404
|
-
assert_equal("http://www.embl-heidelberg.de/~uetz/families/Varanidae.html", taxonomy.uri.uri)
|
405
|
-
end
|
406
|
-
|
407
|
-
def test_distribution_desc
|
408
|
-
9.times do
|
409
|
-
@tree = @phyloxml.next_tree
|
410
|
-
end
|
411
|
-
leaves = @tree.leaves
|
412
|
-
descrs = []
|
413
|
-
leaves.each { |node|
|
414
|
-
descrs << node.distributions[0].desc
|
415
|
-
}
|
416
|
-
assert_equal(['Africa', 'Asia', 'Australia'], descrs.sort)
|
417
|
-
end
|
418
|
-
|
419
|
-
def test_distribution_point
|
420
|
-
10.times do
|
421
|
-
@tree = @phyloxml.next_tree
|
422
|
-
end
|
423
|
-
point = @tree.get_node_by_name('A').distributions[0].points[0]
|
424
|
-
assert_equal("WGS84", point.geodetic_datum)
|
425
|
-
assert_equal(47.481277, point.lat)
|
426
|
-
assert_equal(8.769303, point.long)
|
427
|
-
assert_equal(472, point.alt)
|
428
|
-
|
429
|
-
point = @tree.get_node_by_name('B').distributions[0].points[0]
|
430
|
-
assert_equal("WGS84", point.geodetic_datum)
|
431
|
-
assert_equal(35.155904, point.lat)
|
432
|
-
assert_equal(136.915863, point.long)
|
433
|
-
assert_equal(10, point.alt)
|
434
|
-
end
|
435
|
-
|
436
|
-
def test_sequence
|
437
|
-
3.times do
|
438
|
-
@tree = @phyloxml.next_tree
|
439
|
-
end
|
440
|
-
sequence_a = @tree.get_node_by_name('A').sequences[0]
|
441
|
-
assert_equal('alcohol dehydrogenase', sequence_a.annotations[0].desc)
|
442
|
-
assert_equal("probability", sequence_a.annotations[0].confidence.type)
|
443
|
-
assert_equal(0.99, sequence_a.annotations[0].confidence.value)
|
444
|
-
sequence_b = @tree.get_node_by_name('B').sequences[0]
|
445
|
-
assert_equal('alcohol dehydrogenase', sequence_b.annotations[0].desc)
|
446
|
-
assert_equal("probability", sequence_b.annotations[0].confidence.type)
|
447
|
-
assert_equal(0.91, sequence_b.annotations[0].confidence.value)
|
448
|
-
sequence_c = @tree.get_node_by_name('C').sequences[0]
|
449
|
-
assert_equal('alcohol dehydrogenase', sequence_c.annotations[0].desc)
|
450
|
-
assert_equal("probability", sequence_c.annotations[0].confidence.type)
|
451
|
-
assert_equal(0.67, sequence_c.annotations[0].confidence.value)
|
452
|
-
|
453
|
-
end
|
454
|
-
|
455
|
-
def test_sequence2
|
456
|
-
4.times do
|
457
|
-
@tree = @phyloxml.next_tree
|
458
|
-
end
|
459
|
-
leaves = @tree.leaves
|
460
|
-
leaves.each { |node|
|
461
|
-
#just test one node for now
|
462
|
-
if node.sequences[0].id_source == 'x'
|
463
|
-
assert_equal('adhB', node.sequences[0].symbol)
|
464
|
-
assert_equal("ncbi", node.sequences[0].accession.source)
|
465
|
-
assert_equal('AAB80874', node.sequences[0].accession.value)
|
466
|
-
assert_equal('alcohol dehydrogenase', node.sequences[0].name)
|
467
|
-
end
|
468
|
-
if node.sequences[0].id_source == 'z'
|
469
|
-
assert_equal("InterPro:IPR002085",
|
470
|
-
node.sequences[0].annotations[0].ref)
|
471
|
-
end
|
472
|
-
}
|
473
|
-
end
|
474
|
-
|
475
|
-
def test_sequence3
|
476
|
-
5.times do
|
477
|
-
@tree = @phyloxml.next_tree
|
478
|
-
end
|
479
|
-
@tree.leaves.each { |node|
|
480
|
-
if node.sequences[0].symbol == 'ADHX'
|
481
|
-
assert_equal('UniProtKB', node.sequences[0].accession.source)
|
482
|
-
assert_equal('P81431', node.sequences[0].accession.value)
|
483
|
-
assert_equal('Alcohol dehydrogenase class-3', node.sequences[0].name)
|
484
|
-
assert_equal(true, node.sequences[0].is_aligned)
|
485
|
-
assert_equal(true, node.sequences[0].is_aligned?)
|
486
|
-
assert_equal('TDATGKPIKCMAAIAWEAKKPLSIEEVEVAPPKSGEVRIKILHSGVCHTD',
|
487
|
-
node.sequences[0].mol_seq)
|
488
|
-
assert_equal('EC:1.1.1.1', node.sequences[0].annotations[0].ref)
|
489
|
-
assert_equal('GO:0004022', node.sequences[0].annotations[1].ref)
|
490
|
-
end
|
491
|
-
}
|
492
|
-
end
|
493
|
-
|
494
|
-
def test_to_biosequence
|
495
|
-
5.times do
|
496
|
-
@tree = @phyloxml.next_tree
|
497
|
-
end
|
498
|
-
@tree.leaves.each { |node|
|
499
|
-
if node.sequences[0].symbol =='ADHX'
|
500
|
-
seq = node.sequences[0].to_biosequence
|
501
|
-
assert_equal('Alcohol dehydrogenase class-3', seq.definition)
|
502
|
-
assert_equal('UniProtKB', seq.id_namespace)
|
503
|
-
assert_equal('P81431', seq.entry_id)
|
504
|
-
assert_equal('TDATGKPIKCMAAIAWEAKKPLSIEEVEVAPPKSGEVRIKILHSGVCHTD',
|
505
|
-
seq.seq.to_s)
|
506
|
-
end
|
507
|
-
}
|
508
|
-
end
|
509
|
-
|
510
|
-
def test_extract_biosequence
|
511
|
-
5.times do
|
512
|
-
@tree = @phyloxml.next_tree
|
513
|
-
end
|
514
|
-
@tree.leaves.each { |node|
|
515
|
-
if node.sequences[0].symbol == 'ADHX'
|
516
|
-
seq = node.extract_biosequence
|
517
|
-
assert_equal('Alcohol dehydrogenase class-3', seq.definition)
|
518
|
-
assert_equal('TDATGKPIKCMAAIAWEAKKPLSIEEVEVAPPKSGEVRIKILHSGVCHTD',
|
519
|
-
seq.seq.to_s)
|
520
|
-
assert_equal('Octopus vulgaris', seq.classification[0])
|
521
|
-
end
|
522
|
-
}
|
523
|
-
end
|
524
|
-
|
525
|
-
def test_date
|
526
|
-
11.times do
|
527
|
-
@tree = @phyloxml.next_tree
|
528
|
-
end
|
529
|
-
date_a = @tree.get_node_by_name('A').date
|
530
|
-
assert_equal('mya', date_a.unit)
|
531
|
-
assert_equal("Silurian", date_a.desc)
|
532
|
-
assert_equal(425, date_a.value)
|
533
|
-
date_b = @tree.get_node_by_name('B').date
|
534
|
-
assert_equal('mya', date_b.unit)
|
535
|
-
assert_equal("Devonian", date_b.desc)
|
536
|
-
assert_equal(320, date_b.value)
|
537
|
-
date_c = @tree.get_node_by_name('C').date
|
538
|
-
assert_equal('mya', date_c.unit)
|
539
|
-
assert_equal('Ediacaran', date_c.desc)
|
540
|
-
assert_equal(600, date_c.value)
|
541
|
-
assert_equal(570, date_c.minimum)
|
542
|
-
assert_equal(630, date_c.maximum)
|
543
|
-
end
|
544
|
-
|
545
|
-
def test_property
|
546
|
-
7.times do
|
547
|
-
@tree = @phyloxml.next_tree
|
548
|
-
end
|
549
|
-
property = @tree.get_node_by_name('A').properties[0]
|
550
|
-
assert_equal('xsd:integer', property.datatype)
|
551
|
-
assert_equal('NOAA:depth', property.ref)
|
552
|
-
assert_equal('clade', property.applies_to)
|
553
|
-
assert_equal('METRIC:m', property.unit)
|
554
|
-
assert_equal(' 1200 ', property.value)
|
555
|
-
end
|
556
|
-
|
557
|
-
def test_uri
|
558
|
-
9.times do
|
559
|
-
@tree = @phyloxml.next_tree
|
560
|
-
end
|
561
|
-
uri = @tree.root.taxonomies[0].uri
|
562
|
-
assert_equal("EMBL REPTILE DATABASE", uri.desc)
|
563
|
-
assert_equal("http://www.embl-heidelberg.de/~uetz/families/Varanidae.html", uri.uri)
|
564
|
-
end
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
end #class TestPhyloXML2
|
569
|
-
|
570
|
-
class TestPhyloXML3 < Test::Unit::TestCase
|
571
|
-
|
572
|
-
TEST_STRING =
|
573
|
-
"""<phylogeny rooted=\"true\">
|
574
|
-
<name>same example, with support of type \"bootstrap\"</name>
|
575
|
-
<clade>
|
576
|
-
<clade branch_length=\"0.06\">
|
577
|
-
<name>AB</name>
|
578
|
-
<confidence type=\"bootstrap\">89</confidence>
|
579
|
-
<clade branch_length=\"0.102\">
|
580
|
-
<name>A</name>
|
581
|
-
</clade>
|
582
|
-
<clade branch_length=\"0.23\">
|
583
|
-
<name>B</name>
|
584
|
-
</clade>
|
585
|
-
</clade>
|
586
|
-
<clade branch_length=\"0.4\">
|
587
|
-
<name>C</name>
|
588
|
-
</clade>
|
589
|
-
</clade>
|
590
|
-
</phylogeny>"""
|
591
|
-
|
592
|
-
def setup
|
593
|
-
phyloxml = Bio::PhyloXML::Parser.new(TEST_STRING)
|
594
|
-
@tree = phyloxml.next_tree()
|
595
|
-
|
596
|
-
end
|
597
|
-
|
598
|
-
def test_children
|
599
|
-
node = @tree.get_node_by_name("AB")
|
600
|
-
# nodes = @tree.children(node).sort { |a,b| a.name <=> b.name }
|
601
|
-
node_names = []
|
602
|
-
@tree.children(node).each { |children|
|
603
|
-
node_names[node_names.length] = children.name
|
604
|
-
}
|
605
|
-
node_names.sort!
|
606
|
-
assert_equal(["A", "B"], node_names)
|
607
|
-
end
|
608
|
-
|
609
|
-
|
610
|
-
end # class
|
611
|
-
|
612
|
-
class TestPhyloXML4 < Test::Unit::TestCase
|
613
|
-
|
614
|
-
#test cases what pertain to tree
|
615
|
-
|
616
|
-
def test_clade_relation
|
617
|
-
|
618
|
-
@phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
619
|
-
7.times do
|
620
|
-
@tree = @phyloxml.next_tree
|
621
|
-
end
|
622
|
-
cr = @tree.clade_relations[0]
|
623
|
-
assert_equal("b", cr.id_ref_0)
|
624
|
-
assert_equal("c", cr.id_ref_1)
|
625
|
-
assert_equal("network_connection", cr.type)
|
626
|
-
end
|
627
|
-
|
628
|
-
def test_sequence_realations
|
629
|
-
@phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
630
|
-
5.times do
|
631
|
-
@tree = @phyloxml.next_tree
|
632
|
-
end
|
633
|
-
|
634
|
-
sr = @tree.sequence_relations[0]
|
635
|
-
|
636
|
-
assert_equal("x", sr.id_ref_0)
|
637
|
-
assert_equal("y", sr.id_ref_1)
|
638
|
-
assert_equal("paralogy", sr.type)
|
639
|
-
end
|
640
|
-
|
641
|
-
|
642
|
-
end
|
643
|
-
|
644
|
-
class TestPhyloXML5 < Test::Unit::TestCase
|
645
|
-
|
646
|
-
#testing file made_up.xml
|
647
|
-
def setup
|
648
|
-
@phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.made_up_xml)
|
649
|
-
end
|
650
|
-
|
651
|
-
def test_phylogeny_confidence
|
652
|
-
tree = @phyloxml.next_tree()
|
653
|
-
assert_equal("bootstrap", tree.confidences[0].type)
|
654
|
-
assert_equal(89, tree.confidences[0].value)
|
655
|
-
assert_equal("probability", tree.confidences[1].type)
|
656
|
-
assert_equal(0.71, tree.confidences[1].value)
|
657
|
-
end
|
658
|
-
|
659
|
-
def test_to_biotreenode_probability
|
660
|
-
tree = @phyloxml.next_tree()
|
661
|
-
node = tree.get_node_by_name('c').to_biotreenode
|
662
|
-
assert_equal(nil, node.bootstrap)
|
663
|
-
end
|
664
|
-
|
665
|
-
def test_polygon
|
666
|
-
2.times do
|
667
|
-
@tree = @phyloxml.next_tree
|
668
|
-
end
|
669
|
-
polygon = @tree.get_node_by_name('A').distributions[0].polygons[0]
|
670
|
-
assert_equal(3, polygon.points.length)
|
671
|
-
assert_equal(47.481277, polygon.points[0].lat)
|
672
|
-
assert_equal("m", polygon.points[0].alt_unit)
|
673
|
-
assert_equal(136.915863, polygon.points[1].long)
|
674
|
-
assert_equal(452, polygon.points[2].alt)
|
675
|
-
polygon = @tree.get_node_by_name('A').distributions[0].polygons[1]
|
676
|
-
#making sure can read in second polygon
|
677
|
-
assert_equal(3, polygon.points.length)
|
678
|
-
assert_equal(40.481277, polygon.points[0].lat)
|
679
|
-
end
|
680
|
-
|
681
|
-
def test_reference
|
682
|
-
3.times do
|
683
|
-
@tree = @phyloxml.next_tree
|
684
|
-
end
|
685
|
-
references = @tree.get_node_by_name('A').references
|
686
|
-
assert_equal("10.1093/bioinformatics/btm619", references[0].doi)
|
687
|
-
assert_equal("Phyutility: a phyloinformatics tool for trees, alignments and molecular data", references[0].desc)
|
688
|
-
assert_equal("10.1186/1471-2105-9-S1-S23", references[1].doi)
|
689
|
-
end
|
690
|
-
|
691
|
-
|
692
|
-
def test_single_clade
|
693
|
-
4.times do
|
694
|
-
@tree = @phyloxml.next_tree()
|
695
|
-
end
|
696
|
-
assert_equal("A", @tree.root.name)
|
697
|
-
end
|
698
|
-
|
699
|
-
def test_domain_architecture
|
700
|
-
5.times {@tree = @phyloxml.next_tree()}
|
701
|
-
node = @tree.get_node_by_name("22_MOUSE")
|
702
|
-
assert_equal("22_MOUSE", node.name)
|
703
|
-
assert_equal("MOUSE", node.taxonomies[0].code)
|
704
|
-
domain_arch = node.sequences[0].domain_architecture
|
705
|
-
assert_equal(1249, domain_arch.length)
|
706
|
-
assert_equal(6, domain_arch.domains[0].from)
|
707
|
-
assert_equal(90, domain_arch.domains[0].to)
|
708
|
-
assert_in_delta(7.0E-26, domain_arch.domains[0].confidence, 1E-26)
|
709
|
-
assert_equal("CARD", domain_arch.domains[0].value)
|
710
|
-
assert_equal("x", domain_arch.domains[0].id)
|
711
|
-
assert_equal(733, domain_arch.domains[5].from)
|
712
|
-
assert_equal(771, domain_arch.domains[5].to)
|
713
|
-
assert_in_delta(4.7E-14, domain_arch.domains[5].confidence, 1E-15)
|
714
|
-
assert_equal("WD40", domain_arch.domains[5].value)
|
715
|
-
assert_equal(1168, domain_arch.domains.last.from)
|
716
|
-
assert_equal(1204, domain_arch.domains.last.to)
|
717
|
-
assert_equal(0.3, domain_arch.domains.last.confidence)
|
718
|
-
assert_equal("WD40", domain_arch.domains.last.value)
|
719
|
-
end
|
720
|
-
|
721
|
-
def test_clade_width
|
722
|
-
@tree = @phyloxml.next_tree
|
723
|
-
assert_equal(0.2, @tree.root.width)
|
724
|
-
end
|
725
|
-
|
726
|
-
def test_binary_characters
|
727
|
-
6.times do
|
728
|
-
@tree = @phyloxml.next_tree
|
729
|
-
end
|
730
|
-
bc =@tree.get_node_by_name("cellular_organisms").binary_characters
|
731
|
-
assert_equal("parsimony inferred", bc.bc_type)
|
732
|
-
assert_equal(0, bc.lost_count)
|
733
|
-
assert_equal(0, bc.gained_count)
|
734
|
-
assert_equal([], bc.lost)
|
735
|
-
|
736
|
-
bc2 = @tree.get_node_by_name("Eukaryota").binary_characters
|
737
|
-
assert_equal(2, bc2.gained_count)
|
738
|
-
assert_equal(["Cofilin_ADF", "Gelsolin"], bc2.gained)
|
739
|
-
assert_equal(["Cofilin_ADF", "Gelsolin"], bc2.present)
|
740
|
-
end
|
741
|
-
|
742
|
-
def test_rerootable2
|
743
|
-
6.times do
|
744
|
-
@tree = @phyloxml.next_tree
|
745
|
-
end
|
746
|
-
assert_equal(false, @tree.rerootable)
|
747
|
-
end
|
748
|
-
|
749
|
-
def test_phylogeny_attributes
|
750
|
-
@tree = @phyloxml.next_tree
|
751
|
-
assert_equal(true, @tree.rooted)
|
752
|
-
assert_equal(false, @tree.rerootable)
|
753
|
-
#@todo make this test pass
|
754
|
-
#assert_equal("1", @tree.branch_length_unit)
|
755
|
-
|
756
|
-
end
|
757
|
-
|
758
|
-
def test_taxonomy_synonym
|
759
|
-
5.times do
|
760
|
-
@tree = @phyloxml.next_tree
|
761
|
-
end
|
762
|
-
node = @tree.get_node_by_name('22_MOUSE')
|
763
|
-
t = node.taxonomies[0]
|
764
|
-
assert_equal("murine", t.synonyms[0])
|
765
|
-
assert_equal("vermin", t.synonyms[1])
|
766
|
-
|
767
|
-
end
|
768
|
-
|
769
|
-
def test_annotation_property
|
770
|
-
5.times do
|
771
|
-
@tree =@phyloxml.next_tree
|
772
|
-
end
|
773
|
-
node = @tree.get_node_by_name('22_MOUSE')
|
774
|
-
prop = node.sequences[0].annotations[0].properties[0]
|
775
|
-
assert_equal("1200", prop.value)
|
776
|
-
end
|
777
|
-
|
778
|
-
end
|
779
|
-
class TestPhyloXML5 < Test::Unit::TestCase
|
780
|
-
|
781
|
-
def test_each
|
782
|
-
phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
783
|
-
count = 0
|
784
|
-
phyloxml.each do |tree|
|
785
|
-
count +=1
|
786
|
-
end
|
787
|
-
assert_equal(13, count)
|
788
|
-
end
|
789
|
-
|
790
|
-
def test_other
|
791
|
-
phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
792
|
-
assert_equal(nil, phyloxml.other[0])
|
793
|
-
phyloxml.each do |tree|
|
794
|
-
#iterate through all trees, to get to the end
|
795
|
-
end
|
796
|
-
o = phyloxml.other[0]
|
797
|
-
assert_equal('align:alignment', o.element_name)
|
798
|
-
assert_equal('seq', o.children[0].element_name)
|
799
|
-
assert_equal('aggtcgcggcctgtggaagtcctctcct', o.children[1].value)
|
800
|
-
assert_equal("C", o.children[2].attributes["name"])
|
801
|
-
|
802
|
-
end
|
803
|
-
|
804
|
-
def test_array_behaviour
|
805
|
-
phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.example_xml)
|
806
|
-
tree = phyloxml[2]
|
807
|
-
assert_equal("same example, with support of type \"bootstrap\"",
|
808
|
-
tree.name)
|
809
|
-
end
|
810
|
-
|
811
|
-
|
812
|
-
# def test_get_tree_by_name
|
813
|
-
# @phyloxml = Bio::PhyloXML::Parser.open(TestPhyloXMLData.made_up_xml)
|
814
|
-
# tree = @phyloxml.get_tree_by_name "testing confidence"
|
815
|
-
#
|
816
|
-
# end
|
817
|
-
|
818
|
-
end
|
819
|
-
|
820
|
-
|
821
|
-
end if defined?(LibXML) #end module Bio
|