bio 1.4.3.0001 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +39 -33
  3. data/BSDL +22 -0
  4. data/COPYING +2 -2
  5. data/COPYING.ja +36 -36
  6. data/ChangeLog +2404 -1025
  7. data/KNOWN_ISSUES.rdoc +15 -55
  8. data/README.rdoc +17 -23
  9. data/RELEASE_NOTES.rdoc +246 -183
  10. data/Rakefile +3 -2
  11. data/bin/br_biofetch.rb +29 -5
  12. data/bioruby.gemspec +15 -32
  13. data/bioruby.gemspec.erb +10 -20
  14. data/doc/ChangeLog-1.4.3 +1478 -0
  15. data/doc/RELEASE_NOTES-1.4.3.rdoc +204 -0
  16. data/doc/Tutorial.rd +0 -6
  17. data/doc/Tutorial.rd.html +7 -12
  18. data/doc/Tutorial.rd.ja +960 -1064
  19. data/doc/Tutorial.rd.ja.html +977 -1067
  20. data/gemfiles/Gemfile.travis-jruby1.8 +2 -1
  21. data/gemfiles/Gemfile.travis-jruby1.9 +2 -4
  22. data/gemfiles/Gemfile.travis-rbx +13 -0
  23. data/gemfiles/Gemfile.travis-ruby1.8 +2 -1
  24. data/gemfiles/Gemfile.travis-ruby1.9 +2 -4
  25. data/gemfiles/Gemfile.travis-ruby2.2 +9 -0
  26. data/lib/bio.rb +10 -43
  27. data/lib/bio/alignment.rb +8 -14
  28. data/lib/bio/appl/blast.rb +1 -2
  29. data/lib/bio/appl/blast/format0.rb +18 -7
  30. data/lib/bio/appl/blast/remote.rb +0 -9
  31. data/lib/bio/appl/blast/report.rb +1 -1
  32. data/lib/bio/appl/clustalw/report.rb +3 -1
  33. data/lib/bio/appl/genscan/report.rb +1 -2
  34. data/lib/bio/appl/iprscan/report.rb +1 -2
  35. data/lib/bio/appl/meme/mast.rb +4 -4
  36. data/lib/bio/appl/meme/mast/report.rb +1 -1
  37. data/lib/bio/appl/paml/codeml.rb +2 -2
  38. data/lib/bio/appl/paml/codeml/report.rb +1 -0
  39. data/lib/bio/appl/paml/common.rb +1 -1
  40. data/lib/bio/appl/sosui/report.rb +1 -2
  41. data/lib/bio/command.rb +62 -2
  42. data/lib/bio/data/aa.rb +13 -31
  43. data/lib/bio/data/codontable.rb +1 -2
  44. data/lib/bio/db/biosql/biosql_to_biosequence.rb +1 -0
  45. data/lib/bio/db/biosql/sequence.rb +1 -1
  46. data/lib/bio/db/embl/common.rb +1 -1
  47. data/lib/bio/db/embl/embl.rb +5 -4
  48. data/lib/bio/db/embl/format_embl.rb +3 -3
  49. data/lib/bio/db/embl/sptr.rb +9 -1444
  50. data/lib/bio/db/embl/swissprot.rb +12 -29
  51. data/lib/bio/db/embl/trembl.rb +13 -30
  52. data/lib/bio/db/embl/uniprot.rb +12 -29
  53. data/lib/bio/db/embl/uniprotkb.rb +1455 -0
  54. data/lib/bio/db/fasta.rb +17 -0
  55. data/lib/bio/db/fasta/defline.rb +1 -3
  56. data/lib/bio/db/fastq.rb +1 -1
  57. data/lib/bio/db/genbank/ddbj.rb +9 -5
  58. data/lib/bio/db/genbank/refseq.rb +11 -3
  59. data/lib/bio/db/gff.rb +3 -4
  60. data/lib/bio/db/go.rb +5 -6
  61. data/lib/bio/db/kegg/module.rb +4 -5
  62. data/lib/bio/db/kegg/pathway.rb +4 -5
  63. data/lib/bio/db/kegg/reaction.rb +1 -1
  64. data/lib/bio/db/nexus.rb +3 -2
  65. data/lib/bio/db/pdb/pdb.rb +2 -2
  66. data/lib/bio/db/phyloxml/phyloxml_elements.rb +82 -59
  67. data/lib/bio/db/phyloxml/phyloxml_parser.rb +2 -2
  68. data/lib/bio/db/phyloxml/phyloxml_writer.rb +1 -2
  69. data/lib/bio/db/sanger_chromatogram/chromatogram.rb +1 -2
  70. data/lib/bio/db/transfac.rb +1 -1
  71. data/lib/bio/io/das.rb +40 -41
  72. data/lib/bio/io/fastacmd.rb +0 -16
  73. data/lib/bio/io/fetch.rb +111 -55
  74. data/lib/bio/io/flatfile/buffer.rb +4 -5
  75. data/lib/bio/io/hinv.rb +2 -3
  76. data/lib/bio/io/ncbirest.rb +43 -6
  77. data/lib/bio/io/pubmed.rb +76 -81
  78. data/lib/bio/io/togows.rb +33 -10
  79. data/lib/bio/map.rb +1 -1
  80. data/lib/bio/pathway.rb +1 -1
  81. data/lib/bio/sequence/compat.rb +1 -1
  82. data/lib/bio/sequence/na.rb +63 -12
  83. data/lib/bio/shell.rb +0 -2
  84. data/lib/bio/shell/core.rb +5 -6
  85. data/lib/bio/shell/interface.rb +3 -4
  86. data/lib/bio/shell/irb.rb +1 -2
  87. data/lib/bio/shell/plugin/entry.rb +2 -3
  88. data/lib/bio/shell/plugin/seq.rb +7 -6
  89. data/lib/bio/shell/setup.rb +1 -2
  90. data/lib/bio/tree.rb +2 -2
  91. data/lib/bio/util/contingency_table.rb +0 -2
  92. data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +2 -2
  93. data/lib/bio/util/sirna.rb +76 -16
  94. data/lib/bio/version.rb +8 -9
  95. data/sample/benchmark_clustalw_report.rb +47 -0
  96. data/sample/biofetch.rb +248 -151
  97. data/setup.rb +6 -7
  98. data/test/data/clustalw/example1-seqnos.aln +58 -0
  99. data/test/network/bio/appl/blast/test_remote.rb +1 -15
  100. data/test/network/bio/appl/test_blast.rb +0 -12
  101. data/test/network/bio/io/test_pubmed.rb +49 -0
  102. data/test/network/bio/io/test_togows.rb +0 -1
  103. data/test/network/bio/test_command.rb +65 -2
  104. data/test/unit/bio/appl/bl2seq/test_report.rb +0 -1
  105. data/test/unit/bio/appl/blast/test_report.rb +110 -48
  106. data/test/unit/bio/appl/clustalw/test_report.rb +67 -51
  107. data/test/unit/bio/appl/sim4/test_report.rb +46 -17
  108. data/test/unit/bio/appl/test_blast.rb +2 -2
  109. data/test/unit/bio/db/embl/test_embl.rb +0 -1
  110. data/test/unit/bio/db/embl/test_embl_rel89.rb +0 -1
  111. data/test/unit/bio/db/embl/{test_sptr.rb → test_uniprotkb.rb} +111 -115
  112. data/test/unit/bio/db/embl/{test_uniprot_new_part.rb → test_uniprotkb_new_part.rb} +11 -11
  113. data/test/unit/bio/db/genbank/test_genbank.rb +10 -4
  114. data/test/unit/bio/db/pdb/test_pdb.rb +14 -8
  115. data/test/unit/bio/db/test_fasta.rb +41 -1
  116. data/test/unit/bio/db/test_fastq.rb +14 -4
  117. data/test/unit/bio/db/test_gff.rb +2 -2
  118. data/test/unit/bio/db/test_phyloxml.rb +30 -30
  119. data/test/unit/bio/db/test_phyloxml_writer.rb +2 -2
  120. data/test/unit/bio/io/flatfile/test_autodetection.rb +1 -2
  121. data/test/unit/bio/io/flatfile/test_buffer.rb +7 -1
  122. data/test/unit/bio/io/flatfile/test_splitter.rb +1 -1
  123. data/test/unit/bio/io/test_togows.rb +3 -2
  124. data/test/unit/bio/sequence/test_dblink.rb +1 -1
  125. data/test/unit/bio/sequence/test_na.rb +3 -1
  126. data/test/unit/bio/test_alignment.rb +1 -2
  127. data/test/unit/bio/test_command.rb +5 -4
  128. data/test/unit/bio/test_db.rb +4 -2
  129. data/test/unit/bio/test_pathway.rb +25 -10
  130. data/test/unit/bio/util/test_sirna.rb +22 -22
  131. metadata +656 -1430
  132. data/doc/KEGG_API.rd +0 -1843
  133. data/doc/KEGG_API.rd.ja +0 -1834
  134. data/extconf.rb +0 -2
  135. data/lib/bio/appl/blast/ddbj.rb +0 -131
  136. data/lib/bio/db/kegg/taxonomy.rb +0 -280
  137. data/lib/bio/io/dbget.rb +0 -194
  138. data/lib/bio/io/ddbjrest.rb +0 -344
  139. data/lib/bio/io/ddbjxml.rb +0 -458
  140. data/lib/bio/io/ebisoap.rb +0 -158
  141. data/lib/bio/io/ensembl.rb +0 -229
  142. data/lib/bio/io/higet.rb +0 -73
  143. data/lib/bio/io/keggapi.rb +0 -363
  144. data/lib/bio/io/ncbisoap.rb +0 -156
  145. data/lib/bio/io/soapwsdl.rb +0 -119
  146. data/lib/bio/shell/plugin/keggapi.rb +0 -181
  147. data/lib/bio/shell/plugin/soap.rb +0 -87
  148. data/sample/dbget +0 -37
  149. data/sample/demo_ddbjxml.rb +0 -212
  150. data/sample/demo_kegg_taxonomy.rb +0 -92
  151. data/sample/demo_keggapi.rb +0 -502
  152. data/sample/psortplot_html.rb +0 -214
  153. data/test/network/bio/io/test_ddbjrest.rb +0 -47
  154. data/test/network/bio/io/test_ensembl.rb +0 -230
  155. data/test/network/bio/io/test_soapwsdl.rb +0 -53
  156. data/test/unit/bio/io/test_ddbjxml.rb +0 -81
  157. data/test/unit/bio/io/test_ensembl.rb +0 -111
  158. data/test/unit/bio/io/test_soapwsdl.rb +0 -33
data/setup.rb CHANGED
@@ -104,7 +104,7 @@ class ConfigTable
104
104
  def remove(name)
105
105
  item = lookup(name)
106
106
  @items.delete_if {|i| i.name == name }
107
- @table.delete_if {|name, i| i.name == name }
107
+ @table.delete_if {|na, i| i.name == na }
108
108
  item
109
109
  end
110
110
 
@@ -189,7 +189,7 @@ class ConfigTable
189
189
  path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')
190
190
  }
191
191
 
192
- if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
192
+ if arg = c['configure_args'].split.detect {|a| /--with-make-prog=/ =~ a }
193
193
  makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
194
194
  else
195
195
  makeprog = 'make'
@@ -281,7 +281,6 @@ class ConfigTable
281
281
  'site-ruby-common' => 'siteruby', # For backward compatibility
282
282
  'site-ruby' => 'siterubyver', # For backward compatibility
283
283
  'bin-dir' => 'bindir',
284
- 'bin-dir' => 'bindir',
285
284
  'rb-dir' => 'rbdir',
286
285
  'so-dir' => 'sodir',
287
286
  'data-dir' => 'datadir',
@@ -779,14 +778,14 @@ class ToplevelInstaller
779
778
  end
780
779
 
781
780
  def ToplevelInstaller.load_rbconfig
782
- if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
781
+ if arg = ARGV.detect {|a| /\A--rbconfig=/ =~ a }
783
782
  ARGV.delete(arg)
784
783
  load File.expand_path(arg.split(/=/, 2)[1])
785
784
  $".push 'rbconfig.rb'
786
785
  else
787
786
  require 'rbconfig'
788
787
  end
789
- ::Config::CONFIG
788
+ ::RbConfig::CONFIG
790
789
  end
791
790
 
792
791
  def initialize(ardir_root, config)
@@ -920,8 +919,8 @@ class ToplevelInstaller
920
919
  end
921
920
  set.push name
922
921
  end
923
- evalopt.each do |name, value|
924
- @config.lookup(name).evaluate value, @config
922
+ evalopt.each do |na, va|
923
+ @config.lookup(na).evaluate va, @config
925
924
  end
926
925
  # Check if configuration is valid
927
926
  set.each do |n|
@@ -0,0 +1,58 @@
1
+ CLUSTAL 2.0.9 multiple sequence alignment
2
+
3
+
4
+ query -MKNTLLKLGVCVSLLGITPFVSTISSVQAERTVEHKVIKNETGTISISQ 49
5
+ gi|115023|sp|P10425| MKKNTLLKVGLCVSLLGTTQFVSTISSVQASQKVEQIVIKNETGTISISQ 50
6
+ gi|115030|sp|P25910| -MKTVFILISMLFPVAVMAQKSVKIS-----------------DDISITQ 32
7
+ gi|2984094 MGGFLFFFLLVLFSFSSEYPKHVKET------------------LRKITD 32
8
+ gi|282554|pir||S25844 -------------------------------------------MTVEVRE 7
9
+ .: :
10
+
11
+ query LNKNVWVHTELGYFSG-EAVPSNGLVLNTSKGLVLVDSSWDDKLTKELIE 98
12
+ gi|115023|sp|P10425| LNKNVWVHTELGYFNG-EAVPSNGLVLNTSKGLVLVDSSWDNKLTKELIE 99
13
+ gi|115030|sp|P25910| LSDKVYTYVSLAEIEGWGMVPSNGMIVINNHQAALLDTPINDAQTEMLVN 82
14
+ gi|2984094 RIYGVFGVYEQVSYEN-RGFISNAYFYVADDGVLVVDALSTYKLGKELIE 81
15
+ gi|282554|pir||S25844 VAEGVYAYEQAP---G-GWCVSNAGIVVGGDGALVVDTLSTIPRARRLAE 53
16
+ *: . . **. . .. ::*: . * :
17
+
18
+ query MVEKKFKKRVTDVIITHAHADRIGGMKTLKERGIKAHSTALTAELAKKNG 148
19
+ gi|115023|sp|P10425| MVEKKFQKRVTDVIITHAHADRIGGITALKERGIKAHSTALTAELAKKSG 149
20
+ gi|115030|sp|P25910| WVTDSLHAKVTTFIPNHWHGDCIGGLGYLQRKGVQSYANQMTIDLAKEKG 132
21
+ gi|2984094 SIRSVTNKPIRFLVVTHYHTDHFYGAKAFREVGAEVIAHEWAFDYISQPS 131
22
+ gi|282554|pir||S25844 WVDKLAAGPGRTVVNTHFHGDHAFGNQVFAP-GTRIIAHEDMRSAMVTTG 102
23
+ : . .: .* * * * : * . : . .
24
+
25
+ query --------------------YEEPLGDLQSVTNLKFGN----MKVETFYP 174
26
+ gi|115023|sp|P10425| --------------------YEEPLGDLQTVTNLKFGN----TKVETFYP 175
27
+ gi|115030|sp|P25910| --------------------LPVPEHGFTDSLTVSLDG----MPLQCYYL 158
28
+ gi|2984094 SYNFFLARKKILKEHLEGTELTPPTITLTKNLNVYLQVGKEYKRFEVLHL 181
29
+ gi|282554|pir||S25844 ----LALTGLWPRVDWGEIELRPPNVTFRDRLTLHVGE----RQVELICV 144
30
+ * : .: . .:
31
+
32
+ query GKGHTEDNIVVWLPQYQILAGGCLVKSASSKDLGNVADAYVNEWSTSIEN 224
33
+ gi|115023|sp|P10425| GKGHTEDNIVVWLPQYQILAGGCLVKSAEAKNLGNVADAYVNEWSTSIEN 225
34
+ gi|115030|sp|P25910| GGGHATDNIVVWLPTENILFGGCMLKDNQATSIGNISDADVTAWPKTLDK 208
35
+ gi|2984094 CRAHTNGDIVVWIPDEKVLFSGDIVFDGRLPFLG---SGNSRTWLVCLDE 228
36
+ gi|282554|pir||S25844 GPAHTDHDVVVWLPEERVLFAGDVVMSGVTPFAL---FGSVAGTLAALDR 191
37
+ .*: ::***:* .:* .* :: . . ::.
38
+
39
+ query VLKRYGNINLVVPGHGEVGDR-----GLLLHTLDLLK------------- 256
40
+ gi|115023|sp|P10425| MLKRYRNINLVVPGHGKVGDK-----GLLLHTLDLLK------------- 257
41
+ gi|115030|sp|P25910| VKAKFPSARYVVPGHGDYGGT-----ELIEHTKQIVNQYIESTSKP---- 249
42
+ gi|2984094 ILKMKPRILLPGHGEALIGEKKIK--EAVSWTRKYIKDLRETIRKLYEEG 276
43
+ gi|282554|pir||S25844 LAELEPEVVVGGHGPVAGPEVIDANRDYLRWVQRLAADAVDRRLTPLQAA 241
44
+ : * : .
45
+
46
+ query --------------------------------------------------
47
+ gi|115023|sp|P10425| --------------------------------------------------
48
+ gi|115030|sp|P25910| --------------------------------------------------
49
+ gi|2984094 --CDVECVRERINEELIKIDPSYAQVPVFF-NVNPVNAYYVYFEIENEIL 323
50
+ gi|282554|pir||S25844 RRADLGAFAGLLDAERLVANLHRAHEELLGGHVRDAMEIFAELVAYNGGQ 291
51
+
52
+
53
+ query ------
54
+ gi|115023|sp|P10425| ------
55
+ gi|115030|sp|P25910| ------
56
+ gi|2984094 MGE--- 326
57
+ gi|282554|pir||S25844 LPTCLA 297
58
+
@@ -1,5 +1,5 @@
1
1
  #
2
- # = test/functional/bio/appl/blast/test_remote.rb - Unit test for Bio::Blast::Remote::Genomenet and Bio::Blast::Remote::DDBJ with network connection
2
+ # = test/functional/bio/appl/blast/test_remote.rb - Unit test for Bio::Blast::Remote::Genomenet with network connection
3
3
  #
4
4
  # Copyright:: Copyright (C) 2011
5
5
  # Naohisa Goto <ng@bioruby.org>
@@ -74,20 +74,6 @@ module FuncTestBlastRemote
74
74
  end
75
75
  end #class NetTestBlastRemoteGenomeNet
76
76
 
77
- # This test class only contains tests for meta information.
78
- # BLAST execution tests are written in ../test_blast.rb
79
- class NetTestBlastRemoteDDBJ < Test::Unit::TestCase
80
-
81
- include NetTestBlastRemoteCommon
82
-
83
- BLASTN_DBNAME_KEYWORDS = [ /ddbj/i, /nt/i ]
84
- BLASTP_DBNAME_KEYWORDS = [ /uniprot/i, /pdb/i ]
85
-
86
- def setup
87
- @klass = Bio::Blast::Remote::DDBJ
88
- end
89
- end #class NetTestBlastRemoteDDBJ
90
-
91
77
  end #module FuncTestBlastRemote
92
78
  end #module Bio
93
79
 
@@ -44,18 +44,6 @@ module FunctTestBlast
44
44
  end
45
45
  end #class NetTestBlast_GenomeNet
46
46
 
47
- class NetTestBlast_DDBJ < Test::Unit::TestCase
48
- include NetTestBlastCommonProteinQuery
49
-
50
- def setup
51
- @blast = Bio::Blast.new('blastp', 'SWISS',
52
- ['-e', '1e-10',
53
- '-v', '10',
54
- '-b', '10' ],
55
- 'ddbj')
56
- end
57
- end #class NetTestBlast_DDBJ
58
-
59
47
  end #module FuncTestBlast
60
48
  end #module Bio
61
49
 
@@ -108,6 +108,55 @@ module Bio
108
108
  assert(str.index(/\<PubmedArticleSet\>/))
109
109
  end
110
110
 
111
+ def test_search
112
+ a = @pm.search('(bioruby OR ruby) AND bioinformatics')
113
+ assert_kind_of(Array, a)
114
+ # Maximum number of results of Bio::PubMed#search is limited to 20.
115
+ assert_equal(20, a.size,
116
+ 'The failure may be caused by changes of NCBI PubMed.')
117
+ a.each do |x|
118
+ assert_kind_of(String, x)
119
+ assert_equal(x.strip, x.to_i.to_s,
120
+ 'PMID is not an integer value. This suggests that NCBI have changed the PMID policy.')
121
+ end
122
+ end
123
+
124
+ def test_query
125
+ pmid = 20739307
126
+ str = @pm.query(pmid)
127
+ assert_kind_of(String, str)
128
+ check_pubmed_entry(pmid, str)
129
+ end
130
+
131
+ def test_query_single_str
132
+ pmid = "20739307"
133
+ str = @pm.query(pmid)
134
+ assert_kind_of(String, str)
135
+ check_pubmed_entry(pmid, str)
136
+ end
137
+
138
+ def test_query_multiple
139
+ arg = [ "16734914", 16381885, "10592173" ]
140
+ str = @pm.query(*arg)
141
+ assert_kind_of(String, str)
142
+ str.split(/\n\n/).each do |s|
143
+ check_pubmed_entry(arg.shift, s)
144
+ end
145
+ end
146
+
147
+ def test_pmfetch
148
+ pmid = 20739307
149
+ str = @pm.pmfetch(pmid)
150
+ assert_kind_of(String, str)
151
+ check_pubmed_entry(pmid, str)
152
+ end
153
+
154
+ def test_pmfetch_str
155
+ pmid = "20739307"
156
+ str = @pm.pmfetch(pmid)
157
+ assert_kind_of(String, str)
158
+ check_pubmed_entry(pmid, str)
159
+ end
111
160
  end #module FuncTestPubmedCommon
112
161
 
113
162
  class FuncTestPubmed < Test::Unit::TestCase
@@ -5,7 +5,6 @@
5
5
  # Naohisa Goto <ng@bioruby.org>
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id:$
9
8
  #
10
9
 
11
10
  # loading helper routine for testing bioruby
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # test/network/bio/test_command.rb - Functional test for network connection methods in Bio::Command
3
3
  #
4
- # Copyright:: Copyright (C) 2008, 2011
4
+ # Copyright:: Copyright (C) 2008, 2011, 2015
5
5
  # Naohisa Goto <ng@bioruby.org>
6
6
  # License:: The Ruby License
7
7
  #
@@ -17,19 +17,82 @@ require 'bio/command'
17
17
 
18
18
  module Bio
19
19
  class FuncTestCommandNet < Test::Unit::TestCase
20
+ def setup
21
+ @host = "bioruby.open-bio.org"
22
+ @port = 80
23
+ @path = "/"
24
+ @url = "http://bioruby.open-bio.org:80/"
25
+ end
26
+
20
27
  def test_read_uri
28
+ str = nil
21
29
  assert_nothing_raised {
22
- Bio::Command.read_uri("http://bioruby.open-bio.org/")
30
+ str = Bio::Command.read_uri(@url)
23
31
  }
32
+ assert(!str.to_s.empty?)
24
33
  end
25
34
 
26
35
  def test_start_http
36
+ ht = Bio::Command.start_http(@host, @port)
37
+ assert_kind_of(Net::HTTP, ht)
38
+ res = ht.get(@path)
39
+ assert_kind_of(Net::HTTPResponse, res)
40
+ end
41
+
42
+ def test_start_http_with_block
43
+ res = Bio::Command.start_http(@host, @port) do |ht|
44
+ assert_kind_of(Net::HTTP, ht)
45
+ ht.get(@path)
46
+ end
47
+ assert_kind_of(Net::HTTPResponse, res)
48
+ end
49
+
50
+ def test_start_http_default_port
51
+ ht = Bio::Command.start_http(@host)
52
+ assert_kind_of(Net::HTTP, ht)
53
+ res = ht.get(@path)
54
+ assert_kind_of(Net::HTTPResponse, res)
27
55
  end
28
56
 
29
57
  def test_new_http
58
+ ht = Bio::Command.new_http(@host, @port)
59
+ assert_kind_of(Net::HTTP, ht)
60
+ res = ht.get(@path)
61
+ assert_kind_of(Net::HTTPResponse, res)
62
+ end
63
+
64
+ def test_new_http_default_port
65
+ ht = Bio::Command.new_http(@host)
66
+ assert_kind_of(Net::HTTP, ht)
67
+ res = ht.get(@path)
68
+ assert_kind_of(Net::HTTPResponse, res)
30
69
  end
31
70
 
32
71
  def test_post_form
72
+ res = Bio::Command.post_form(@url, { 'test' => 'bioruby' })
73
+ assert_kind_of(Net::HTTPResponse, res)
33
74
  end
75
+
76
+ def test_http_post_form
77
+ ht = Bio::Command.new_http(@host)
78
+ res = Bio::Command.http_post_form(ht, @path,
79
+ { 'test' => 'bioruby' },
80
+ { 'Content-Language' => 'en' })
81
+ assert_kind_of(Net::HTTPResponse, res)
82
+ end
83
+
84
+ def test_post
85
+ res = Bio::Command.post(@url, "this is test\n" * 10)
86
+ assert_kind_of(Net::HTTPResponse, res)
87
+ end
88
+
89
+ def test_http_post
90
+ ht = Bio::Command.new_http(@host)
91
+ res = Bio::Command.http_post(ht, @path,
92
+ "this is test\n" * 10,
93
+ { 'Content-Language' => 'en' })
94
+ assert_kind_of(Net::HTTPResponse, res)
95
+ end
96
+
34
97
  end #class FuncTestCommandNet
35
98
  end
@@ -40,7 +40,6 @@ module Bio
40
40
 
41
41
  class TestBl2seqReportConstants < Test::Unit::TestCase
42
42
  def test_rs
43
- rs = nil
44
43
  assert_equal(nil, Bio::Blast::Bl2seq::Report::RS)
45
44
  assert_equal(nil, Bio::Blast::Bl2seq::Report::DELIMITER)
46
45
  end
@@ -62,7 +62,7 @@ module Bio
62
62
  end
63
63
  end #module TestBlastReportHelper
64
64
 
65
- class TestBlastReport < Test::Unit::TestCase
65
+ module TemplateTestBlastReport
66
66
  include TestBlastReportHelper
67
67
 
68
68
  def setup
@@ -90,9 +90,7 @@ module Bio
90
90
  end
91
91
 
92
92
  def test_reference
93
- xml_quoted_str = "~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~&quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs&quot;, Nucleic Acids Res. 25:3389-3402."
94
93
  text_str = '~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~"Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs", Nucleic Acids Res. 25:3389-3402.'
95
- # assert_equal(xml_quoted_str, @report.reference)
96
94
  assert_equal(text_str, @report.reference)
97
95
  end
98
96
 
@@ -203,9 +201,10 @@ module Bio
203
201
  def test_message
204
202
  assert_equal(nil, @report.message)
205
203
  end
206
- end
207
-
208
- class TestBlastReportIteration < Test::Unit::TestCase
204
+ end #module TemplateTestBlastReport
205
+
206
+
207
+ module TemplateTestBlastReportIteration
209
208
  include TestBlastReportHelper
210
209
 
211
210
  def setup
@@ -231,9 +230,10 @@ module Bio
231
230
  def test_message
232
231
  assert_equal(nil, @itr.message)
233
232
  end
234
- end
233
+ end #module TemplateTestBlastReportIteration
235
234
 
236
- class TestBlastReportHit < Test::Unit::TestCase
235
+
236
+ module TemplateTestBlastReportHit
237
237
  include TestBlastReportHelper
238
238
 
239
239
  def setup
@@ -343,9 +343,10 @@ module Bio
343
343
  def test_Hit_lap_at
344
344
  assert_equal([1, 820, 1, 820], @hit.lap_at)
345
345
  end
346
- end
346
+ end #module TemplateTestBlastReportHit
347
347
 
348
- class TestBlastReportHsp < Test::Unit::TestCase
348
+
349
+ module TemplateTestBlastReportHsp
349
350
  include TestBlastReportHelper
350
351
 
351
352
  def setup
@@ -444,37 +445,63 @@ module Bio
444
445
  assert_nothing_raised { @hsp.mismatch_count }
445
446
  end
446
447
 
447
- end
448
+ end #module TestBlastReportHsp
449
+
450
+ class TestBlastReport < Test::Unit::TestCase
451
+ include TemplateTestBlastReport
452
+ end
453
+
454
+ class TestBlastReportIteration < Test::Unit::TestCase
455
+ include TemplateTestBlastReportIteration
456
+ end
448
457
 
449
- class TestBlastReportREXML < TestBlastReport
458
+ class TestBlastReportHit < Test::Unit::TestCase
459
+ include TemplateTestBlastReportHit
450
460
  end
451
461
 
452
- class TestBlastReportIterationREXML < TestBlastReportIteration
462
+ class TestBlastReportHsp < Test::Unit::TestCase
463
+ include TemplateTestBlastReportHsp
453
464
  end
454
465
 
455
- class TestBlastReportHitREXML < TestBlastReportHit
466
+ class TestBlastReportREXML < Test::Unit::TestCase
467
+ include TemplateTestBlastReport
456
468
  end
457
469
 
458
- class TestBlastReportHspREXML < TestBlastReportHsp
470
+ class TestBlastReportIterationREXML < Test::Unit::TestCase
471
+ include TemplateTestBlastReportIteration
472
+ end
473
+
474
+ class TestBlastReportHitREXML < Test::Unit::TestCase
475
+ include TemplateTestBlastReportHit
476
+ end
477
+
478
+ class TestBlastReportHspREXML < Test::Unit::TestCase
479
+ include TemplateTestBlastReportHsp
459
480
  end
460
481
 
461
482
  if defined? XMLParser then
462
483
 
463
- class TestBlastReportXMLParser < TestBlastReport
484
+ class TestBlastReportXMLParser < Test::Unit::TestCase
485
+ include TemplateTestBlastReport
464
486
  end
465
487
 
466
- class TestBlastReportIterationXMLParser < TestBlastReportIteration
488
+ class TestBlastReportIterationXMLParser < Test::Unit::TestCase
489
+ include TemplateTestBlastReportIteration
467
490
  end
468
491
 
469
- class TestBlastReportHitXMLParser < TestBlastReportHit
492
+ class TestBlastReportHitXMLParser < Test::Unit::TestCase
493
+ include TemplateTestBlastReportHit
470
494
  end
471
495
 
472
- class TestBlastReportHspXMLParser < TestBlastReportHsp
496
+ class TestBlastReportHspXMLParser < Test::Unit::TestCase
497
+ include TemplateTestBlastReportHsp
473
498
  end
474
499
 
475
500
  end #if defined? XMLParser
476
501
 
477
- class TestBlastReportDefault < TestBlastReport
502
+ class TestBlastReportDefault < Test::Unit::TestCase
503
+ include TemplateTestBlastReport
504
+
478
505
  undef test_entrez_query
479
506
  undef test_filter
480
507
  undef test_hsp_len
@@ -519,13 +546,16 @@ module Bio
519
546
  def test_gapped_entropy
520
547
  assert_equal(0.140, @report.gapped_entropy)
521
548
  end
522
- end
549
+ end #class TestBlastReportDefault
523
550
 
524
- class TestBlastReportIterationDefault < TestBlastReportIteration
551
+ class TestBlastReportIterationDefault < Test::Unit::TestCase
552
+ include TemplateTestBlastReportIteration
525
553
  undef test_statistics
526
554
  end
527
555
 
528
- class TestBlastReportHitDefault < TestBlastReportHit
556
+ class TestBlastReportHitDefault < Test::Unit::TestCase
557
+ include TemplateTestBlastReportHit
558
+
529
559
  undef test_Hit_accession
530
560
  undef test_Hit_hit_id
531
561
  undef test_Hit_num
@@ -560,9 +590,11 @@ module Bio
560
590
  seq = @filtered_query_sequence.gsub(/x/, 'X')
561
591
  assert_equal(seq, @hit.query_seq)
562
592
  end
563
- end
593
+ end #class TestBlastReportHitDefault
594
+
595
+ class TestBlastReportHspDefault < Test::Unit::TestCase
596
+ include TemplateTestBlastReportHsp
564
597
 
565
- class TestBlastReportHspDefault < TestBlastReportHsp
566
598
  undef test_Hsp_density
567
599
  undef test_Hsp_mismatch_count
568
600
  undef test_Hsp_num
@@ -612,7 +644,8 @@ module Bio
612
644
  # differs from XML because not available in the default BLASTP format
613
645
  assert_equal(nil, @hsp.query_frame)
614
646
  end
615
- end
647
+ end #class TestBlastReportHspDefault
648
+
616
649
 
617
650
  module TestBlastReportTabularHelper
618
651
  def def_test_assert_nil(test_method)
@@ -634,10 +667,11 @@ module Bio
634
667
  assert_nil(instance_variable_get(instance).__send__(method))
635
668
  end
636
669
  end
637
- end #module
670
+ end #module TestBlastReportTabularHelper
638
671
 
639
- class TestBlastReportTabular < TestBlastReport
672
+ class TestBlastReportTabular < Test::Unit::TestCase
640
673
  extend TestBlastReportTabularHelper
674
+ include TemplateTestBlastReport
641
675
 
642
676
  def_test_assert_nil :test_db
643
677
  def_test_assert_nil :test_db_len
@@ -678,7 +712,8 @@ module Bio
678
712
  end
679
713
  end #class TestBlastReportTabular
680
714
 
681
- class TestBlastReportIterationTabular < TestBlastReportIteration
715
+ class TestBlastReportIterationTabular < Test::Unit::TestCase
716
+ include TemplateTestBlastReportIteration
682
717
 
683
718
  # No statistics information available in the "-m 8" format
684
719
  def test_statistics
@@ -686,8 +721,9 @@ module Bio
686
721
  end
687
722
  end #class TestBlastReportIterationTabular
688
723
 
689
- class TestBlastReportHitTabular < TestBlastReportHit
724
+ class TestBlastReportHitTabular < Test::Unit::TestCase
690
725
  extend TestBlastReportTabularHelper
726
+ include TemplateTestBlastReportHit
691
727
 
692
728
  def_test_assert_nil :test_Hit_hit_id
693
729
  def_test_assert_nil :test_Hit_identity
@@ -714,8 +750,9 @@ module Bio
714
750
  end
715
751
  end #class TestBlastReportHitTabular
716
752
 
717
- class TestBlastReportHspTabular < TestBlastReportHsp
753
+ class TestBlastReportHspTabular < Test::Unit::TestCase
718
754
  extend TestBlastReportTabularHelper
755
+ include TemplateTestBlastReportHsp
719
756
 
720
757
  def_test_assert_nil :test_Hsp_density
721
758
  def_test_assert_nil :test_Hsp_hit_frame
@@ -738,7 +775,7 @@ module Bio
738
775
  # with the result of multiple query sequences
739
776
  ########################################################################
740
777
 
741
- class TestBlastReportMulti < Test::Unit::TestCase
778
+ module TemplateTestBlastReportMulti
742
779
  include TestBlastReportHelper
743
780
 
744
781
  def setup
@@ -955,9 +992,9 @@ module Bio
955
992
  assert_equal(nil, r.message)
956
993
  end
957
994
  end
958
- end
959
-
960
- class TestBlastReportIterationMulti < Test::Unit::TestCase
995
+ end #module TemplateTestBlastReportMulti
996
+
997
+ module TemplateTestBlastReportIterationMulti
961
998
  include TestBlastReportHelper
962
999
 
963
1000
  def setup
@@ -1005,9 +1042,9 @@ module Bio
1005
1042
  def test_message
1006
1043
  assert_equal(nil, @itr.message)
1007
1044
  end
1008
- end
1045
+ end #module TemplateTestBlastReportIterationMulti
1009
1046
 
1010
- class TestBlastReportHitMulti < Test::Unit::TestCase
1047
+ module TemplateTestBlastReportHitMulti
1011
1048
  include TestBlastReportHelper
1012
1049
 
1013
1050
  def setup
@@ -1119,9 +1156,9 @@ module Bio
1119
1156
  def test_Hit_lap_at
1120
1157
  assert_equal([190, 311, 569, 668], @hit.lap_at)
1121
1158
  end
1122
- end
1159
+ end #module TemplateTestBlastReportHitMulti
1123
1160
 
1124
- class TestBlastReportHspMulti < Test::Unit::TestCase
1161
+ module TemplateTestBlastReportHspMulti
1125
1162
  include TestBlastReportHelper
1126
1163
 
1127
1164
  def setup
@@ -1220,34 +1257,59 @@ module Bio
1220
1257
  assert_nothing_raised { @hsp.mismatch_count }
1221
1258
  end
1222
1259
 
1223
- end
1260
+ end #module TemplateTestBlastReportHspMulti
1261
+
1262
+
1263
+ class TestBlastReportMulti < Test::Unit::TestCase
1264
+ include TemplateTestBlastReportMulti
1265
+ end
1266
+
1267
+ class TestBlastReportIterationMulti < Test::Unit::TestCase
1268
+ include TemplateTestBlastReportIterationMulti
1269
+ end
1270
+
1271
+ class TestBlastReportHitMulti < Test::Unit::TestCase
1272
+ include TemplateTestBlastReportHitMulti
1273
+ end
1274
+
1275
+ class TestBlastReportHspMulti < Test::Unit::TestCase
1276
+ include TemplateTestBlastReportHspMulti
1277
+ end
1224
1278
 
1225
1279
  # Tests for REXML version
1226
- class TestBlastReportMultiREXML < TestBlastReportMulti
1280
+ class TestBlastReportMultiREXML < Test::Unit::TestCase
1281
+ include TemplateTestBlastReportMulti
1227
1282
  end
1228
1283
 
1229
- class TestBlastReportIterationMultiREXML < TestBlastReportIterationMulti
1284
+ class TestBlastReportIterationMultiREXML < Test::Unit::TestCase
1285
+ include TemplateTestBlastReportIterationMulti
1230
1286
  end
1231
1287
 
1232
- class TestBlastReportHitMultiREXML < TestBlastReportHitMulti
1288
+ class TestBlastReportHitMultiREXML < Test::Unit::TestCase
1289
+ include TemplateTestBlastReportHitMulti
1233
1290
  end
1234
1291
 
1235
- class TestBlastReportHspMultiREXML < TestBlastReportHspMulti
1292
+ class TestBlastReportHspMultiREXML < Test::Unit::TestCase
1293
+ include TemplateTestBlastReportHspMulti
1236
1294
  end
1237
1295
 
1238
1296
  # Tests for XMLParser version
1239
1297
  if defined? XMLParser then
1240
1298
 
1241
- class TestBlastReportMultiXMLParser < TestBlastReportMulti
1299
+ class TestBlastReportMultiXMLParser < Test::Unit::TestCase
1300
+ include TemplateTestBlastReportMulti
1242
1301
  end
1243
1302
 
1244
- class TestBlastReportIterationMultiXMLParser < TestBlastReportIterationMulti
1303
+ class TestBlastReportIterationMultiXMLParser < Test::Unit::TestCase
1304
+ include TemplateTestBlastReportIterationMulti
1245
1305
  end
1246
1306
 
1247
- class TestBlastReportHitMultiXMLParser < TestBlastReportHitMulti
1307
+ class TestBlastReportHitMultiXMLParser < Test::Unit::TestCase
1308
+ include TemplateTestBlastReportHitMulti
1248
1309
  end
1249
1310
 
1250
- class TestBlastReportHspMultiXMLParser < TestBlastReportHspMulti
1311
+ class TestBlastReportHspMultiXMLParser < Test::Unit::TestCase
1312
+ include TemplateTestBlastReportHspMulti
1251
1313
  end
1252
1314
 
1253
1315
  end #if defined? XMLParser