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,268 @@
1
+ #
2
+ # test/unit/bio/db/embl/test_sptr.rb - Unit test for Bio::SPTR
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_sptr.rb,v 1.2 2005/11/23 10:06:12 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/db/embl/sptr'
29
+
30
+ module Bio
31
+ class TestSPTR < Test::Unit::TestCase
32
+
33
+ def setup
34
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
35
+ data = File.open(File.join(bioruby_root, 'test', 'data', 'uniprot', 'p53_human.uniprot')).read
36
+ @obj = Bio::SPTR.new(data)
37
+ end
38
+
39
+ def test_id_line
40
+ assert(@obj.id_line)
41
+ end
42
+
43
+ def test_id_line_entry_name
44
+ assert_equal('P53_HUMAN', @obj.id_line('ENTRY_NAME'))
45
+ end
46
+
47
+ def test_id_line_data_class
48
+ assert_equal('STANDARD', @obj.id_line('DATA_CLASS'))
49
+ end
50
+
51
+ def test_id_line_molecule_type
52
+ assert_equal('PRT', @obj.id_line('MOLECULE_TYPE'))
53
+ end
54
+
55
+ def test_id_line_sequence_length
56
+ assert_equal(393, @obj.id_line('SEQUENCE_LENGTH'))
57
+ end
58
+
59
+ def test_entry
60
+ entry = 'P53_HUMAN'
61
+ assert_equal(entry, @obj.entry)
62
+ assert_equal(entry, @obj.entry_name)
63
+ assert_equal(entry, @obj.entry_id)
64
+ end
65
+
66
+ def test_molecule
67
+ assert_equal('PRT', @obj.molecule)
68
+ assert_equal('PRT', @obj.molecule_type)
69
+ end
70
+
71
+ def test_sequence_length
72
+ seqlen = 393
73
+ assert_equal(seqlen, @obj.sequence_length)
74
+ assert_equal(seqlen, @obj.aalen)
75
+ end
76
+
77
+ def test_ac
78
+ acs = ["P04637", "Q15086", "Q15087", "Q15088", "Q16535", "Q16807", "Q16808", "Q16809", "Q16810", "Q16811", "Q16848", "Q86UG1", "Q8J016", "Q99659", "Q9BTM4", "Q9HAQ8", "Q9NP68", "Q9NPJ2", "Q9NZD0", "Q9UBI2", "Q9UQ61"]
79
+ assert_equal(acs, @obj.ac)
80
+ assert_equal(acs, @obj.accessions)
81
+ end
82
+
83
+ def test_accession
84
+ assert_equal('P04637', @obj.accession)
85
+ end
86
+
87
+ def test_dt
88
+ assert(@obj.dt)
89
+ end
90
+
91
+ def test_dt_created
92
+ assert_equal('13-AUG-1987 (Rel. 05, Created)', @obj.dt('created'))
93
+ end
94
+
95
+ def test_dt_sequence
96
+ assert_equal('01-MAR-1989 (Rel. 10, Last sequence update)', @obj.dt('sequence'))
97
+ end
98
+
99
+ def test_dt_annotation
100
+ assert_equal('13-SEP-2005 (Rel. 48, Last annotation update)', @obj.dt('annotation'))
101
+ end
102
+
103
+ def test_de
104
+ assert(@obj.de)
105
+ end
106
+
107
+ def test_protein_name
108
+ assert_equal("Cellular tumor antigen p53", @obj.protein_name)
109
+ end
110
+
111
+ def test_synonyms
112
+ assert_equal(["Tumor suppressor p53", "Phosphoprotein p53", "Antigen NY-CO-13"], @obj.synonyms)
113
+ end
114
+
115
+ def test_gn
116
+ assert_equal([{:orfs=>[], :synonyms=>["P53"], :name=>"TP53", :loci=>[]}], @obj.gn)
117
+ end
118
+
119
+ def test_gn_uniprot_parser
120
+ gn_uniprot_data = ''
121
+ assert_equal([{:orfs=>[], :loci=>[], :name=>"TP53", :synonyms=>["P53"]}], @obj.instance_eval("gn_uniprot_parser"))
122
+ end
123
+
124
+ def test_gn_old_parser
125
+ gn_old_data = ''
126
+ assert_equal([["Name=TP53; Synonyms=P53;"]], @obj.instance_eval("gn_old_parser"))
127
+ end
128
+
129
+ def test_gene_names
130
+ assert_equal(["TP53"], @obj.gene_names)
131
+ end
132
+
133
+ def test_gene_name
134
+ assert_equal('TP53', @obj.gene_name)
135
+ end
136
+
137
+ def test_os
138
+ assert(@obj.os)
139
+ end
140
+
141
+ def test_os_access
142
+ assert_equal("Homo sapiens (Human)", @obj.os(0))
143
+ end
144
+
145
+ def test_os_access2
146
+ assert_equal({"name"=>"(Human)", "os"=>"Homo sapiens"}, @obj.os[0])
147
+ end
148
+
149
+ def test_og_1
150
+ og = "OG Plastid; Chloroplast."
151
+ ary = ['Plastid', 'Chloroplast']
152
+ @obj.instance_eval("@orig['OG'] = '#{og}'")
153
+ assert_equal(ary, @obj.og)
154
+ end
155
+
156
+ def test_og_2
157
+ og = "OG Mitochondrion."
158
+ ary = ['Mitochondrion']
159
+ @obj.instance_eval("@orig['OG'] = '#{og}'")
160
+ assert_equal(ary, @obj.og)
161
+ end
162
+
163
+ def test_og_3
164
+ og = "OG Plasmid sym pNGR234a."
165
+ ary = ["Plasmid sym pNGR234a"]
166
+ @obj.instance_eval("@orig['OG'] = '#{og}'")
167
+ assert_equal(ary, @obj.og)
168
+ end
169
+
170
+ def test_og_4
171
+ og = "OG Plastid; Cyanelle."
172
+ ary = ['Plastid', 'Cyanelle']
173
+ @obj.instance_eval("@orig['OG'] = '#{og}'")
174
+ assert_equal(ary, @obj.og)
175
+ end
176
+
177
+ def test_og_5
178
+ og = "OG Plasmid pSymA (megaplasmid 1)."
179
+ ary = ["Plasmid pSymA (megaplasmid 1)"]
180
+ @obj.instance_eval("@orig['OG'] = '#{og}'")
181
+ assert_equal(ary, @obj.og)
182
+ end
183
+
184
+ def test_og_6
185
+ og = "OG Plasmid pNRC100, Plasmid pNRC200, and Plasmid pHH1."
186
+ ary = ['Plasmid pNRC100', 'Plasmid pNRC200', 'Plasmid pHH1']
187
+ @obj.instance_eval("@orig['OG'] = '#{og}'")
188
+ assert_equal(ary, @obj.og)
189
+ end
190
+
191
+ def test_oc
192
+ assert_equal(["Eukaryota", "Metazoa", "Chordata", "Craniata", "Vertebrata", "Euteleostomi", "Mammalia", "Eutheria", "Euarchontoglires", "Primates", "Catarrhini", "Hominidae", "Homo"], @obj.oc)
193
+ end
194
+
195
+ def test_ox
196
+ assert_equal({"NCBI_TaxID"=>["9606"]}, @obj.ox)
197
+ end
198
+
199
+ def test_ref # Bio::EMBL::COMMON#ref
200
+ @obj.ref
201
+ end
202
+
203
+ def test_cc
204
+ assert_equal(Hash, @obj.cc.class)
205
+ end
206
+
207
+ def test_cc_database
208
+ db = [{"NAME"=>"IARC TP53 mutation database", "WWW"=>"http://www.iarc.fr/p53/", "FTP"=>nil, "NOTE"=>"IARC db of somatic p53 mutations"},
209
+ {"NAME"=>"Tokyo p53", "WWW"=>"http://p53.genome.ad.jp/", "FTP"=>nil, "NOTE"=>"University of Tokyo db of p53 mutations"},
210
+ {"NAME"=>"p53 web site at the Institut Curie", "WWW"=>"http://p53.curie.fr/", "FTP"=>nil, "NOTE"=>nil},
211
+ {"NAME"=>"Atlas Genet. Cytogenet. Oncol. Haematol.", "WWW"=>"http://www.infobiogen.fr/services/chromcancer/Genes/P53ID88.html", "FTP"=>nil, "NOTE"=>nil}]
212
+ assert_equal(db, @obj.cc('DATABASE'))
213
+ end
214
+
215
+ def test_cc_alternative_products
216
+ ap = {"Comment"=>nil, "Named isoforms"=>"2", "Variants"=> [{"IsoId"=>"P04637-1", "Name"=>"1", "Sequence"=>["Displayed"]},
217
+ {"IsoId"=>"P04637-2", "Name"=>"2", "Synonyms"=>"I9RET", "Sequence"=>["VSP_006535", "VSP_006536"]}],
218
+ "Event"=>"Alternative splicing"}
219
+ assert_equal(ap, @obj.cc('ALTERNATIVE PRODUCTS'))
220
+ end
221
+
222
+ def test_cc_mass_spectrometry
223
+ assert_equal(nil, @obj.cc('MASS SPECTROMETRY'))
224
+ end
225
+
226
+
227
+
228
+ def test_kw
229
+ keywords = ["3D-structure", "Acetylation", "Activator", "Alternative splicing", "Anti-oncogene", "Apoptosis", "Cell cycle", "Disease mutation", "DNA-binding", "Glycoprotein", "Li-Fraumeni syndrome", "Metal-binding", "Nuclear protein", "Phosphorylation", "Polymorphism", "Transcription", "Transcription regulation", "Zinc"]
230
+ assert_equal(keywords, @obj.kw)
231
+ end
232
+
233
+ def test_ft
234
+ assert(@obj.ft)
235
+ name = 'DNA_BIND'
236
+ assert_equal([{"FTId"=>nil, "From"=>102, "diff"=>[], "To"=>292, "Description"=>nil}], @obj.ft(name))
237
+ end
238
+
239
+ def test_sq
240
+ assert_equal({"CRC64"=>"AD5C149FD8106131", "aalen"=>393, "MW"=>43653}, @obj.sq)
241
+ end
242
+
243
+ def test_sq_crc64
244
+ assert_equal("AD5C149FD8106131", @obj.sq('CRC64'))
245
+ end
246
+
247
+ def test_sq_mw
248
+ mw = 43653
249
+ assert_equal(mw, @obj.sq('mw'))
250
+ assert_equal(mw, @obj.sq('molecular'))
251
+ assert_equal(mw, @obj.sq('weight'))
252
+ end
253
+
254
+ def test_sq_len
255
+ length = 393
256
+ assert_equal(length, @obj.sq('len'))
257
+ assert_equal(length, @obj.sq('length'))
258
+ assert_equal(length, @obj.sq('AA'))
259
+ end
260
+
261
+ def test_seq
262
+ seq = 'MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGPDEAPRMPEAAPPVAPAPAAPTPAAPAPAPSWPLSSSVPSQKTYQGSYGFRLGFLHSGTAKSVTCTYSPALNKMFCQLAKTCPVQLWVDSTPPPGTRVRAMAIYKQSQHMTEVVRRCPHHERCSDSDGLAPPQHLIRVEGNLRVEYLDDRNTFRHSVVVPYEPPEVGSDCTTIHYNYMCNSSCMGGMNRRPILTIITLEDSSGNLLGRNSFEVRVCACPGRDRRTEEENLRKKGEPHHELPPGSTKRALPNNTSSSPQPKKKPLDGEYFTLQIRGRERFEMFRELNEALELKDAQAGKEPGGSRAHSSHLKSKKGQSTSRHKKLMFKTEGPDSD'
263
+ assert_equal(seq, @obj.seq)
264
+ assert_equal(seq, @obj.aaseq)
265
+ end
266
+
267
+ end
268
+ end
@@ -0,0 +1,44 @@
1
+ #
2
+ # test/unit/bio/db/embl/test_uniprot.rb - Unit test for Bio::UniProt
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_uniprot.rb,v 1.3 2005/12/18 17:43:51 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/db/embl/uniprot'
29
+
30
+ module Bio
31
+ class TestUniProt < Test::Unit::TestCase
32
+
33
+ def setup
34
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
35
+ data = File.open(File.join(bioruby_root, 'test', 'data', 'uniprot', 'p53_human.uniprot')).read
36
+ @obj = Bio::UniProt.new(data)
37
+ end
38
+
39
+ def test_gene_name
40
+ assert_equal('TP53', @obj.gene_name)
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,58 @@
1
+ #
2
+ # test/unit/bio/db/kegg/test_genes.rb - Unit test for Bio::KEGG::GENES
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_genes.rb,v 1.3 2005/11/09 13:20:09 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/db/kegg/genes'
29
+
30
+ module Bio
31
+ class TestGenesDblinks < Test::Unit::TestCase
32
+
33
+ def setup
34
+ entry =<<END
35
+ DBLINKS TIGR: At3g05560
36
+ NCBI-GI: 15230008 42572267
37
+ END
38
+ @obj = Bio::KEGG::GENES.new(entry)
39
+ end
40
+
41
+ def test_data
42
+ str = "DBLINKS TIGR: At3g05560\n NCBI-GI: 15230008 42572267"
43
+ assert_equal(str, @obj.instance_eval('get("DBLINKS")'))
44
+ end
45
+
46
+ def test_dblinks_0
47
+ assert_equal(Hash, @obj.dblinks.class)
48
+ end
49
+
50
+ def test_dblinks_1
51
+ assert_equal(['At3g05560'], @obj.dblinks['TIGR'])
52
+ end
53
+
54
+ def test_dblinks_2
55
+ assert_equal(['15230008', '42572267'], @obj.dblinks['NCBI-GI'])
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,263 @@
1
+ #
2
+ # test/unit/bio/db/test_fasta.rb - Unit test for Bio::FastaFormat
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.3 2005/12/18 17:55:13 k 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/db/fasta'
29
+
30
+ module Bio
31
+ class TestFastaFormatConst < Test::Unit::TestCase
32
+
33
+ def test_delimiter
34
+ assert_equal("\n>", Bio::FastaFormat::DELIMITER)
35
+ assert_equal("\n>", Bio::FastaFormat::RS)
36
+ end
37
+
38
+ end # class TestFastaFormatConst
39
+
40
+
41
+ class TestFastaFormatSwissProt < Test::Unit::TestCase
42
+ def setup
43
+ text =<<END
44
+ >gi|1171674|sp|P42267|NDD_BPR69 NUCLEAR DISRUPTION PROTEIN
45
+ MKYMTVTDLNNAGATVIGTIKGGEWFLGTPHKDILSKPGFYFLVSKLDGRPFSNPCVSARFYVGNQRSKQGFSAVLSHIR
46
+ QRRSQLARTIANNNMVYTVFYLPASKMKPLTTGFGKGQLALAFTRNHHSEYQTLEEMNRMLADNFKFVLQAY
47
+ END
48
+ @obj = Bio::FastaFormat.new(text)
49
+ end
50
+
51
+ def test_locus
52
+ assert_equal(nil, @obj.locus)
53
+ end
54
+ end
55
+
56
+ class TestFastaFormatKeggGenesNT < Test::Unit::TestCase
57
+ def setup
58
+ text =<<END
59
+ >eco:b0001 thrL; thr operon leader peptide (N)
60
+ atgaaacgcattagcaccaccattaccaccaccatcaccattaccacaggtaacggtgcg
61
+ ggctga
62
+ END
63
+ @obj = Bio::FastaFormat.new(text)
64
+ end
65
+
66
+ def test_naseq_class
67
+ assert_equal(Bio::Sequence::NA, @obj.naseq.class)
68
+ end
69
+
70
+ def test_naseq
71
+ seq = 'atgaaacgcattagcaccaccattaccaccaccatcaccattaccacaggtaacggtgcgggctga'
72
+ assert_equal(seq, @obj.naseq)
73
+ end
74
+
75
+ def test_nalen
76
+ assert_equal(66, @obj.nalen)
77
+ end
78
+ end
79
+
80
+ class TestFastaFormatKeggGenesAA < Test::Unit::TestCase
81
+ def setup
82
+ text =<<END
83
+ >sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]
84
+ MSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG
85
+ VPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME
86
+ GIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL
87
+ KLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC
88
+ IFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP
89
+ QWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES
90
+ >sce:YBR274W CHK1; probable serine/threonine-protein kinase [EC:2.7.1.-] [SP:KB9S_YEAST]
91
+ MSLSQVSPLPHIKDVVLGDTVGQGAFACVKNAHLQMDPSIILAVKFIHVP
92
+ TCKKMGLSDKDITKEVVLQSKCSKHPNVLRLIDCNVSKEYMWIILEMADG
93
+ GDLFDKIEPDVGVDSDVAQFYFQQLVSAINYLHVECGVAHRDIKPENILL
94
+ DKNGNLKLADFGLASQFRRKDGTLRVSMDQRGSPPYMAPEVLYSEEGYYA
95
+ DRTDIWSIGILLFVLLTGQTPWELPSLENEDFVFFIENDGNLNWGPWSKI
96
+ EFTHLNLLRKILQPDPNKRVTLKALKLHPWVLRRASFSGDDGLCNDPELL
97
+ AKKLFSHLKVSLSNENYLKFTQDTNSNNRYISTQPIGNELAELEHDSMHF
98
+ QTVSNTQRAFTSYDSNTNYNSGTGMTQEAKWTQFISYDIAALQFHSDEND
99
+ CNELVKRHLQFNPNKLTKFYTLQPMDVLLPILEKALNLSQIRVKPDLFAN
100
+ FERLCELLGYDNVFPLIINIKTKSNGGYQLCGSISIIKIEEELKSVGFER
101
+ KTGDPLEWRRLFKKISTICRDIILIPN
102
+ END
103
+ @obj = Bio::FastaFormat.new(text)
104
+ end
105
+
106
+ def test_entry_id
107
+ assert_equal('sce:YBR160W', @obj.entry_id)
108
+ end
109
+
110
+ def test_acc_version
111
+ assert_equal(nil, @obj.acc_version)
112
+ end
113
+
114
+ def test_entry
115
+ data = ">sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]\nMSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG\nVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME\nGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL\nKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC\nIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP\nQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES\n"
116
+ assert_equal(data, @obj.entry)
117
+ end
118
+
119
+ def test_definition
120
+ data = "sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]"
121
+ assert_equal(data, @obj.definition)
122
+ end
123
+
124
+ def test_data
125
+ data = "\nMSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG\nVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME\nGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL\nKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC\nIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP\nQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES\n"
126
+ assert_equal(data, @obj.data)
127
+ end
128
+ end
129
+
130
+ class TestFastaFormat < Test::Unit::TestCase
131
+
132
+ def setup
133
+ text =<<END
134
+ >gi|55416189|gb|AAV50056.1| NADH dehydrogenase subunit 1 [Dasyurus hallucatus]
135
+ MFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALT
136
+ IALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSF
137
+ TLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTI
138
+ LFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL
139
+ >gi|55416190|gb|AAV50057.1| NADH dehydrogenase subunit 2 [Dasyurus hallucatus]
140
+ MSPYVLMILTLSLFIGTCLTIFSNHWFTAWMGLEINTLAIIPLMTAPNNPRSTEAATKYFLTQATASMLMMFAIIYNAWS
141
+ TNQWALPQLSDDWISLLMTVALAIKLGLAPFHFWVPEVTQGIPLLTGMILLTWQKIAPTAILFQIAPYLNMKFLVILAIL
142
+ STLVGGWGGLNQTHLRKILAYSSIAHMGWMIIIVQINPTLSIFTLTIYVMATLTTFLTLNLSNSTKIKSLGNLWNKSATA
143
+ TIIIFLTLLSLGGLPPLTGFMPKWLILQELINNGNIITATMMALSALLNLFFYMRLIYASSLTMFPSINNSKMQWYNNSM
144
+ KTTTLIPTATVISSLLLPLTPLFVTLY
145
+ END
146
+ @obj = Bio::FastaFormat.new(text)
147
+ end
148
+
149
+ def test_entry
150
+ data = ">gi|55416189|gb|AAV50056.1| NADH dehydrogenase subunit 1 [Dasyurus hallucatus]\nMFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALT\nIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSF\nTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTI\nLFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL\n"
151
+ assert_equal(data, @obj.entry)
152
+ end
153
+
154
+ def test_entry_id
155
+ assert_equal('gi|55416189', @obj.entry_id)
156
+ end
157
+
158
+ def test_definition
159
+ data = "gi|55416189|gb|AAV50056.1| NADH dehydrogenase subunit 1 [Dasyurus hallucatus]"
160
+ assert_equal(data, @obj.definition)
161
+ end
162
+
163
+ def test_data
164
+ data = "\nMFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALT\nIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSF\nTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTI\nLFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL\n"
165
+ assert_equal(data, @obj.data)
166
+ end
167
+
168
+ def test_seq
169
+ seq = 'MFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALTIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSFTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTILFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL'
170
+ assert_equal(seq, @obj.seq)
171
+ end
172
+
173
+ def test_length
174
+ assert_equal(318, @obj.length)
175
+ end
176
+
177
+ def test_aaseq
178
+ seq = "MFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALTIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSFTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTILFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL"
179
+ assert_equal(seq, @obj.aaseq)
180
+ end
181
+
182
+ def test_aalen
183
+ assert_equal(318, @obj.aalen)
184
+ end
185
+
186
+ def test_identifiers
187
+ assert_equal(Bio::FastaDefline, @obj.identifiers.class)
188
+ end
189
+
190
+ def test_gi
191
+ assert_equal('55416189', @obj.gi)
192
+ end
193
+
194
+ def test_accession
195
+ assert_equal('AAV50056', @obj.accession)
196
+ end
197
+
198
+ def test_accessions
199
+ assert_equal(['AAV50056'], @obj.accessions)
200
+ end
201
+
202
+ def test_acc_version
203
+ assert_equal('AAV50056.1', @obj.acc_version)
204
+ end
205
+
206
+ end # class TestFastaFormat
207
+
208
+
209
+ class TestFastaNumericFormat < Test::Unit::TestCase
210
+
211
+ def setup
212
+ text =<<END
213
+ >CRA3575282.F
214
+ 24 15 23 29 20 13 20 21 21 23 22 25 13 22 17 15 25 27 32 26
215
+ 32 29 29 25
216
+ END
217
+ @obj = Bio::FastaNumericFormat.new(text)
218
+ end
219
+
220
+ def test_entry
221
+ assert_equal(">CRA3575282.F\n24 15 23 29 20 13 20 21 21 23 22 25 13 22 17 15 25 27 32 26 \n32 29 29 25\n", @obj.entry)
222
+ end
223
+
224
+ def test_entry_id
225
+ assert_equal('CRA3575282.F', @obj.entry_id)
226
+ end
227
+
228
+ def test_definition
229
+ assert_equal('CRA3575282.F', @obj.definition)
230
+ end
231
+
232
+ def test_data
233
+ data = [24, 15, 23, 29, 20, 13, 20, 21, 21, 23, 22, 25, 13, 22, 17, 15, 25, 27, 32, 26, 32, 29, 29, 25]
234
+ assert_equal(data, @obj.data)
235
+ end
236
+
237
+ def test_length
238
+ assert_equal(24, @obj.length)
239
+ end
240
+
241
+ def test_each
242
+ assert(@obj.each {|x| })
243
+ end
244
+
245
+ def test_arg
246
+ assert(@obj[0], '')
247
+ assert(@obj[-1], '')
248
+ end
249
+
250
+
251
+ end # class TestFastaFormatNumeric
252
+
253
+
254
+ class TestFastaDefinition < Test::Unit::TestCase
255
+
256
+ def setup
257
+ end
258
+
259
+ def test_defline
260
+ end
261
+ end # class TestFastaDefinition
262
+
263
+ end