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
@@ -0,0 +1,159 @@
1
+ #
2
+ # test/unit/bio/appl/test_blast.rb - Unit test for Bio::Blast
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_blast.rb,v 1.2 2005/11/23 02:47:19 nakao Exp $
21
+ #
22
+
23
+ require 'pathname'
24
+ libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 4, '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 TestBlastData
33
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4)).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 TestBlast < Test::Unit::TestCase
54
+ def setup
55
+ @program = 'blastp'
56
+ @db = 'test'
57
+ @option = []
58
+ @server = 'localhost'
59
+ @blast = Bio::Blast.new(@program, @db, @option, @server)
60
+ end
61
+
62
+ def test_new
63
+ blast = Bio::Blast.new(@program, @db)
64
+ assert_equal(@program, blast.program)
65
+ assert_equal(@db, blast.db)
66
+ assert(blast.options)
67
+ assert_equal('local', blast.server)
68
+ assert_equal('blastall', blast.blastall)
69
+ end
70
+
71
+ def test_new_opt_string
72
+ blast = Bio::Blast.new(@program, @db, '-m 7 -F F')
73
+ assert_equal(['-m', '7', '-F', 'F'], blast.options)
74
+ end
75
+
76
+ def test_program
77
+ assert_equal(@program, @blast.program)
78
+ end
79
+
80
+ def test_db
81
+ assert_equal(@db, @blast.db)
82
+ end
83
+
84
+ def test_options
85
+ assert_equal([], @blast.options)
86
+ end
87
+
88
+ def test_option
89
+ assert_equal('', @blast.option)
90
+ end
91
+
92
+ def test_option_set
93
+ @blast.option = '-m 7 -p T'
94
+ assert_equal('-m 7 -p T', @blast.option)
95
+ end
96
+
97
+ def test_server
98
+ assert_equal(@server, @blast.server)
99
+ end
100
+
101
+ def test_blastll
102
+ assert_equal('blastall', @blast.blastall)
103
+ end
104
+
105
+ def test_matrix
106
+ assert_equal(nil, @blast.matrix)
107
+ end
108
+
109
+ def test_filter
110
+ assert_equal(nil, @blast.filter)
111
+ end
112
+
113
+ def test_parser
114
+ assert_equal(nil, @blast.instance_eval { @parser })
115
+ end
116
+
117
+ def test_output
118
+ assert_equal('', @blast.output)
119
+ end
120
+
121
+ def test_format
122
+ assert(@blast.format)
123
+ end
124
+
125
+ def test_self_local
126
+ assert(Bio::Blast.local(@program, @db, @option))
127
+ end
128
+
129
+ def test_self_local
130
+ assert(Bio::Blast.remote(@program, @db, @option))
131
+ end
132
+
133
+ def test_query
134
+ # to be tested in test/functional/bio/test_blast.rb
135
+ end
136
+
137
+ def test_blast_reports
138
+ Bio::Blast.reports(TestBlastData.output) do |report|
139
+ assert(report)
140
+ end
141
+ end
142
+
143
+ def test_parse_result
144
+ assert(@blast.instance_eval { parse_result(TestBlastData.output) })
145
+ end
146
+
147
+ def test_exec_local
148
+ # to be tested in test/functional/bio/test_blast.rb
149
+ end
150
+
151
+ def test_exec_genomenet
152
+ # to be tested in test/functional/bio/test_blast.rb
153
+ end
154
+
155
+ def test_exec_ncbi
156
+ # to be tested in test/functional/bio/test_blast.rb
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,142 @@
1
+ #
2
+ # test/unit/bio/appl/test_fasta.rb - Unit test for Bio::Fasta
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_fasta.rb,v 1.1 2005/12/18 16:50:20 nakao Exp $
21
+ #
22
+
23
+ require 'pathname'
24
+ libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib'))).cleanpath.to_s
25
+ $:.unshift(libpath) unless $:.include?(libpath)
26
+
27
+ require 'test/unit'
28
+ require 'bio/appl/fasta'
29
+
30
+
31
+ module Bio
32
+
33
+ class TestFastaInitialize < Test::Unit::TestCase
34
+ def test_new_1
35
+ program = 'string'
36
+ db = 'string'
37
+ option = ['-e', '0.001']
38
+ server = 'local'
39
+ assert_raise(ArgumentError) { Bio::Fasta.new() }
40
+ assert_raise(ArgumentError) { Bio::Fasta.new(program) }
41
+ assert(Bio::Fasta.new(program, db))
42
+ assert(Bio::Fasta.new(program, db, option))
43
+ assert(Bio::Fasta.new(program, db, option, server))
44
+ assert_raise(ArgumentError) { Bio::Fasta.new(program, db, option, server, nil) }
45
+ end
46
+
47
+ def test_option_backward_compatibility
48
+ fasta = Bio::Fasta.new('program', 'db', "-e 10")
49
+ assert_equal([ '-Q', '-H', '-m','10', '-e', '10'], fasta.options)
50
+ end
51
+
52
+ def test_option
53
+ fasta = Bio::Fasta.new('program', 'db', ["-e", "10"])
54
+ assert_equal([ '-Q', '-H', '-m','10', '-e', '10'], fasta.options)
55
+ end
56
+ end
57
+
58
+
59
+ class TestFasta < Test::Unit::TestCase
60
+
61
+ def setup
62
+ program = 'ssearch'
63
+ db = 'nr'
64
+ option = ['-e', '10']
65
+ @obj = Bio::Fasta.new(program, db, option)
66
+ end
67
+
68
+ def test_program
69
+ assert_equal('ssearch', @obj.program)
70
+ @obj.program = 'lalign'
71
+ assert_equal('lalign', @obj.program)
72
+ end
73
+
74
+ def test_db
75
+ assert_equal('nr', @obj.db)
76
+ @obj.db = 'refseq'
77
+ assert_equal('refseq', @obj.db)
78
+ end
79
+
80
+ def test_options
81
+ assert_equal(["-Q", "-H", "-m", "10", "-e", "10"], @obj.options)
82
+ @obj.options = ['-Q', '-H', '-m', '8']
83
+ assert_equal(['-Q', '-H', '-m', '8'], @obj.options)
84
+ end
85
+
86
+ def test_server
87
+ assert_equal('local', @obj.server)
88
+ @obj.server = 'genomenet'
89
+ assert_equal('genomenet', @obj.server)
90
+ end
91
+
92
+ def test_ktup
93
+ assert_equal(nil, @obj.ktup)
94
+ @obj.ktup = 6
95
+ assert_equal(6, @obj.ktup)
96
+ end
97
+ def test_matrix
98
+ assert_equal(nil, @obj.matrix)
99
+ @obj.matrix = 'PAM120'
100
+ assert_equal('PAM120', @obj.matrix)
101
+ end
102
+
103
+ def test_output
104
+ assert_equal('', @obj.output)
105
+ # assert_raise(NoMethodError) { @obj.output = "" }
106
+ end
107
+
108
+ def test_option
109
+ option = ['-M'].to_s
110
+ assert(@obj.option = option)
111
+ assert_equal(option, @obj.option)
112
+ end
113
+
114
+ def test_format
115
+ assert_equal(10, @obj.format)
116
+ end
117
+
118
+ def test_format_arg_str
119
+ assert(@obj.format = '1')
120
+ assert_equal(1, @obj.format)
121
+ end
122
+
123
+ def test_format_arg_integer
124
+ assert(@obj.format = 2)
125
+ assert_equal(2, @obj.format)
126
+ end
127
+ end
128
+
129
+ class TestFastaQuery < Test::Unit::TestCase
130
+ def test_self_parser
131
+ end
132
+ def test_self_local
133
+ # test/functional/bio/test_fasta.rb
134
+ end
135
+ def test_self_remote
136
+ # test/functional/bio/test_fasta.rb
137
+ end
138
+ def test_query
139
+ end
140
+ end
141
+
142
+ end
@@ -0,0 +1,139 @@
1
+ #
2
+ # test/unit/bio/appl/tmhmm/test_report.rb - Unit test for Bio::TMHMM::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/23 05:10:34 nakao Exp $
21
+ #
22
+
23
+ require 'pathname'
24
+ libpath = Pathname.new(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/tmhmm/report'
29
+
30
+
31
+ module Bio
32
+
33
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
34
+ test_data = Pathname.new(File.join(bioruby_root, 'test', 'data', 'TMHMM')).cleanpath.to_s
35
+ TMHMMReport = File.open(File.join(test_data, 'sample.report')).read
36
+
37
+
38
+ class TestTMHMMReport_reports < Test::Unit::TestCase
39
+ def test_reports
40
+ assert(Bio::TMHMM.reports(""))
41
+ end
42
+ end
43
+
44
+ class TestTMHMMReport < Test::Unit::TestCase
45
+
46
+ def setup
47
+ @obj = Bio::TMHMM::Report.new(TMHMMReport)
48
+ end
49
+
50
+ def test_entry_id
51
+ assert_equal('O42385', @obj.entry_id)
52
+ end
53
+
54
+ def test_query_len
55
+ assert_equal(423, @obj.query_len)
56
+ end
57
+
58
+ def test_predicted_tmhs
59
+ assert_equal(7, @obj.predicted_tmhs)
60
+ end
61
+
62
+ def test_tmhs
63
+ assert_equal(Array, @obj.tmhs.class)
64
+ assert_equal(15, @obj.tmhs.size)
65
+ end
66
+
67
+ def test_exp_aas_in_tmhs
68
+ assert_equal(157.40784, @obj.exp_aas_in_tmhs)
69
+ end
70
+
71
+ def test_exp_first_60aa
72
+ assert_equal(13.85627, @obj.exp_first_60aa)
73
+ end
74
+
75
+ def test_total_prob_of_N_in
76
+ assert_equal(0.00993, @obj.total_prob_of_N_in)
77
+ end
78
+
79
+ def test_helix
80
+ assert_equal(7, @obj.helix.size)
81
+ assert_equal(Bio::TMHMM::TMH, @obj.helix[0].class)
82
+ end
83
+
84
+ def test_to_s
85
+ str = ["# O42385\tLength:\t423",
86
+ "# O42385\tNumber of predicted TMHs:\t7",
87
+ "# O42385\tExp number of AAs in THMs:\t157.40784",
88
+ "# O42385\tExp number, first 60 AAs:\t13.85627",
89
+ "# O42385\tTotal prob of N-in:\t0.00993",
90
+ "O42385\tTMHMM2.0\toutside\t1\t46",
91
+ "O42385\tTMHMM2.0\tTMhelix\t47\t69",
92
+ "O42385\tTMHMM2.0\tinside\t70\t81",
93
+ "O42385\tTMHMM2.0\tTMhelix\t82\t104",
94
+ "O42385\tTMHMM2.0\toutside\t105\t118",
95
+ "O42385\tTMHMM2.0\tTMhelix\t119\t141",
96
+ "O42385\tTMHMM2.0\tinside\t142\t161",
97
+ "O42385\tTMHMM2.0\tTMhelix\t162\t184",
98
+ "O42385\tTMHMM2.0\toutside\t185\t205",
99
+ "O42385\tTMHMM2.0\tTMhelix\t206\t228",
100
+ "O42385\tTMHMM2.0\tinside\t229\t348",
101
+ "O42385\tTMHMM2.0\tTMhelix\t349\t371",
102
+ "O42385\tTMHMM2.0\toutside\t372\t380",
103
+ "O42385\tTMHMM2.0\tTMhelix\t381\t403",
104
+ "O42385\tTMHMM2.0\tinside\t404\t423"].join("\n")
105
+ assert_equal(str, @obj.to_s)
106
+ end
107
+
108
+ end # TestTMHMMReport
109
+
110
+ class TestTMHMMTMH < Test::Unit::TestCase
111
+
112
+ def setup
113
+ @obj = Bio::TMHMM::Report.new(TMHMMReport).tmhs.first
114
+ end
115
+
116
+ def test_entry_id
117
+ assert_equal('O42385', @obj.entry_id)
118
+ end
119
+
120
+ def test_version
121
+ assert_equal('TMHMM2.0', @obj.version)
122
+ end
123
+
124
+ def test_status
125
+ assert_equal('outside', @obj.status)
126
+ end
127
+
128
+ def test_range
129
+ assert_equal(1..46, @obj.range)
130
+ end
131
+
132
+ def test_pos
133
+ assert_equal(1..46, @obj.pos)
134
+ end
135
+
136
+ end # class TestTMHMMTMH
137
+
138
+
139
+ end
@@ -0,0 +1,103 @@
1
+ #
2
+ # test/unit/bio/data/test_aa.rb - Unit test for Bio::AminoAcid
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_aa.rb,v 1.4 2005/11/23 05:25:10 nakao Exp $
21
+ #
22
+
23
+ require 'pathname'
24
+ libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
25
+ $:.unshift(libpath) unless $:.include?(libpath)
26
+
27
+ require 'test/unit'
28
+ require 'bio/data/aa'
29
+
30
+ module Bio
31
+ class TestAAConstants < Test::Unit::TestCase
32
+ def test_bio_aminoacid
33
+ assert_equal('Ala', Bio::AminoAcid['A'])
34
+ end
35
+ end
36
+
37
+
38
+ class TestAA < Test::Unit::TestCase
39
+ def setup
40
+ @obj = Bio::AminoAcid.new
41
+ end
42
+
43
+ def test_13
44
+ assert_equal("Ala", @obj['A'])
45
+ end
46
+
47
+ def test_1n
48
+ assert_equal('alanine', @obj.name('A'))
49
+ end
50
+
51
+ def test_to_1_name
52
+ assert_equal('A', @obj.to_1('alanine'))
53
+ end
54
+
55
+ def test_to_1_3
56
+ assert_equal('A', @obj.to_1('Ala'))
57
+ end
58
+
59
+ def test_to_1_1
60
+ assert_equal('A', @obj.to_1('A'))
61
+ end
62
+
63
+ def test_to_3_name
64
+ assert_equal('Ala', @obj.to_3('alanine'))
65
+ end
66
+
67
+ def test_to_3_3
68
+ assert_equal('Ala', @obj.to_3('Ala'))
69
+ end
70
+
71
+ def test_to_3_1
72
+ assert_equal('Ala', @obj.to_3('A'))
73
+ end
74
+
75
+ def test_one2three
76
+ assert_equal('Ala', @obj.one2three('A'))
77
+ end
78
+
79
+ def test_three2one
80
+ assert_equal('A', @obj.three2one('Ala'))
81
+ end
82
+
83
+ def test_one2name
84
+ assert_equal('alanine', @obj.one2name('A'))
85
+ end
86
+
87
+ def test_name2one
88
+ assert_equal('A', @obj.name2one('alanine'))
89
+ end
90
+
91
+ def test_three2name
92
+ assert_equal('alanine', @obj.three2name('Ala'))
93
+ end
94
+
95
+ def test_name2three
96
+ assert_equal('Ala', @obj.name2three('alanine'))
97
+ end
98
+
99
+ def test_to_re
100
+ assert_equal(/[DN][EQ]ACDEFGHIKLMNPQRSTVWYU/, @obj.to_re('BZACDEFGHIKLMNPQRSTVWYU'))
101
+ end
102
+ end
103
+ end