bio 0.7.0

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.
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,195 @@
1
+ #
2
+ # test/unit/bio/appl/genscan/test_report.rb - Unit test for Bio::Genscan::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.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
25
+ $:.unshift(libpath) unless $:.include?(libpath)
26
+
27
+ require 'test/unit'
28
+ require 'bio/appl/genscan/report'
29
+
30
+
31
+ module Bio
32
+
33
+ class TestGenscanReport < Test::Unit::TestCase
34
+
35
+ def setup
36
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
37
+ test_data = Pathname.new(File.join(bioruby_root, 'test', 'data', 'genscan')).cleanpath.to_s
38
+ report = File.open(File.join(test_data, 'sample.report')).read
39
+
40
+ @obj = Bio::Genscan::Report.new(report)
41
+ end
42
+
43
+ def test_genscan_version
44
+ assert_equal('1.0', @obj.genscan_version)
45
+ end
46
+
47
+ def test_date_run
48
+ assert_equal('30-May-103', @obj.date_run)
49
+ end
50
+
51
+ def test_time
52
+ assert_equal("14:06:28", @obj.time)
53
+ end
54
+
55
+ def test_query_name
56
+ assert_equal('HUMRASH', @obj.query_name)
57
+ end
58
+
59
+ def test_length
60
+ assert_equal(12942, @obj.length)
61
+ end
62
+
63
+ def test_gccontent
64
+ assert_equal(68.17, @obj.gccontent)
65
+ end
66
+
67
+ def test_isochore
68
+ assert_equal('4 (57 - 100 C+G%)', @obj.isochore)
69
+ end
70
+
71
+ def test_matrix
72
+ assert_equal('HumanIso.smat', @obj.matrix)
73
+ end
74
+
75
+ def test_predictions_size
76
+ assert_equal(2, @obj.predictions.size)
77
+ end
78
+
79
+ end # TestGenscanReport
80
+
81
+
82
+ class TestGenscanReportGene < Test::Unit::TestCase
83
+
84
+ def setup
85
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
86
+ test_data = Pathname.new(File.join(bioruby_root, 'test', 'data', 'genscan')).cleanpath.to_s
87
+ report = File.open(File.join(test_data, 'sample.report')).read
88
+ @obj = Bio::Genscan::Report.new(report).predictions
89
+ end
90
+
91
+ def test_number
92
+ assert_equal(1, @obj.first.number)
93
+ end
94
+
95
+ def test_aaseq
96
+ assert_equal(Bio::FastaFormat, @obj.first.aaseq.class)
97
+ seq = "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAGQEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDLAARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPGCMSCKCVLS"
98
+ assert_equal(seq, @obj.first.aaseq.seq)
99
+ definition = "HUMRASH|GENSCAN_predicted_peptide_1|189_aa"
100
+ assert_equal(definition, @obj.first.aaseq.definition)
101
+ end
102
+
103
+ def test_naseq
104
+ assert_equal(Bio::FastaFormat, @obj.first.naseq.class)
105
+ seq = "atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgaccatccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctaccggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggccaggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgtgtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatcaaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctggctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccctacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtgcgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggctgcatgagctgcaagtgtgtgctctcctga"
106
+ assert_equal(seq, @obj.first.naseq.seq)
107
+ definition = "HUMRASH|GENSCAN_predicted_CDS_1|570_bp"
108
+ assert_equal(definition, @obj.first.naseq.definition)
109
+ end
110
+
111
+ def test_promoter
112
+ assert_equal(Bio::Genscan::Report::Exon, @obj.last.promoter.class)
113
+ assert_equal("Prom", @obj.last.promoter.exon_type)
114
+ end
115
+
116
+ def test_polyA
117
+ assert_equal(Bio::Genscan::Report::Exon, @obj.first.polyA.class)
118
+ assert_equal('PlyA', @obj.first.polyA.exon_type)
119
+ end
120
+
121
+ end # TestGenscanReportGene
122
+
123
+
124
+ class TestGenscanReportExon < Test::Unit::TestCase
125
+
126
+ def setup
127
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
128
+ test_data = Pathname.new(File.join(bioruby_root, 'test', 'data', 'genscan')).cleanpath.to_s
129
+ report = File.open(File.join(test_data, 'sample.report')).read
130
+ @obj = Bio::Genscan::Report.new(report).predictions.first.exons.first
131
+ end
132
+
133
+ def test_number
134
+ assert_equal(1, @obj.number)
135
+ end
136
+
137
+ def test_exon_type
138
+ assert_equal('Init', @obj.exon_type)
139
+ end
140
+
141
+ def test_exon_type_long
142
+ assert_equal('Initial exon', @obj.exon_type_long)
143
+ end
144
+
145
+ def test_strand
146
+ assert_equal('+', @obj.strand)
147
+ end
148
+
149
+ def test_first
150
+ assert_equal(1664, @obj.first)
151
+ end
152
+
153
+ def test_last
154
+ assert_equal(1774, @obj.last)
155
+ end
156
+
157
+ def test_range
158
+ assert_equal(1664..1774, @obj.range)
159
+ end
160
+
161
+ def test_phase
162
+ assert_equal('0', @obj.phase)
163
+ end
164
+
165
+ def test_acceptor_score
166
+ assert_equal(94, @obj.acceptor_score)
167
+ end
168
+
169
+ def test_donor_score
170
+ assert_equal(83, @obj.donor_score)
171
+ end
172
+
173
+ def test_initiation_score
174
+ assert_equal(94, @obj.initiation_score)
175
+ end
176
+
177
+ def test_termination_score
178
+ assert_equal(83, @obj.termination_score)
179
+ end
180
+
181
+ def test_score
182
+ assert_equal(212, @obj.score)
183
+ end
184
+
185
+ def test_p_value
186
+ assert_equal(0.997, @obj.p_value)
187
+ end
188
+
189
+ def test_t_score
190
+ assert_equal(21.33, @obj.t_score)
191
+ end
192
+
193
+ end # TestGenscanReportExon
194
+
195
+ end
@@ -0,0 +1,94 @@
1
+ #
2
+ # test/unit/bio/appl/sosui/test_report.rb - Unit test for Bio::SOSUI::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.3 2005/11/22 08:31:48 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/sosui/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', 'SOSUI')).cleanpath.to_s
35
+ SOSUIReport = File.open(File.join(test_data, 'sample.report')).read
36
+
37
+
38
+ class TestSOSUIReportConst < Test::Unit::TestCase
39
+
40
+ def test_delimiter
41
+ assert_equal("\n>", Bio::SOSUI::Report::DELIMITER)
42
+ end
43
+
44
+ def test_rs
45
+ assert_equal("\n>", Bio::SOSUI::Report::RS)
46
+ end
47
+
48
+ end
49
+
50
+
51
+ class TestSOSUIReport < Test::Unit::TestCase
52
+
53
+ def setup
54
+ @obj = Bio::SOSUI::Report.new(SOSUIReport)
55
+ end
56
+
57
+ def test_entry_id
58
+ assert_equal('Q9HC19', @obj.entry_id)
59
+ end
60
+
61
+ def test_prediction
62
+ assert_equal('MEMBRANE PROTEIN', @obj.prediction)
63
+ end
64
+
65
+ def test_tmhs
66
+ assert_equal(Array, @obj.tmhs.class)
67
+ assert_equal(Bio::SOSUI::Report::TMH, @obj.tmhs[0].class)
68
+ end
69
+
70
+ def test_tmh
71
+ assert_equal(7, @obj.tmhs.size)
72
+ end
73
+
74
+ end # class TestSOSUIReport
75
+
76
+ class TestSOSUITMH < Test::Unit::TestCase
77
+ def setup
78
+ @obj = Bio::SOSUI::Report.new(SOSUIReport).tmhs.first
79
+ end
80
+
81
+ def test_range
82
+ assert_equal(31..53, @obj.range)
83
+ end
84
+
85
+ def test_grade
86
+ assert_equal('SECONDARY', @obj.grade)
87
+ end
88
+
89
+ def test_sequence
90
+ assert_equal('HIRMTFLRKVYSILSLQVLLTTV', @obj.sequence)
91
+ end
92
+
93
+ end # class TestSOSUITMH
94
+ end
@@ -0,0 +1,159 @@
1
+ #
2
+ # test/unit/bio/appl/targetp/test_report.rb - Unit test for Bio::TargetP::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.3 2005/11/23 01:42:38 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/targetp/report'
29
+
30
+
31
+ module Bio
32
+
33
+ TargetPReport_plant =<<HOGE
34
+
35
+ ### ### ### T A R G E T P 1.0 prediction results ### ### ###
36
+
37
+ # Number of input sequences: 1
38
+ # Cleavage site predictions not included.
39
+ # Using PLANT networks.
40
+
41
+ # Name Length cTP mTP SP other Loc. RC
42
+ #----------------------------------------------------------------------------------
43
+ MGI_2141503 640 0.031 0.161 0.271 0.844 _ 3
44
+ #----------------------------------------------------------------------------------
45
+ # cutoff 0.00 0.00 0.00 0.00
46
+
47
+
48
+ HOGE
49
+
50
+ TargetPReport_plant_c =<<HOGE
51
+
52
+ ### ### ### T A R G E T P 1.0 prediction results ### ### ###
53
+
54
+ # Number of input sequences: 1
55
+ # Cleavage site predictions included.
56
+ # Using PLANT networks.
57
+
58
+ # Name Length cTP mTP SP other Loc. RC TPlen
59
+ #----------------------------------------------------------------------------------
60
+ MGI_2141503 640 0.031 0.161 0.271 0.844 _ 3 -
61
+ #----------------------------------------------------------------------------------
62
+ # cutoff 0.00 0.00 0.00 0.00
63
+
64
+
65
+
66
+ HOGE
67
+
68
+ TargetPReport_non_plant_c =<<HOGE
69
+
70
+ ### ### ### T A R G E T P 1.0 prediction results ### ### ###
71
+
72
+ # Number of input sequences: 1
73
+ # Cleavage site predictions included.
74
+ # Using NON-PLANT networks.
75
+
76
+ # Name Length mTP SP other Loc. RC TPlen
77
+ #--------------------------------------------------------------------------
78
+ MGI_96083 2187 0.292 0.053 0.746 _ 3 -
79
+ #--------------------------------------------------------------------------
80
+ # cutoff 0.00 0.00 0.00
81
+
82
+
83
+
84
+ HOGE
85
+
86
+
87
+ class TestTargetPReportConst < Test::Unit::TestCase
88
+
89
+ def test_delimiter
90
+ assert_equal("\n \n", Bio::TargetP::Report::DELIMITER)
91
+ end
92
+
93
+ def test_rs
94
+ assert_equal("\n \n", Bio::TargetP::Report::RS)
95
+ end
96
+
97
+ end # class TestTargetPReportConst
98
+
99
+
100
+ class TestTargetPReport < Test::Unit::TestCase
101
+
102
+ def setup
103
+ @obj = Bio::TargetP::Report.new(TargetPReport_plant)
104
+ end
105
+
106
+ def test_version
107
+ assert_equal('1.0', @obj.version)
108
+ end
109
+
110
+ def test_query_sequences
111
+ assert_equal(0, @obj.query_sequences)
112
+ end
113
+
114
+ def test_cleavage_site_prediction
115
+ assert_equal('not included', @obj.cleavage_site_prediction)
116
+ end
117
+
118
+ def test_networks
119
+ assert_equal('PLANT', @obj.networks)
120
+ end
121
+
122
+ def test_prediction
123
+ hash = {"Name"=>"MGI_2141503", "Loc."=>"_", "RC"=>3, "SP"=>0.271,
124
+ "other"=>0.844, "mTP"=>0.161, "cTP"=>0.031, "Length"=>640}
125
+ assert_equal(hash, @obj.pred)
126
+ assert_equal(hash, @obj.prediction)
127
+ end
128
+
129
+ def test_cutoff
130
+ hash = {"SP"=>0.0, "other"=>0.0, "mTP"=>0.0, "cTP"=>0.0}
131
+ assert_equal(hash, @obj.cutoff)
132
+ end
133
+
134
+
135
+ def test_entry_id
136
+ assert_equal('MGI_2141503', @obj.entry_id)
137
+ end
138
+
139
+ def test_name
140
+ assert_equal('MGI_2141503', @obj.name)
141
+ end
142
+
143
+ def test_query_len
144
+ assert_equal(640, @obj.query_len)
145
+ end
146
+
147
+ def test_length
148
+ assert_equal(640, @obj.length)
149
+ end
150
+
151
+ def test_loc
152
+ assert_equal('_', @obj.loc)
153
+ end
154
+
155
+ def test_rc
156
+ assert_equal(3, @obj.rc)
157
+ end
158
+ end # class TestTargetPReport
159
+ end