bio 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. data/bin/bioruby +107 -0
  2. data/bin/br_biofetch.rb +59 -0
  3. data/bin/br_bioflat.rb +294 -0
  4. data/bin/br_biogetseq.rb +57 -0
  5. data/bin/br_pmfetch.rb +431 -0
  6. data/doc/BioRuby.rd.ja +225 -0
  7. data/doc/Changes-0.7.rd +236 -0
  8. data/doc/Design.rd.ja +341 -0
  9. data/doc/KEGG_API.rd +1437 -0
  10. data/doc/KEGG_API.rd.ja +1399 -0
  11. data/doc/TODO.rd.ja +138 -0
  12. data/doc/Tutorial.rd +1138 -0
  13. data/doc/Tutorial.rd.ja +2110 -0
  14. data/etc/bioinformatics/seqdatabase.ini +210 -0
  15. data/lib/bio.rb +256 -0
  16. data/lib/bio/alignment.rb +1906 -0
  17. data/lib/bio/appl/bl2seq/report.rb +350 -0
  18. data/lib/bio/appl/blast.rb +269 -0
  19. data/lib/bio/appl/blast/format0.rb +1402 -0
  20. data/lib/bio/appl/blast/format8.rb +95 -0
  21. data/lib/bio/appl/blast/report.rb +652 -0
  22. data/lib/bio/appl/blast/rexml.rb +151 -0
  23. data/lib/bio/appl/blast/wublast.rb +553 -0
  24. data/lib/bio/appl/blast/xmlparser.rb +222 -0
  25. data/lib/bio/appl/blat/report.rb +392 -0
  26. data/lib/bio/appl/clustalw.rb +191 -0
  27. data/lib/bio/appl/clustalw/report.rb +154 -0
  28. data/lib/bio/appl/emboss.rb +68 -0
  29. data/lib/bio/appl/fasta.rb +262 -0
  30. data/lib/bio/appl/fasta/format10.rb +428 -0
  31. data/lib/bio/appl/fasta/format6.rb +37 -0
  32. data/lib/bio/appl/genscan/report.rb +570 -0
  33. data/lib/bio/appl/hmmer.rb +129 -0
  34. data/lib/bio/appl/hmmer/report.rb +556 -0
  35. data/lib/bio/appl/mafft.rb +222 -0
  36. data/lib/bio/appl/mafft/report.rb +119 -0
  37. data/lib/bio/appl/psort.rb +555 -0
  38. data/lib/bio/appl/psort/report.rb +473 -0
  39. data/lib/bio/appl/sim4.rb +134 -0
  40. data/lib/bio/appl/sim4/report.rb +501 -0
  41. data/lib/bio/appl/sosui/report.rb +166 -0
  42. data/lib/bio/appl/spidey/report.rb +604 -0
  43. data/lib/bio/appl/targetp/report.rb +283 -0
  44. data/lib/bio/appl/tmhmm/report.rb +238 -0
  45. data/lib/bio/command.rb +166 -0
  46. data/lib/bio/data/aa.rb +354 -0
  47. data/lib/bio/data/codontable.rb +740 -0
  48. data/lib/bio/data/na.rb +226 -0
  49. data/lib/bio/db.rb +340 -0
  50. data/lib/bio/db/aaindex.rb +280 -0
  51. data/lib/bio/db/embl/common.rb +332 -0
  52. data/lib/bio/db/embl/embl.rb +446 -0
  53. data/lib/bio/db/embl/sptr.rb +954 -0
  54. data/lib/bio/db/embl/swissprot.rb +32 -0
  55. data/lib/bio/db/embl/trembl.rb +31 -0
  56. data/lib/bio/db/embl/uniprot.rb +32 -0
  57. data/lib/bio/db/fantom.rb +604 -0
  58. data/lib/bio/db/fasta.rb +869 -0
  59. data/lib/bio/db/genbank/common.rb +299 -0
  60. data/lib/bio/db/genbank/ddbj.rb +34 -0
  61. data/lib/bio/db/genbank/genbank.rb +354 -0
  62. data/lib/bio/db/genbank/genpept.rb +73 -0
  63. data/lib/bio/db/genbank/refseq.rb +31 -0
  64. data/lib/bio/db/gff.rb +106 -0
  65. data/lib/bio/db/go.rb +497 -0
  66. data/lib/bio/db/kegg/brite.rb +51 -0
  67. data/lib/bio/db/kegg/cell.rb +88 -0
  68. data/lib/bio/db/kegg/compound.rb +130 -0
  69. data/lib/bio/db/kegg/enzyme.rb +125 -0
  70. data/lib/bio/db/kegg/expression.rb +173 -0
  71. data/lib/bio/db/kegg/genes.rb +293 -0
  72. data/lib/bio/db/kegg/genome.rb +362 -0
  73. data/lib/bio/db/kegg/glycan.rb +213 -0
  74. data/lib/bio/db/kegg/keggtab.rb +418 -0
  75. data/lib/bio/db/kegg/kgml.rb +299 -0
  76. data/lib/bio/db/kegg/ko.rb +178 -0
  77. data/lib/bio/db/kegg/reaction.rb +97 -0
  78. data/lib/bio/db/litdb.rb +131 -0
  79. data/lib/bio/db/medline.rb +317 -0
  80. data/lib/bio/db/nbrf.rb +199 -0
  81. data/lib/bio/db/pdb.rb +38 -0
  82. data/lib/bio/db/pdb/atom.rb +60 -0
  83. data/lib/bio/db/pdb/chain.rb +117 -0
  84. data/lib/bio/db/pdb/model.rb +106 -0
  85. data/lib/bio/db/pdb/pdb.rb +1682 -0
  86. data/lib/bio/db/pdb/residue.rb +122 -0
  87. data/lib/bio/db/pdb/utils.rb +234 -0
  88. data/lib/bio/db/prosite.rb +616 -0
  89. data/lib/bio/db/rebase.rb +417 -0
  90. data/lib/bio/db/transfac.rb +387 -0
  91. data/lib/bio/feature.rb +201 -0
  92. data/lib/bio/io/brdb.rb +103 -0
  93. data/lib/bio/io/das.rb +471 -0
  94. data/lib/bio/io/dbget.rb +212 -0
  95. data/lib/bio/io/ddbjxml.rb +614 -0
  96. data/lib/bio/io/fastacmd.rb +123 -0
  97. data/lib/bio/io/fetch.rb +114 -0
  98. data/lib/bio/io/flatfile.rb +496 -0
  99. data/lib/bio/io/flatfile/bdb.rb +266 -0
  100. data/lib/bio/io/flatfile/index.rb +1308 -0
  101. data/lib/bio/io/flatfile/indexer.rb +778 -0
  102. data/lib/bio/io/higet.rb +92 -0
  103. data/lib/bio/io/keggapi.rb +863 -0
  104. data/lib/bio/io/pubmed.rb +189 -0
  105. data/lib/bio/io/registry.rb +308 -0
  106. data/lib/bio/io/soapwsdl.rb +114 -0
  107. data/lib/bio/io/sql.rb +428 -0
  108. data/lib/bio/location.rb +650 -0
  109. data/lib/bio/pathway.rb +991 -0
  110. data/lib/bio/reference.rb +308 -0
  111. data/lib/bio/sequence.rb +593 -0
  112. data/lib/bio/shell.rb +51 -0
  113. data/lib/bio/shell/core.rb +512 -0
  114. data/lib/bio/shell/plugin/codon.rb +228 -0
  115. data/lib/bio/shell/plugin/entry.rb +85 -0
  116. data/lib/bio/shell/plugin/flatfile.rb +119 -0
  117. data/lib/bio/shell/plugin/keggapi.rb +187 -0
  118. data/lib/bio/shell/plugin/midi.rb +448 -0
  119. data/lib/bio/shell/plugin/obda.rb +63 -0
  120. data/lib/bio/shell/plugin/seq.rb +238 -0
  121. data/lib/bio/shell/session.rb +214 -0
  122. data/lib/bio/util/color_scheme.rb +214 -0
  123. data/lib/bio/util/color_scheme/buried.rb +78 -0
  124. data/lib/bio/util/color_scheme/helix.rb +78 -0
  125. data/lib/bio/util/color_scheme/hydropathy.rb +83 -0
  126. data/lib/bio/util/color_scheme/nucleotide.rb +50 -0
  127. data/lib/bio/util/color_scheme/strand.rb +78 -0
  128. data/lib/bio/util/color_scheme/taylor.rb +69 -0
  129. data/lib/bio/util/color_scheme/turn.rb +78 -0
  130. data/lib/bio/util/color_scheme/zappo.rb +69 -0
  131. data/lib/bio/util/contingency_table.rb +337 -0
  132. data/lib/bio/util/sirna.rb +306 -0
  133. data/lib/bioruby.rb +34 -0
  134. data/sample/biofetch.rb +475 -0
  135. data/sample/color_scheme_na.rb +99 -0
  136. data/sample/dbget +37 -0
  137. data/sample/fasta2tab.rb +99 -0
  138. data/sample/fsplit.rb +51 -0
  139. data/sample/gb2fasta.rb +31 -0
  140. data/sample/gb2tab.rb +325 -0
  141. data/sample/gbtab2mysql.rb +161 -0
  142. data/sample/genes2nuc.rb +33 -0
  143. data/sample/genes2pep.rb +33 -0
  144. data/sample/genes2tab.rb +81 -0
  145. data/sample/genome2rb.rb +29 -0
  146. data/sample/genome2tab.rb +76 -0
  147. data/sample/goslim.rb +311 -0
  148. data/sample/gt2fasta.rb +47 -0
  149. data/sample/pmfetch.rb +42 -0
  150. data/sample/pmsearch.rb +42 -0
  151. data/sample/psortplot_html.rb +222 -0
  152. data/sample/ssearch2tab.rb +96 -0
  153. data/sample/tdiary.rb +158 -0
  154. data/sample/tfastx2tab.rb +100 -0
  155. data/sample/vs-genes.rb +212 -0
  156. data/test/data/SOSUI/sample.report +11 -0
  157. data/test/data/TMHMM/sample.report +21 -0
  158. data/test/data/blast/eco:b0002.faa +15 -0
  159. data/test/data/blast/eco:b0002.faa.m0 +128 -0
  160. data/test/data/blast/eco:b0002.faa.m7 +65 -0
  161. data/test/data/blast/eco:b0002.faa.m8 +1 -0
  162. data/test/data/embl/AB090716.embl +65 -0
  163. data/test/data/genscan/sample.report +63 -0
  164. data/test/data/prosite/prosite.dat +2233 -0
  165. data/test/data/refseq/nm_126355.entret +64 -0
  166. data/test/data/uniprot/p53_human.uniprot +1456 -0
  167. data/test/runner.rb +10 -0
  168. data/test/unit/bio/appl/blast/test_report.rb +427 -0
  169. data/test/unit/bio/appl/blast/test_xmlparser.rb +400 -0
  170. data/test/unit/bio/appl/genscan/test_report.rb +195 -0
  171. data/test/unit/bio/appl/sosui/test_report.rb +94 -0
  172. data/test/unit/bio/appl/targetp/test_report.rb +159 -0
  173. data/test/unit/bio/appl/test_blast.rb +159 -0
  174. data/test/unit/bio/appl/test_fasta.rb +142 -0
  175. data/test/unit/bio/appl/tmhmm/test_report.rb +139 -0
  176. data/test/unit/bio/data/test_aa.rb +103 -0
  177. data/test/unit/bio/data/test_codontable.rb +120 -0
  178. data/test/unit/bio/data/test_na.rb +89 -0
  179. data/test/unit/bio/db/embl/test_common.rb +130 -0
  180. data/test/unit/bio/db/embl/test_embl.rb +227 -0
  181. data/test/unit/bio/db/embl/test_sptr.rb +268 -0
  182. data/test/unit/bio/db/embl/test_uniprot.rb +44 -0
  183. data/test/unit/bio/db/kegg/test_genes.rb +58 -0
  184. data/test/unit/bio/db/test_fasta.rb +263 -0
  185. data/test/unit/bio/db/test_gff.rb +140 -0
  186. data/test/unit/bio/db/test_prosite.rb +1450 -0
  187. data/test/unit/bio/io/test_ddbjxml.rb +87 -0
  188. data/test/unit/bio/io/test_soapwsdl.rb +45 -0
  189. data/test/unit/bio/shell/plugin/test_seq.rb +175 -0
  190. data/test/unit/bio/test_alignment.rb +1028 -0
  191. data/test/unit/bio/test_command.rb +71 -0
  192. data/test/unit/bio/test_db.rb +109 -0
  193. data/test/unit/bio/test_feature.rb +128 -0
  194. data/test/unit/bio/test_location.rb +51 -0
  195. data/test/unit/bio/test_pathway.rb +485 -0
  196. data/test/unit/bio/test_sequence.rb +386 -0
  197. data/test/unit/bio/test_shell.rb +31 -0
  198. data/test/unit/bio/util/test_color_scheme.rb +45 -0
  199. data/test/unit/bio/util/test_contingency_table.rb +106 -0
  200. data/test/unit/bio/util/test_sirna.rb +258 -0
  201. metadata +295 -0
data/test/runner.rb ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'pathname'
5
+
6
+ bioruby_libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'], 'lib')).cleanpath.to_s
7
+ $:.unshift(bioruby_libpath) unless $:.include?(bioruby_libpath)
8
+
9
+ exit Test::Unit::AutoRunner.run(false, File.dirname($0))
10
+
@@ -0,0 +1,427 @@
1
+ #
2
+ # test/unit/bio/appl/blast/test_report.rb - Unit test for Bio::Blast::Report
3
+ #
4
+ # Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ # $Id: test_report.rb,v 1.2 2005/11/22 08:31:47 nakao Exp $
21
+ #
22
+
23
+ require 'pathname'
24
+ libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib'))).cleanpath.to_s
25
+ $:.unshift(libpath) unless $:.include?(libpath)
26
+
27
+ require 'test/unit'
28
+ require 'bio/appl/blast/report'
29
+
30
+
31
+ module Bio
32
+ class TestBlastReportData
33
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
34
+ TestDataBlast = Pathname.new(File.join(bioruby_root, 'test', 'data', 'blast')).cleanpath.to_s
35
+
36
+ def self.input
37
+ File.open(File.join(TestDataBlast, 'eco:b0002.faa')).read
38
+ end
39
+
40
+ def self.output(format = 7)
41
+ case format
42
+ when 0
43
+ File.open(File.join(TestDataBlast, 'eco:b0002.faa.m0')).read
44
+ when 7
45
+ File.open(File.join(TestDataBlast, 'eco:b0002.faa.m7')).read
46
+ when 8
47
+ File.open(File.join(TestDataBlast, 'eco:b0002.faa.m8')).read
48
+ end
49
+ end
50
+ end
51
+
52
+
53
+ class TestBlastReport < Test::Unit::TestCase
54
+ require 'bio/appl/blast/report'
55
+
56
+ def setup
57
+ @report = Bio::Blast::Report.new(Bio::TestBlastReportData.output)
58
+ end
59
+
60
+ def test_iterations
61
+ assert(@report.iterations)
62
+ end
63
+
64
+ def test_parameters
65
+ assert_equal('BLOSUM62', @report.parameters['matrix'])
66
+ assert_equal(10, @report.parameters['expect'])
67
+ assert_equal(11, @report.parameters['gap-open'])
68
+ assert_equal(1, @report.parameters['gap-extend'])
69
+ assert_equal('S', @report.parameters['filter'])
70
+ end
71
+
72
+ def test_program
73
+ assert_equal('blastp', @report.program)
74
+ end
75
+
76
+ def test_version
77
+ assert_equal('blastp 2.2.10 [Oct-19-2004]', @report.version)
78
+ end
79
+
80
+ def test_reference
81
+ xml_quoted_str = "~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~&quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs&quot;, Nucleic Acids Res. 25:3389-3402."
82
+ text_str = '~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~"Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs", Nucleic Acids Res. 25:3389-3402.'
83
+ assert_equal(xml_quoted_str, @report.reference)
84
+ assert_equal(text_str, @report.reference)
85
+ end
86
+
87
+ def test_db
88
+ assert_equal('eco:b0002.faa', @report.db)
89
+ end
90
+
91
+ def test_query_id
92
+ assert_equal('lcl|QUERY', @report.query_id)
93
+ end
94
+
95
+ def test_query_def
96
+ assert_equal('eco:b0002 thrA, Hs, thrD, thrA2, thrA1; bifunctional: aspartokinase I (N-terminal); homoserine dehydrogenase I (C-terminal) [EC:2.7.2.4 1.1.1.3]; K00003 homoserine dehydrogenase; K00928 aspartate kinase (A)', @report.query_def)
97
+ end
98
+
99
+ def test_query_len
100
+ assert_equal(820, @report.query_len)
101
+ end
102
+
103
+ def test_matrix
104
+ assert_equal('BLOSUM62', @report.matrix)
105
+ end
106
+
107
+ def test_expect
108
+ assert_equal(10, @report.expect)
109
+ end
110
+
111
+ def test_inclusion
112
+ assert(@report.inclusion)
113
+ end
114
+
115
+ def test_sc_match
116
+ assert(@report.sc_match)
117
+ end
118
+
119
+ def test_sc_mismatch
120
+ assert(@report.sc_mismatch)
121
+ end
122
+
123
+ def test_gap_open
124
+ assert_equal(11, @report.gap_open)
125
+ end
126
+
127
+ def test_gap_extend
128
+ assert_equal(1, @report.gap_extend)
129
+ end
130
+
131
+ def test_filter
132
+ assert_equal('S', @report.filter)
133
+ end
134
+
135
+ def test_pattern
136
+ assert(@report.pattern)
137
+ end
138
+
139
+ def test_extrez_query
140
+ assert(@report.entrez_query)
141
+ end
142
+
143
+ def test_each_iteration
144
+ @report.each_iteration { |itr| }
145
+ end
146
+
147
+ def test_each_hit
148
+ @report.each_hit { |hit| }
149
+ end
150
+
151
+ def test_hits
152
+ assert(@report.hits)
153
+ end
154
+
155
+ def test_statistics
156
+ assert_equal({"kappa"=>0.041, "db-num"=>1, "eff-space"=>605284.0, "hsp-len"=>42, "db-len"=>820, "lambda"=>0.267, "entropy"=>0.14}, @report.statistics)
157
+ end
158
+
159
+ def test_db_num
160
+ assert_equal(1, @report.db_num)
161
+ end
162
+
163
+ def test_db_len
164
+ assert_equal(820, @report.db_len)
165
+ end
166
+
167
+ def test_hsp_len
168
+ assert_equal(42, @report.hsp_len)
169
+ end
170
+
171
+ def test_eff_space
172
+ assert_equal(605284, @report.eff_space)
173
+ end
174
+
175
+ def test_kappa
176
+ assert_equal(0.041, @report.kappa)
177
+ end
178
+
179
+ def test_lambda
180
+ assert_equal(0.267, @report.lambda)
181
+ end
182
+
183
+ def test_entropy
184
+ assert_equal(0.14, @report.entropy)
185
+ end
186
+
187
+ def test_message
188
+ assert(@report.message)
189
+ end
190
+ end
191
+
192
+ class TestBlastReportIteration < Test::Unit::TestCase
193
+ def setup
194
+ data = Bio::TestBlastReportData.output
195
+ report = Bio::Blast::Report.new(data)
196
+ @itr = report.iterations.first
197
+ end
198
+
199
+ def test_hits
200
+ assert(@itr.hits)
201
+ end
202
+
203
+ def test_statistics
204
+ assert(@itr.statistics)
205
+ end
206
+
207
+ def test_num
208
+ assert_equal(1, @itr.num)
209
+ end
210
+
211
+ def test_message
212
+ assert(@itr.message)
213
+ end
214
+ end
215
+
216
+ class TestBlastReportHit < Test::Unit::TestCase
217
+ def setup
218
+ data = Bio::TestBlastReportData.output
219
+ report = Bio::Blast::Report.new(data)
220
+ @hit = report.hits.first
221
+ end
222
+
223
+ def test_Hit_hsps
224
+ assert(@hit.hsps)
225
+ end
226
+
227
+ def test_Hit_query_id
228
+ assert_equal('lcl|QUERY', @hit.query_id)
229
+ end
230
+
231
+ def test_Hit_query_def
232
+ assert_equal('eco:b0002 thrA, Hs, thrD, thrA2, thrA1; bifunctional: aspartokinase I (N-terminal); homoserine dehydrogenase I (C-terminal) [EC:2.7.2.4 1.1.1.3]; K00003 homoserine dehydrogenase; K00928 aspartate kinase (A)', @hit.query_def)
233
+ end
234
+
235
+ def test_Hit_query_len
236
+ assert_equal(820, @hit.query_len)
237
+ end
238
+
239
+ def test_Hit_num
240
+ assert(@hit.num)
241
+ end
242
+
243
+ def test_Hit_hit_id
244
+ assert_equal('gnl|BL_ORD_ID|0', @hit.hit_id)
245
+ end
246
+
247
+ def test_Hit_len
248
+ assert_equal(820, @hit.len)
249
+ end
250
+
251
+ def test_Hit_target_len
252
+ assert_equal(820, @hit.target_len)
253
+ end
254
+
255
+ def test_Hit_definition
256
+ assert(@hit.definition)
257
+ end
258
+
259
+ def test_Hit_taeget_def
260
+ assert(@hit.target_def)
261
+ end
262
+
263
+ def test_Hit_accession
264
+ assert(@hit.accession)
265
+ end
266
+
267
+ def test_Hit_target_id
268
+ assert(@hit.target_id)
269
+ end
270
+
271
+ def test_Hit_evalue
272
+ assert_equal(0, @hit.evalue)
273
+ end
274
+
275
+ def test_Hit_bit_score
276
+ assert_equal(1567.75, @hit.bit_score)
277
+ end
278
+
279
+ def test_Hit_identity
280
+ assert_equal(820, @hit.identity)
281
+ end
282
+
283
+ def test_Hit_overlap
284
+ assert_equal(820, @hit.overlap)
285
+ end
286
+
287
+ def test_Hit_query_seq
288
+ seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV'
289
+ assert_equal(seq, @hit.query_seq)
290
+ end
291
+
292
+ def test_Hit_target_seq
293
+ seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV'
294
+ assert_equal(seq, @hit.target_seq)
295
+ end
296
+
297
+ def test_Hit_midline
298
+ seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV'
299
+ assert_equal(seq, @hit.midline)
300
+ end
301
+
302
+ def test_Hit_query_start
303
+ assert_equal(1, @hit.query_start)
304
+ # assert_equal(1, @hit.query_from)
305
+ end
306
+
307
+ def test_Hit_query_end
308
+ assert_equal(820, @hit.query_end)
309
+ # assert_equal(820, @hit.query_to)
310
+ end
311
+
312
+ def test_Hit_target_start
313
+ assert_equal(1, @hit.target_start)
314
+ # assert_equal(1, @hit.hit_from)
315
+ end
316
+
317
+ def test_Hit_target_end
318
+ assert_equal(820, @hit.target_end)
319
+ # assert_equal(820, @hit.hit_to)
320
+ end
321
+
322
+ def test_Hit_lap_at
323
+ assert_equal([1, 820, 1, 820], @hit.lap_at)
324
+ end
325
+ end
326
+
327
+ class TestBlastReportHsp < Test::Unit::TestCase
328
+ def setup
329
+ data = Bio::TestBlastReportData.output
330
+ report = Bio::Blast::Report.new(data)
331
+ @hsp = report.hits.first.hsps.first
332
+ end
333
+
334
+ def test_Hsp_num
335
+ assert_equal(1, @hsp.num)
336
+ end
337
+
338
+ def test_Hsp_hit_score
339
+ assert_equal(1567.75, @hsp.bit_score)
340
+ end
341
+
342
+ def test_Hsp_score
343
+ assert_equal(4058, @hsp.score)
344
+ end
345
+
346
+ def test_Hsp_evalue
347
+ assert_equal(0, @hsp.evalue)
348
+ end
349
+
350
+ def test_Hsp_identity
351
+ assert_equal(820, @hsp.identity)
352
+ end
353
+
354
+ def test_Hsp_gaps
355
+ assert(@hsp.gaps)
356
+ end
357
+
358
+ def test_Hsp_positive
359
+ assert_equal(820, @hsp.positive)
360
+ end
361
+
362
+ def test_Hsp_align_len
363
+ assert_equal(820, @hsp.align_len)
364
+ end
365
+
366
+ def test_Hsp_density
367
+ assert(@hsp.density)
368
+ end
369
+
370
+ def test_Hsp_query_frame
371
+ assert_equal(1, @hsp.query_frame)
372
+ end
373
+
374
+ def test_Hsp_query_from
375
+ assert_equal(1, @hsp.query_from)
376
+ end
377
+
378
+ def test_Hsp_query_to
379
+ assert_equal(820, @hsp.query_to)
380
+ end
381
+
382
+ def test_Hsp_hit_frame
383
+ assert_equal(1, @hsp.hit_frame)
384
+ end
385
+
386
+ def test_Hsp_hit_from
387
+ assert_equal(1, @hsp.hit_from)
388
+ end
389
+
390
+ def test_Hsp_hit_to
391
+ assert_equal(820, @hsp.hit_to)
392
+ end
393
+
394
+ def test_Hsp_pattern_from
395
+ @hsp.pattern_from
396
+ end
397
+
398
+ def test_Hsp_pattern_to
399
+ @hsp.pattern_to
400
+ end
401
+
402
+ def test_Hsp_qseq
403
+ seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV'
404
+ assert_equal(seq, @hsp.qseq)
405
+ end
406
+
407
+ def test_Hsp_midline
408
+ seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV'
409
+ assert_equal(seq, @hsp.midline)
410
+ end
411
+
412
+ def test_Hsp_hseq
413
+ seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV'
414
+ assert_equal(seq, @hsp.hseq)
415
+ end
416
+
417
+ def test_Hsp_percent_identity
418
+ @hsp.percent_identity
419
+ end
420
+
421
+ def test_Hsp_mismatch_count
422
+ @hsp.mismatch_count
423
+ end
424
+
425
+ end
426
+
427
+ end # module Bio
@@ -0,0 +1,400 @@
1
+ #
2
+ # test/unit/bio/appl/blast/test_xmlparser.rb - Unit test for Bio::Blast::Report
3
+ #
4
+ # Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the Free Software
18
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #
20
+ # $Id: test_xmlparser.rb,v 1.3 2005/12/18 17:06:56 nakao Exp $
21
+ #
22
+
23
+ require 'pathname'
24
+ libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib'))).cleanpath.to_s
25
+ $:.unshift(libpath) unless $:.include?(libpath)
26
+
27
+ require 'test/unit'
28
+ require 'bio/appl/blast'
29
+
30
+
31
+ module Bio
32
+ class TestBlastFormat7XMLParserData
33
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
34
+ TestDataBlast = Pathname.new(File.join(bioruby_root, 'test', 'data', 'blast')).cleanpath.to_s
35
+
36
+ def self.input
37
+ File.open(File.join(TestDataBlast, 'eco:b0002.faa')).read
38
+ end
39
+
40
+ def self.output
41
+ File.open(File.join(TestDataBlast, 'eco:b0002.faa.m7')).read
42
+ end
43
+ end
44
+
45
+
46
+ class TestBlastReport < Test::Unit::TestCase
47
+ require 'bio/appl/blast/report'
48
+
49
+ def setup
50
+ @report = Bio::Blast::Report.new(Bio::TestBlastFormat7XMLParserData.output)
51
+ end
52
+
53
+ def test_iterations
54
+ @report.iterations
55
+ end
56
+
57
+ def test_parameters
58
+ @report.parameters
59
+ end
60
+
61
+ def test_program
62
+ @report.program
63
+ end
64
+
65
+ def test_version
66
+ @report.version
67
+ end
68
+
69
+ def test_reference
70
+ @report.reference
71
+ end
72
+
73
+ def test_db
74
+ assert_equal("eco:b0002.faa", @report.db)
75
+ end
76
+
77
+ def test_query_id
78
+ @report.query_id
79
+ end
80
+
81
+ def test_query_def
82
+ @report.query_def
83
+ end
84
+
85
+ def test_query_len
86
+ @report.query_len
87
+ end
88
+
89
+ def test_matrix
90
+ @report.matrix
91
+ end
92
+
93
+ def test_expect
94
+ @report.expect
95
+ end
96
+
97
+ def test_inclusion
98
+ @report.inclusion
99
+ end
100
+
101
+ def test_sc_match
102
+ @report.sc_match
103
+ end
104
+
105
+ def test_sc_mismatch
106
+ @report.sc_mismatch
107
+ end
108
+
109
+ def test_gap_open
110
+ @report.gap_open
111
+ end
112
+
113
+ def test_gap_extend
114
+ @report.gap_extend
115
+ end
116
+
117
+ def test_filter
118
+ @report.filter
119
+ end
120
+
121
+ def test_pattern
122
+ @report.pattern
123
+ end
124
+
125
+ def test_extrez_query
126
+ @report.entrez_query
127
+ end
128
+
129
+ def test_each_iteration
130
+ end
131
+
132
+ def test_each_hit
133
+ end
134
+
135
+ def test_hits
136
+ end
137
+
138
+ def test_statistics
139
+ end
140
+
141
+ def test_db_num
142
+ @report.db_num
143
+ end
144
+
145
+ def test_db_len
146
+ @report.db_len
147
+ end
148
+
149
+ def test_hsp_len
150
+ @report.hsp_len
151
+ end
152
+
153
+ def test_eff_space
154
+ @report.eff_space
155
+ end
156
+
157
+ def test_kappa
158
+ @report.kappa
159
+ end
160
+
161
+ def test_lambda
162
+ @report.lambda
163
+ end
164
+
165
+ def test_entropy
166
+ @report.entropy
167
+ end
168
+
169
+ def test_message
170
+ @report.message
171
+ end
172
+ end
173
+
174
+
175
+ class TestBlastReportIteration < Test::Unit::TestCase
176
+ def setup
177
+ data = TestBlastFormat7XMLParserData.output
178
+ report = Bio::Blast::Report.new(data)
179
+ @itr = report.iterations.first
180
+ end
181
+
182
+ def test_hits
183
+ @itr.hits
184
+ end
185
+
186
+ def test_statistics
187
+ @itr.statistics
188
+ end
189
+
190
+ def test_num
191
+ @itr.num
192
+ end
193
+
194
+ def test_message
195
+ @itr.message
196
+ end
197
+ end
198
+
199
+
200
+ class TestBlastReportHit < Test::Unit::TestCase
201
+ def setup
202
+ data = Bio::TestBlastFormat7XMLParserData.output
203
+ report = Bio::Blast::Report.new(data)
204
+ @hit = report.hits.first
205
+ end
206
+
207
+ def test_hsps
208
+ @hit.hsps
209
+ end
210
+
211
+ def test_query_id
212
+ @hit.query_id
213
+ end
214
+
215
+ def test_query_def
216
+ @hit.query_def
217
+ end
218
+
219
+ def test_query_len
220
+ @hit.query_len
221
+ end
222
+
223
+ def test_num
224
+ @hit.num
225
+ end
226
+
227
+ def test_hit_id
228
+ @hit.hit_id
229
+ end
230
+
231
+ def test_len
232
+ @hit.len
233
+ end
234
+
235
+ def test_target_len
236
+ @hit.target_len
237
+ end
238
+
239
+ def test_definition
240
+ @hit.definition
241
+ end
242
+
243
+ def test_taeget_def
244
+ @hit.target_def
245
+ end
246
+
247
+ def test_accession
248
+ @hit.accession
249
+ end
250
+
251
+ def test_target_id
252
+ @hit.target_id
253
+ end
254
+
255
+ def test_evalue
256
+ @hit.evalue
257
+ end
258
+
259
+ def test_bit_score
260
+ @hit.bit_score
261
+ end
262
+
263
+ def test_identity
264
+ @hit.identity
265
+ end
266
+
267
+ def test_overlap
268
+ @hit.overlap
269
+ end
270
+
271
+ def test_query_seq
272
+ @hit.query_seq
273
+ end
274
+
275
+ def test_target_seq
276
+ @hit.target_seq
277
+ end
278
+
279
+ def test_midline
280
+ @hit.midline
281
+ end
282
+
283
+ def test_query_start
284
+ @hit.query_start
285
+ end
286
+
287
+ def test_query_end
288
+ @hit.query_end
289
+ end
290
+
291
+ def test_target_start
292
+ @hit.target_start
293
+ end
294
+
295
+ def test_target_end
296
+ @hit.target_end
297
+ end
298
+
299
+ def test_lap_at
300
+ @hit.lap_at
301
+ end
302
+ end
303
+
304
+
305
+ class TestBlastReportHsp < Test::Unit::TestCase
306
+ def setup
307
+ data = Bio::TestBlastFormat7XMLParserData.output
308
+ report = Bio::Blast::Report.new(data)
309
+ @hsp = report.hits.first.hsps.first
310
+ end
311
+
312
+ def test_num
313
+ assert_equal(1, @hsp.num)
314
+ end
315
+
316
+ def test_hit_score
317
+ @hsp.bit_score
318
+ end
319
+
320
+ def test_score
321
+ @hsp.score
322
+ end
323
+
324
+ def test_evalue
325
+ @hsp.evalue
326
+ end
327
+
328
+ def test_identity
329
+ @hsp.identity
330
+ end
331
+
332
+ def test_gaps
333
+ @hsp.gaps
334
+ end
335
+
336
+ def test_positive
337
+ @hsp.positive
338
+ end
339
+
340
+ def test_align_len
341
+ @hsp.align_len
342
+ end
343
+
344
+ def test_density
345
+ @hsp.density
346
+ end
347
+
348
+ def test_query_frame
349
+ @hsp.query_frame
350
+ end
351
+
352
+ def test_query_from
353
+ @hsp.query_from
354
+ end
355
+
356
+ def test_query_to
357
+ @hsp.query_to
358
+ end
359
+
360
+ def test_hit_frame
361
+ @hsp.hit_frame
362
+ end
363
+
364
+ def test_hit_from
365
+ @hsp.hit_from
366
+ end
367
+
368
+ def test_hit_to
369
+ @hsp.hit_to
370
+ end
371
+
372
+ def test_pattern_from
373
+ @hsp.pattern_from
374
+ end
375
+
376
+ def test_pattern_to
377
+ @hsp.pattern_to
378
+ end
379
+
380
+ def test_qseq
381
+ @hsp.qseq
382
+ end
383
+
384
+ def test_midline
385
+ @hsp.midline
386
+ end
387
+
388
+ def test_hseq
389
+ @hsp.hseq
390
+ end
391
+
392
+ def test_percent_identity
393
+ @hsp.percent_identity
394
+ end
395
+
396
+ def test_mismatch_count
397
+ @hsp.mismatch_count
398
+ end
399
+ end
400
+ end