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,120 @@
1
+ #
2
+ # test/unit/bio/data/test_codontable.rb - Unit test for Bio::CodonTable
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_codontable.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
+
28
+ require 'test/unit'
29
+ require 'bio/data/codontable'
30
+
31
+ module Bio
32
+ class TestCodonTableConstants < Test::Unit::TestCase
33
+ def test_Definitions
34
+ assert(Bio::CodonTable::DEFINITIONS)
35
+ assert(Bio::CodonTable::DEFINITIONS[1], "Standard (Eukaryote)")
36
+ end
37
+
38
+ def test_Starts
39
+ assert(Bio::CodonTable::STARTS)
40
+ assert_equal(['ttg', 'ctg', 'atg', 'gtg'], Bio::CodonTable::STARTS[1])
41
+ end
42
+
43
+ def test_stops
44
+ assert(Bio::CodonTable::STOPS)
45
+ assert_equal(['taa', 'tag', 'tga'], Bio::CodonTable::STOPS[1])
46
+ end
47
+
48
+ def test_Tables
49
+ assert(Bio::CodonTable::TABLES)
50
+ end
51
+ end
52
+
53
+
54
+ class TestCodonTable < Test::Unit::TestCase
55
+
56
+ def setup
57
+ @ct = Bio::CodonTable[1]
58
+ end
59
+
60
+ def test_self_accessor
61
+ assert(Bio::CodonTable[1])
62
+ end
63
+
64
+ def test_self_copy
65
+ assert(Bio::CodonTable.copy(1))
66
+ end
67
+
68
+ def test_table
69
+ assert(@ct.table)
70
+ end
71
+
72
+ def test_definition
73
+ assert_equal("Standard (Eukaryote)", @ct.definition)
74
+ end
75
+
76
+ def test_start
77
+ assert_equal(['ttg', 'ctg', 'atg', 'gtg'], @ct.start)
78
+ end
79
+
80
+ def test_stop
81
+ assert_equal(['taa', 'tag', 'tga'], @ct.stop)
82
+ end
83
+
84
+ def test_accessor #[]
85
+ assert_equal('M', @ct['atg'])
86
+ end
87
+
88
+ def test_set_accessor #[]=
89
+ alternative = 'Y'
90
+ @ct['atg'] = alternative
91
+ assert_equal(alternative, @ct['atg'])
92
+ @ct['atg'] = 'M'
93
+ assert_equal('M', @ct['atg'])
94
+ end
95
+
96
+ def test_each
97
+ assert(@ct.each {|x| })
98
+ end
99
+
100
+ def test_revtrans
101
+ assert_equal(['atg'], @ct.revtrans('M'))
102
+ end
103
+
104
+ def test_start_codon?
105
+ assert_equal(true, @ct.start_codon?('atg'))
106
+ assert_equal(false, @ct.start_codon?('taa'))
107
+ end
108
+
109
+ def test_stop_codon?
110
+ assert_equal(false, @ct.stop_codon?('atg'))
111
+ assert_equal(true, @ct.stop_codon?('taa'))
112
+ end
113
+
114
+
115
+ def test_Tables
116
+ assert_equal(@ct.table, Bio::CodonTable::TABLES[1])
117
+ end
118
+
119
+ end
120
+ end # module Bio
@@ -0,0 +1,89 @@
1
+ #
2
+ # test/unit/bio/data/test_na.rb - Unit test for Bio::NucleicAcid
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_na.rb,v 1.5 2005/11/25 15:59:29 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/data/na'
29
+
30
+ module Bio
31
+
32
+ class TestNAConstants < Test::Unit::TestCase
33
+ def test_NAMES
34
+ assert_equal('a', Bio::NucleicAcid::NAMES['a'])
35
+ end
36
+
37
+ def test_NAMES_1_to_name
38
+ assert_equal('Adenine', Bio::NucleicAcid::NAMES['A'])
39
+ end
40
+
41
+ def test_WEIGHT
42
+ mw = 135.15
43
+ assert_equal(mw, Bio::NucleicAcid::WEIGHT['a'])
44
+ assert_equal(mw, Bio::NucleicAcid::WEIGHT[:adenine])
45
+ end
46
+ end
47
+
48
+
49
+ class TestNA < Test::Unit::TestCase
50
+ def setup
51
+ @obj = Bio::NucleicAcid.new
52
+ end
53
+
54
+ def test_to_re
55
+ re = /[tc][ag][at][gc][tg][ac][tgc][atg][agc][atgc]atgc/
56
+ assert_equal(re, @obj.to_re('yrwskmbdvnatgc'))
57
+ assert_equal(re, Bio::NucleicAcid.to_re('yrwskmbdvnatgc'))
58
+ end
59
+
60
+
61
+ def test_weight
62
+ mw = 135.15
63
+ assert_equal(mw, @obj.weight('a'))
64
+ assert_equal(mw, Bio::NucleicAcid.weight('a'))
65
+ end
66
+
67
+ def test_weight_rna
68
+ mw = 135.15
69
+ assert_equal(mw, @obj.weight('A', true))
70
+ assert_equal(mw, Bio::NucleicAcid.weight('A', true))
71
+ end
72
+
73
+
74
+ def test_accessor
75
+ assert_equal('Adenine', @obj['A'])
76
+ end
77
+
78
+ def test_names
79
+ assert_equal(Bio::NucleicAcid::NAMES, @obj.names)
80
+ end
81
+ def test_na
82
+ assert_equal(Bio::NucleicAcid::NAMES, @obj.na)
83
+ end
84
+
85
+ def test_name
86
+ assert_equal('Adenine', @obj.name('A'))
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,130 @@
1
+ #
2
+ # test/unit/bio/db/embl/common.rb - Unit test for Bio::EMBL::COMMON module
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_common.rb,v 1.2 2005/11/23 10:00:54 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/common'
29
+
30
+
31
+ module Bio
32
+
33
+ # TestClass EMBLDB Inherited
34
+ class EMBL_API < EMBLDB
35
+ include Bio::EMBLDB::Common
36
+ end
37
+
38
+
39
+ class TestEMBLCommon < Test::Unit::TestCase
40
+
41
+ def setup
42
+ @obj = Bio::EMBLDB::Common
43
+ end
44
+
45
+ def test_ac
46
+ assert(@obj.instance_methods.find {|x| x == 'ac' })
47
+ end
48
+
49
+ def test_accessions
50
+ assert(@obj.instance_methods.find {|x| x == 'accessions' })
51
+ end
52
+
53
+ def test_accession
54
+ assert(@obj.instance_methods.find {|x| x == 'accession' })
55
+ end
56
+
57
+ def test_de
58
+ assert(@obj.instance_methods.find {|x| x == 'de' })
59
+ end
60
+
61
+ def test_description
62
+ assert(@obj.instance_methods.find {|x| x == 'description' })
63
+ end
64
+
65
+ def test_definition
66
+ assert(@obj.instance_methods.find {|x| x == 'definition' })
67
+ end
68
+
69
+ def test_os
70
+ assert(@obj.instance_methods.find {|x| x == 'os' })
71
+ end
72
+
73
+ def test_og
74
+ assert(@obj.instance_methods.find {|x| x == 'og' })
75
+ end
76
+
77
+ def test_oc
78
+ assert(@obj.instance_methods.find {|x| x == 'oc' })
79
+ end
80
+
81
+ def test_kw
82
+ assert(@obj.instance_methods.find {|x| x == 'kw' })
83
+ end
84
+
85
+ def test_keywords
86
+ assert(@obj.instance_methods.find {|x| x == 'keywords' })
87
+ end
88
+
89
+ def test_ref
90
+ assert(@obj.instance_methods.find {|x| x == 'ref' })
91
+ end
92
+
93
+ def test_references
94
+ assert(@obj.instance_methods.find {|x| x == 'references' })
95
+ end
96
+
97
+ def test_dr
98
+ assert(@obj.instance_methods.find {|x| x == 'dr' })
99
+ end
100
+ end
101
+
102
+
103
+ class TestEMBLAPI < Test::Unit::TestCase
104
+
105
+ def setup
106
+ data =<<END
107
+ AC A12345; B23456;
108
+ DE Dummy data for Bio::EMBL::Common APIs.
109
+ OS Ruby Class Library for Bioinformatics (BioRuby) (open-bio).
110
+ OC
111
+ OG
112
+ KW
113
+ R
114
+ DR
115
+ END
116
+ @obj = Bio::EMBL_API.new(data)
117
+ end
118
+
119
+ def test_ac
120
+ assert_equal(["A12345", "B23456"], @obj.ac)
121
+ end
122
+
123
+ def test_accessions
124
+ assert_equal(["A12345", "B23456"], @obj.accessions)
125
+ end
126
+
127
+ end
128
+
129
+
130
+ end
@@ -0,0 +1,227 @@
1
+ #
2
+ # test/unit/bio/db/embl/test_embl.rb - Unit test for Bio::EMBL
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_embl.rb,v 1.3 2005/11/23 10:02:42 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
+
28
+ require 'test/unit'
29
+ require 'bio/db/embl/embl'
30
+
31
+ module Bio
32
+ class TestEMBL < Test::Unit::TestCase
33
+
34
+ def setup
35
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
36
+ output = File.open(File.join(bioruby_root, 'test', 'data', 'embl', 'AB090716.embl')).read
37
+ @obj = Bio::EMBL.new(output)
38
+ end
39
+
40
+ def test_id_line
41
+ assert(@obj.id_line)
42
+ end
43
+
44
+ def test_id_line_iterator
45
+ assert(@obj.id_line {|key, value| })
46
+ end
47
+
48
+ def test_id_line_entry_name
49
+ assert_equal('AB090716', @obj.id_line('ENTRY_NAME'))
50
+ end
51
+
52
+ def test_id_line_data_class
53
+ assert_equal('standard', @obj.id_line('DATA_CLASS'))
54
+ end
55
+
56
+ def test_id_line_molecule_type
57
+ assert_equal('genomic DNA', @obj.id_line('MOLECULE_TYPE'))
58
+ end
59
+
60
+ def test_id_line_division
61
+ assert_equal('VRT', @obj.id_line('DIVISION'))
62
+ end
63
+
64
+ def test_id_line_sequence_length
65
+ assert_equal(166, @obj.id_line('SEQUENCE_LENGTH'))
66
+ end
67
+
68
+ def test_entry
69
+ entry_id = 'AB090716'
70
+ assert_equal(entry_id, @obj.entry)
71
+ assert_equal(entry_id, @obj.entry_name)
72
+ assert_equal(entry_id, @obj.entry_id)
73
+ end
74
+
75
+ def test_molecule
76
+ molecule = 'genomic DNA'
77
+ assert_equal(molecule, @obj.molecule)
78
+ assert_equal(molecule, @obj.molecule_type)
79
+ end
80
+
81
+ def test_division
82
+ assert_equal('VRT', @obj.division)
83
+ end
84
+
85
+ def test_sequence_length
86
+ seqlen = 166
87
+ assert_equal(seqlen, @obj.sequence_length)
88
+ assert_equal(seqlen, @obj.seqlen)
89
+ end
90
+
91
+ # Bio::EMBLDB::COMMON#ac
92
+ def test_ac
93
+ ac = ['AB090716']
94
+ assert_equal(ac, @obj.ac)
95
+ assert_equal(ac, @obj.accessions)
96
+ end
97
+
98
+ # Bio::EMBLDB::COMMON#accession
99
+ def test_accession
100
+ assert_equal('AB090716', @obj.accession)
101
+ end
102
+
103
+ def test_sv
104
+ assert_equal('AB090716.1', @obj.sv)
105
+ end
106
+
107
+ def test_version
108
+ assert_equal(1, @obj.version)
109
+ end
110
+
111
+ def test_dt
112
+ assert(@obj.dt)
113
+ end
114
+
115
+ def test_dt_iterator
116
+ assert(@obj.dt {|key, value| })
117
+ end
118
+
119
+ def test_dt_created
120
+ assert_equal('25-OCT-2002 (Rel. 73, Created)', @obj.dt('created'))
121
+ end
122
+
123
+ def test_dt_updated
124
+ assert_equal('29-NOV-2002 (Rel. 73, Last updated, Version 2)', @obj.dt('updated'))
125
+ end
126
+
127
+ # Bio::EMBLDB::COMMON#de
128
+ def test_de
129
+ assert_equal("Haplochromis sp. 'muzu, rukwa' LWS gene for long wavelength-sensitive opsin, partial cds, specimen_voucher:specimen No. HT-9361.", @obj.de)
130
+ end
131
+
132
+ # Bio::EMBLDB::COMMON#kw
133
+ def test_kw
134
+ k = []
135
+ assert_equal([], @obj.kw)
136
+ assert_equal([], @obj.keywords)
137
+ end
138
+
139
+ def test_os
140
+ # assert_equal('', @obj.os)
141
+ assert_raises(RuntimeError) { @obj.os }
142
+ end
143
+
144
+ def test_os_valid
145
+ @obj.instance_eval { @data['OS'] = "Haplochromis sp. 'muzu rukwa'" }
146
+ assert_equal("Haplochromis sp. 'muzu rukwa'", @obj.os)
147
+ end
148
+
149
+ # Bio::EMBLDB::COMMON#oc
150
+ def test_oc
151
+ assert_equal('Eukaryota', @obj.oc.first)
152
+ end
153
+
154
+ # Bio::EMBLDB::COMMON#og
155
+ def test_og
156
+ assert_equal([], @obj.og)
157
+ end
158
+
159
+ # Bio::EMBLDB::COMMON#ref
160
+ def test_ref
161
+ assert_equal(2, @obj.ref.size)
162
+ end
163
+
164
+ # Bio::EMBLDB::COMMON#references
165
+ def test_references
166
+ assert_equal(Bio::References, @obj.references.class)
167
+ end
168
+
169
+ # Bio::EMBLDB::COMMON#dr
170
+ def test_dr
171
+ assert_equal({}, @obj.dr)
172
+ end
173
+
174
+ def test_fh
175
+ assert_equal('Key Location/Qualifiers', @obj.fh)
176
+ end
177
+
178
+ def test_ft
179
+ assert_equal(Bio::Features, @obj.ft.class)
180
+ end
181
+
182
+ def test_ft_iterator
183
+ @obj.ft.each do |feature|
184
+ assert_equal(Bio::Feature, feature.class)
185
+ end
186
+ end
187
+
188
+ def test_ft_accessor
189
+ assert_equal('CDS', @obj.ft.features[1].feature)
190
+ end
191
+
192
+ def test_each_cds
193
+ @obj.each_cds do |x|
194
+ assert_equal('CDS', x.feature)
195
+ end
196
+ end
197
+
198
+ def test_each_gene
199
+ @obj.each_gene do |x|
200
+ assert_equal('gene', x.feature)
201
+ end
202
+ end
203
+
204
+ def test_cc
205
+ assert_equal('', @obj.cc)
206
+ end
207
+
208
+ # def test_xx
209
+ # end
210
+
211
+ def test_sq
212
+ data = {"a"=>29, "c"=>42, "ntlen"=>166, "g"=>41, "t"=>54, "other"=>0}
213
+ assert_equal(data, @obj.sq)
214
+ end
215
+
216
+ def test_sq_get
217
+ assert_equal(29, @obj.sq("a"))
218
+ end
219
+
220
+ def test_seq
221
+ seq = 'gttctggcctcatggactgaagacttcctgtggacctgatgtgttcagtggaagtgaagaccctggagtacagtcctacatgattgttctcatgattacttgctgtttcatccccctggctatcatcatcctgtgctaccttgctgtgtggatggccatccgtgct'
222
+ assert_equal(seq, @obj.seq)
223
+ assert_equal(seq, @obj.naseq)
224
+ assert_equal(seq, @obj.ntseq)
225
+ end
226
+ end
227
+ end