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
@@ -1,344 +0,0 @@
1
- #
2
- # = bio/io/ddbjrest.rb - DDBJ Web API for Biology (WABI) access class via REST
3
- #
4
- # Copyright:: Copyright (C) 2011
5
- # Naohisa Goto <ng@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- # == Description
9
- #
10
- # This file contains Bio::DDBJ::REST, DDBJ Web API for Biology (WABI) access
11
- # classes via REST (Representational State Transfer) protocol.
12
- #
13
- # == References
14
- #
15
- # * http://xml.nig.ac.jp/
16
- #
17
-
18
- require 'bio/command'
19
- require 'bio/db/genbank/ddbj'
20
-
21
- module Bio
22
- class DDBJ
23
-
24
- # == Description
25
- #
26
- # The module Bio::DDBJ::REST is the namespace for the DDBJ Web API for
27
- # Biology (WABI) via REST protocol. Under the Bio::DDBJ::REST,
28
- # following classes are available.
29
- #
30
- # * Bio::DDBJ::REST::DDBJ
31
- # * Bio::DDBJ::REST::Blast
32
- # * Bio::DDBJ::REST::ClustalW
33
- # * Bio::DDBJ::REST::Mafft
34
- # * Bio::DDBJ::REST::RequestManager
35
- #
36
- # Following classes are NOT available, but will be written in the future.
37
- #
38
- # * Bio::DDBJ::REST::GetEntry
39
- # * Bio::DDBJ::REST::ARSA
40
- # * Bio::DDBJ::REST::VecScreen
41
- # * Bio::DDBJ::REST::PhylogeneticTree
42
- # * Bio::DDBJ::REST::Gib
43
- # * Bio::DDBJ::REST::Gtop
44
- # * Bio::DDBJ::REST::GTPS
45
- # * Bio::DDBJ::REST::GIBV
46
- # * Bio::DDBJ::REST::GIBIS
47
- # * Bio::DDBJ::REST::SPS
48
- # * Bio::DDBJ::REST::TxSearch
49
- # * Bio::DDBJ::REST::Ensembl
50
- # * Bio::DDBJ::REST::NCBIGenomeAnnotation
51
- #
52
- # Read the document of each class for details.
53
- #
54
- # In addition, there is a private class Bio::DDBJ::REST::WABItemplate,
55
- # basic class for the above classes. Normal users should not use the
56
- # WABItemplate class directly.
57
- #
58
- module REST
59
-
60
- # Bio::DDBJ::REST::WABItemplate is a private class to provide common
61
- # methods to access DDBJ Web API for Biology (WABI) services by using
62
- # REST protocol.
63
- #
64
- # Normal users should not use the class directly.
65
- #
66
- class WABItemplate
67
-
68
- # hostname for the WABI service
69
- WABI_HOST = 'xml.nig.ac.jp'
70
-
71
- # path for the WABI service
72
- WABI_PATH = '/rest/Invoke'
73
-
74
- private
75
-
76
- # Creates a new object.
77
- def initialize
78
- @http = Bio::Command.new_http(WABI_HOST)
79
- @service = self.class.to_s.split(/\:\:/)[-1]
80
- end
81
-
82
- # (private) query to the service by using POST method
83
- def _wabi_post(method_name, param)
84
- parameters = {
85
- 'service' => @service,
86
- 'method' => method_name
87
- }
88
- parameters.update(param)
89
- #$stderr.puts parameters.inspect
90
- r = Bio::Command.http_post_form(@http, WABI_PATH, parameters)
91
- #$stderr.puts r.inspect
92
- #$stderr.puts "-"*78
93
- #$stderr.puts r.body
94
- #$stderr.puts "-"*78
95
- r.body
96
- end
97
-
98
- def self.define_wabi_method(array,
99
- ruby_method_name = nil,
100
- public_method_name = nil)
101
- wabi_method_name = array[0]
102
- ruby_method_name ||= wabi_method_name
103
- public_method_name ||= wabi_method_name
104
- arg = array[1..-1]
105
- arguments = arg.join(', ')
106
- parameters = "{" +
107
- arg.collect { |x| "#{x.dump} => #{x}" }.join(", ") + "}"
108
- module_eval "def #{ruby_method_name}(#{arguments})
109
- param = #{parameters}
110
- _wabi_post(#{wabi_method_name.dump}, param)
111
- end
112
- def self.#{public_method_name}(#{arguments})
113
- self.new.#{public_method_name}(#{arguments})
114
- end"
115
- self
116
- end
117
- private_class_method :define_wabi_method
118
-
119
- def self.def_wabi(array)
120
- define_wabi_method(array)
121
- end
122
- private_class_method :def_wabi
123
-
124
- def self.def_wabi_custom(array)
125
- ruby_method_name = '_' + array[0]
126
- define_wabi_method(array, ruby_method_name)
127
- module_eval "private :#{ruby_method_name}"
128
- self
129
- end
130
- private_class_method :def_wabi_custom
131
-
132
- def self.def_wabi_async(array)
133
- m = array[0]
134
- def_wabi_custom(array)
135
- module_eval "def #{m}(*arg)
136
- ret = _#{m}(*arg)
137
- if /Your +requestId +is\s*\:\s*(.+)\s*/i =~ ret.to_s then
138
- return $1
139
- else
140
- raise \"unknown return value: \#\{ret.inspect\}\"
141
- end
142
- end"
143
- self
144
- end
145
- private_class_method :def_wabi_async
146
- end #class WABItemplate
147
-
148
- # === Description
149
- #
150
- # DDBJ (DNA DataBank of Japan) entry retrieval functions.
151
- #
152
- # * http://xml.nig.ac.jp/wabi/Method?serviceName=DDBJ&mode=methodList&lang=en
153
- #
154
- # === Examples
155
- #
156
- # see http://xml.nig.ac.jp/wabi/Method?serviceName=DDBJ&mode=methodList&lang=en
157
- #
158
- class DDBJ < WABItemplate
159
-
160
- # Number and ratio of each base such as A,T,G,C.
161
- #
162
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=DDBJ&methodName=countBasePair&mode=methodDetail
163
- # ---
164
- # *Arguments*:
165
- # * (required) _accession_: (String) accession
166
- # *Returns*:: (String) tab-deliminated text
167
- def countBasePair(accession); end if false #dummy
168
- def_wabi %w( countBasePair accession )
169
-
170
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=DDBJ&methodName=get&mode=methodDetail
171
- def get(accessionList, paramList); end if false #dummy
172
- def_wabi %w( get accessionList paramList )
173
-
174
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=DDBJ&methodName=getAllFeatures&mode=methodDetail
175
- def getAllFeatures(accession); end if false #dummy
176
- def_wabi %w( getAllFeatures accession )
177
-
178
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=DDBJ&methodName=getFFEntry&mode=methodDetail
179
- def getFFEntry(accession); end if false #dummy
180
- def_wabi %w( getFFEntry accession )
181
-
182
- # http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=DDBJ&methodName=getRelatedFeatures&mode=methodDetail
183
- def getRelatedFeatures(accession, start, stop); end if false #dummy
184
- def_wabi %w( getRelatedFeatures accession start stop )
185
-
186
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=DDBJ&methodName=getRelatedFeaturesSeq&mode=methodDetail
187
- def getRelatedFeaturesSeq(accession, start, stop); end if false #dummy
188
- def_wabi %w( getRelatedFeaturesSeq accession start stop )
189
- end #class DDBJ
190
-
191
- # === Description
192
- #
193
- # DDBJ (DNA DataBank of Japan) BLAST web service.
194
- # See below for details and examples.
195
- #
196
- # Users normally would want to use searchParamAsync or
197
- # searchParallelAsync with RequestManager.
198
- #
199
- # * http://xml.nig.ac.jp/wabi/Method?serviceName=Blast&mode=methodList&lang=en
200
- class Blast < WABItemplate
201
-
202
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=extractPosition&mode=methodDetail
203
- def extractPosition(result); end if false #dummy
204
- def_wabi %w( extractPosition result )
205
-
206
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=getSupportDatabaseList&mode=methodDetail
207
- def getSupportDatabaseList(); end if false #dummy
208
- def_wabi %w( getSupportDatabaseList )
209
-
210
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=searchParallel&mode=methodDetail
211
- def searchParallel(program, database, query, param); end if false #dummy
212
- def_wabi %w( searchParallel program database query param )
213
-
214
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=searchParallelAsync&mode=methodDetail
215
- def searchParallelAsync(program, database,
216
- query, param); end if false #dummy
217
- def_wabi_async %w( searchParallelAsync program database query param )
218
-
219
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=searchParam&mode=methodDetail
220
- def searchParam(program, database, query, param); end if false #dummy
221
- def_wabi %w( searchParam program database query param )
222
-
223
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=searchParamAsync&mode=methodDetail
224
- def searchParamAsync(program, database,
225
- query, param); end if false #dummy
226
- def_wabi_async %w( searchParamAsync program database query param )
227
-
228
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=searchSimple&mode=methodDetail
229
- def searchSimple(program, database, query); end if false #dummy
230
- def_wabi %w( searchSimple program database query )
231
-
232
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Blast&methodName=searchSimpleAsync&mode=methodDetail
233
- def searchSimpleAsync(program, database, query); end if false #dummy
234
- def_wabi_async %w( searchSimpleAsync program database query )
235
-
236
- end #class Blast
237
-
238
- # === Description
239
- #
240
- # DDBJ (DNA DataBank of Japan) web service of ClustalW multiple sequence
241
- # alignment software.
242
- # See below for details and examples.
243
- #
244
- # * http://xml.nig.ac.jp/wabi/Method?serviceName=ClustalW&mode=methodList&lang=en
245
- class ClustalW < WABItemplate
246
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=ClustalW&methodName=analyzeParam&mode=methodDetail
247
- def analyzeParam(query, param); end if false #dummy
248
- def_wabi %w( analyzeParam query param )
249
-
250
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=ClustalW&methodName=analyzeParamAsync&mode=methodDetail
251
- def analyzeParamAsync(query, param); end if false #dummy
252
- def_wabi_async %w( analyzeParamAsync query param )
253
-
254
- # http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=ClustalW&methodName=analyzeSimple&mode=methodDetail
255
- def analyzeSimple(query); end if false #dummy
256
- def_wabi %w( analyzeSimple query )
257
-
258
- # http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=ClustalW&methodName=analyzeSimpleAsync&mode=methodDetail
259
- def analyzeSimpleAsync(query); end if false #dummy
260
- def_wabi_async %w( analyzeSimpleAsync query )
261
- end #lcass ClustalW
262
-
263
- # === Description
264
- #
265
- # DDBJ (DNA DataBank of Japan) web service of MAFFT multiple sequence
266
- # alignment software.
267
- # See below for details and examples.
268
- #
269
- # * http://xml.nig.ac.jp/wabi/Method?serviceName=Mafft&mode=methodList&lang=en
270
- class Mafft < WABItemplate
271
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Mafft&methodName=analyzeParam&mode=methodDetail
272
- def analyzeParam(query, param); end if false #dummy
273
- def_wabi %w( analyzeParam query param )
274
-
275
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Mafft&methodName=analyzeParamAsync&mode=methodDetail
276
- def analyzeParamAsync(query, param); end if false #dummy
277
- def_wabi_async %w( analyzeParamAsync query param )
278
-
279
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Mafft&methodName=analyzeSimple&mode=methodDetail
280
- def analyzeSimple(query); end if false #dummy
281
- def_wabi %w( analyzeSimple query )
282
-
283
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=Mafft&methodName=analyzeSimpleAsync&mode=methodDetail
284
- def analyzeSimpleAsync(query); end if false #dummy
285
- def_wabi_async %w( analyzeSimpleAsync query )
286
- end #lcass Mafft
287
-
288
-
289
- # === Description
290
- #
291
- # DDBJ (DNA DataBank of Japan) special web service to get result of
292
- # asynchronous web service.
293
- # See below for details and examples.
294
- #
295
- # * http://xml.nig.ac.jp/wabi/Method?serviceName=RequestManager&mode=methodList&lang=en
296
- class RequestManager < WABItemplate
297
-
298
- # see http://xml.nig.ac.jp/wabi/Method?&lang=en&serviceName=RequestManager&methodName=getAsyncResult&mode=methodDetail
299
- def getAsyncResult(requestId); end if false #dummy
300
- def_wabi %w( getAsyncResult requestId )
301
-
302
- # Waits until the query is finished and the result is returnd,
303
- # with calling getAsyncResult.
304
- #
305
- # This is BioRuby original method.
306
- # ---
307
- # *Arguments*:
308
- # * (required) _requestID_: (String) requestId
309
- # *Returns*:: (String) result
310
- def wait_getAsyncResult(requestId)
311
- sleeptime = 2
312
- while true
313
- result = getAsyncResult(requestId)
314
- case result.to_s
315
- when /The search and analysis service by WWW is very busy now/
316
- raise result.to_s.strip + '(Alternatively, wrong options may be given.)'
317
- when /\AYour job has not (?:been )?completed yet/
318
- sleeptime = 2 + rand(4)
319
- when /\AERROR:/
320
- raise result.to_s.strip
321
- else
322
- return result
323
- end #case
324
- if $VERBOSE then
325
- $stderr.puts "DDBJ REST: requestId: #{requestId} -- waitng #{sleeptime} sec."
326
- end
327
- sleep(sleeptime)
328
- end
329
- # will never be reached here
330
- raise "Bug?"
331
- end
332
-
333
- # the same as Bio::DDBJ::REST::RequestManager#wait_getAsyncResult
334
- def self.wait_getAsyncResult(requestId)
335
- self.new.wait_getAsyncResult(requestId)
336
- end
337
-
338
- end #class RequestManager
339
-
340
- end #module REST
341
- end #class DDBJ
342
- end #module Bio
343
-
344
-
@@ -1,458 +0,0 @@
1
- #
2
- # = bio/io/ddbjxml.rb - DDBJ SOAP server access class
3
- #
4
- # Copyright:: Copyright (C) 2003, 2004
5
- # Toshiaki Katayama <k@bioruby.org>
6
- # License:: The Ruby License
7
- #
8
- # $Id:$
9
- #
10
-
11
- require 'bio/io/soapwsdl'
12
- require 'bio/db/genbank/ddbj'
13
-
14
-
15
- module Bio
16
- class DDBJ
17
-
18
-
19
- # = Bio::DDBJ::XML
20
- #
21
- # Accessing the DDBJ web services.
22
- #
23
- # * http://xml.nig.ac.jp/
24
- # * http://xml.nig.ac.jp/wsdl/index.jsp
25
- #
26
- class XML < Bio::SOAPWSDL
27
-
28
- BASE_URI = "http://xml.nig.ac.jp/wsdl/"
29
-
30
- # set default to GetEntry
31
- SERVER_URI = BASE_URI + "GetEntry.wsdl"
32
-
33
- def initialize(wsdl = nil)
34
- super(wsdl || self.class::SERVER_URI)
35
- end
36
-
37
- # === Description
38
- #
39
- # DDBJ XML BLAST Database Search
40
- #
41
- # * http://xml.nig.ac.jp/doc/Blast.txt
42
- #
43
- # === Examples
44
- #
45
- # serv = Bio::DDBJ::XML::Blast.new
46
- # program = 'blastp'
47
- # database = 'SWISS'
48
- # query = "MSSRIARALALVVTLLHLTRLALSTCPAACHCPLEAPKCAPGVGLVRDGCGCCKVCAKQL"
49
- #
50
- # report = serv.searchSimple(program, database, query)
51
- # Bio::Blast::Default::Report.new(report).each_hit do |hit|
52
- # hit.hsps.find_all {|x| x.evalue < 0.1 }.each do |hsp|
53
- # p [hsps.evalue, hsps.identity, hsps.definition]
54
- # end
55
- # end
56
- #
57
- # program = 'tblastn'
58
- # database = 'ddbjvrl'
59
- # param = '-m 8 -e 0.001'
60
- # puts serv.searchParam(program, database, query, param)
61
- #
62
- # === WSDL Methods
63
- #
64
- # * searchSimple(program, database, query)
65
- #
66
- # Returns a blast report in the default format.
67
- #
68
- # * searchParam(program, database, query, param)
69
- #
70
- # Blasts with param and returns a blast report.
71
- #
72
- # === References
73
- #
74
- # * http://xml.nig.ac.jp/doc/Blast.txt
75
- #
76
- class Blast < XML
77
- SERVER_URI = BASE_URI + "Blast.wsdl"
78
- end
79
-
80
-
81
- # === ClustalW
82
- #
83
- # Multiple seaquece alignment using ClustalW.
84
- #
85
- # * http://xml.nig.ac.jp/doc/ClustalW.txt
86
- #
87
- # === Examples
88
- #
89
- # serv = Bio::DDBJ::XML::ClustalW.new
90
- #
91
- # query = <<END
92
- # > RABSTOUT rabbit Guinness receptor
93
- # LKMHLMGHLKMGLKMGLKGMHLMHLKHMHLMTYTYTTYRRWPLWMWLPDFGHAS
94
- # ADSCVCAHGFAVCACFAHFDVCFGAVCFHAVCFAHVCFAAAVCFAVCAC
95
- # > MUSNOSE mouse nose drying factor
96
- # mhkmmhkgmkhmhgmhmhglhmkmhlkmgkhmgkmkytytytryrwtqtqwtwyt
97
- # fdgfdsgafdagfdgfsagdfavdfdvgavfsvfgvdfsvdgvagvfdv
98
- # > HSHEAVEN human Guinness receptor repeat
99
- # mhkmmhkgmkhmhgmhmhg lhmkmhlkmgkhmgkmk ytytytryrwtqtqwtwyt
100
- # fdgfdsgafdagfdgfsag dfavdfdvgavfsvfgv dfsvdgvagvfdv
101
- # mhkmmhkgmkhmhgmhmhg lhmkmhlkmgkhmgkmk ytytytryrwtqtqwtwyt
102
- # fdgfdsgafdagfdgfsag dfavdfdvgavfsvfgv dfsvdgvagvfdv
103
- # END
104
- #
105
- # puts serv.analyzeSimple(query)
106
- # puts serv.analyzeParam(query, '-align -matrix=blosum')
107
- #
108
- # === WSDL Methods
109
- #
110
- # * analyzeSimple(query)
111
- # * analyzeParam(query, param)
112
- #
113
- # === References
114
- #
115
- # * http://xml.nig.ac.jp/doc/ClustalW.txt
116
- #
117
- class ClustalW < XML
118
- SERVER_URI = BASE_URI + "ClustalW.wsdl"
119
- end
120
-
121
-
122
- # == DDBJ
123
- #
124
- # Retrieves a sequence entry from the DDBJ DNA Data Bank Japan.
125
- #
126
- # * http://xml.nig.ac.jp/doc/DDBJ.txt
127
- #
128
- # === Examples
129
- #
130
- # serv = Bio::DDBJ::XML::DDBJ.new
131
- # puts serv.getFFEntry('AB000050')
132
- # puts serv.getXMLEntry('AB000050')
133
- # puts serv.getFeatureInfo('AB000050', 'cds')
134
- # puts serv.getAllFeatures('AB000050')
135
- # puts serv.getRelatedFeatures('AL121903', '59000', '64000')
136
- # puts serv.getRelatedFeaturesSeq('AL121903', '59000', '64000')
137
- #
138
- # === WSDL Methods
139
- #
140
- # * getFFEntry(accession)
141
- # * getXMLEntry(accession)
142
- # * getFeatureInfo(accession, feature)
143
- # * getAllFeatures(accession)
144
- # * getRelatedFeatures(accession, start, stop)
145
- # * getRelatedFeaturesSeq(accession, start, stop)
146
- #
147
- # === References
148
- #
149
- # * http://xml.nig.ac.jp/doc/DDBJ.txt
150
- #
151
- class DDBJ < XML
152
- SERVER_URI = BASE_URI + "DDBJ.wsdl"
153
- end
154
-
155
-
156
- # == Fasta
157
- #
158
- # Searching database using the Fasta package.
159
- #
160
- # * http://xml.nig.ac.jp/doc/Fasta.txt
161
- #
162
- # === Examples
163
- #
164
- # serv = Bio::DDBJ::XML::Fasta.new
165
- # query = ">Test\nMSDGAVQPDG GQPAVRNERA TGSGNGSGGG GGGGSGGVGI"
166
- #
167
- # puts serv.searchSimple('fasta34', 'PDB', query)
168
- # query = ">Test\nAGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"
169
- # puts serv.searchParam('fastx34_t', 'PDB', query, '-n')
170
- #
171
- # === WSDL Methods
172
- #
173
- # * searchSimple(program, database, query)
174
- # * searchParam(program, database, query, param)
175
- #
176
- # === References
177
- #
178
- # * http://xml.nig.ac.jp/doc/Fasta.txt
179
- #
180
- class Fasta < XML
181
- SERVER_URI = BASE_URI + "Fasta.wsdl"
182
- end
183
-
184
-
185
- # == GetEntry
186
- #
187
- # Retrieves database entries.
188
- #
189
- # * http://xml.nig.ac.jp/doc/GetEntry.txt
190
- #
191
- # === Examples
192
- #
193
- # serv = Bio::DDBJ::XML::GetEntry.new
194
- # puts serv.getDDBJEntry('AB000050')
195
- # puts serv. getPDBEntry('1AAR')
196
- #
197
- # === WSDL Methods
198
- #
199
- # * getEntry(database, var, param1, param2)
200
- # * getEntry(database, var)
201
- # * getDDBJEntry(accession)
202
- # * getDDBJCONEntry(accession)
203
- # * getDDBJVerEntry(accession)
204
- # * getLocus_DDBJEntry(locus)
205
- # * getGene_DDBJEntry(gene)
206
- # * getProd_DDBJEntry(products)
207
- # * getPID_DDBJEntry(pid)
208
- # * getClone_DDBJEntry(clone)
209
- # * getXML_DDBJEntry(accession)
210
- # * getEMBLEntry(accession)
211
- # * getSWISSEntry(accession)
212
- # * getPIREntry(accession)
213
- # * getPRFEntry(accession)
214
- # * getPDBEntry(accession)
215
- # * getQVEntry(accession)
216
- # * getDADEntry(accession)
217
- # * getPID_DADEntry(pid)
218
- # * getFASTA_DDBJEntry(accession)
219
- # * getFASTA_DDBJCONEntry(accession)
220
- # * getFASTA_DDBJVerEntry(accession)
221
- # * getFASTA_DDBJSeqEntry(accession, start, end)
222
- # * getFASTA_DADEntry(accession)
223
- # * getFASTA_PIREntry(accession)
224
- # * getFASTA_SWISSEntry(accession)
225
- # * getFASTA_PDBEntry(accession)
226
- # * getFASTA_PRFEntry(accession)
227
- # * getFASTA_CDSEntry(accession)
228
- #
229
- # === References
230
- #
231
- # * http://xml.nig.ac.jp/doc/GetEntry.txt
232
- #
233
- class GetEntry < XML
234
- SERVER_URI = BASE_URI + "GetEntry.wsdl"
235
- end
236
-
237
-
238
- # === Gib
239
- #
240
- # Genome Information broker
241
- #
242
- # * http://xml.nig.ac.jp/doc/Gib.txt
243
- #
244
- # === Examples
245
- #
246
- # serv = Bio::DDBJ::XML::Gib.new
247
- # puts serv.getOrganismList
248
- # puts serv.getChIDList
249
- # puts serv.getOrganismNameFromChid('Sent_CT18:')
250
- # puts serv.getChIDFromOrganismName('Aquifex aeolicus VF5')
251
- # puts serv.getAccession('Ecol_K12_MG1655:')
252
- # puts serv.getPieceNumber('Mgen_G37:')
253
- # puts serv.getDivision('Mgen_G37:')
254
- # puts serv.getType('Mgen_G37:')
255
- # puts serv.getCDS('Aaeo_VF5:ece1')
256
- # puts serv.getFlatFile('Nost_PCC7120:pCC7120zeta')
257
- # puts serv.getFastaFile('Nost_PCC7120:pCC7120zeta', 'cdsaa')
258
- #
259
- # === WSDL Methods
260
- #
261
- # * getOrganismList
262
- # * getChIDList
263
- # * getOrganismNameFromChid(chid)
264
- # * getChIDFromOrganismName(orgName)
265
- # * getAccession(chid)
266
- # * getPieceNumber(chid)
267
- # * getDivision(chid)
268
- # * getType(chid)
269
- # * getFlatFile(chid)
270
- # * getFastaFile(chid, type)
271
- # * getCDS(chid)
272
- #
273
- # === References
274
- #
275
- # * http://xml.nig.ac.jp/doc/Gib.txt
276
- #
277
- class Gib < XML
278
- SERVER_URI = BASE_URI + "Gib.wsdl"
279
- end
280
-
281
-
282
- # === Gtop
283
- #
284
- # GTOP: Gene to protein.
285
- #
286
- # * http://xml.nig.ac.jp/doc/Gtop.txt
287
- #
288
- # === Examples
289
- #
290
- # serv = Bio::DDBJ::XML::Gtop.new
291
- # puts serv.getOrganismList
292
- # puts serv.getMasterInfo('thrA', 'ecol0')
293
- #
294
- # === WSDL Methods
295
- #
296
- # * getOrganismList
297
- # * getMasterInfo(orfID, organism)
298
- #
299
- # === References
300
- #
301
- # * http://xml.nig.ac.jp/doc/Gtop.txt
302
- #
303
- class Gtop < XML
304
- SERVER_URI = BASE_URI + "Gtop.wsdl"
305
- end
306
-
307
-
308
- # === PML
309
- #
310
- # Variation database
311
- #
312
- # * http://xml.nig.ac.jp/doc/PML.txt
313
- #
314
- # === Examples
315
- #
316
- # serv = Bio::DDBJ::XML::PML.new
317
- # puts serv.getVariation('1')
318
- #
319
- # === WSDL Methods
320
- #
321
- # * searchVariation(field, query, order)
322
- # * searchVariationSimple(field, query)
323
- # * searchFrequency(field, query, order)
324
- # * searchFrequencySimple(field, query)
325
- # * getVariation(variation_id)
326
- # * getFrequency(variation_id, population_id)
327
- #
328
- # === References
329
- #
330
- # * http://xml.nig.ac.jp/doc/PML.txt
331
- #
332
- class PML < XML
333
- SERVER_URI = BASE_URI + "PML.wsdl"
334
- end
335
-
336
- # === RequestManager
337
- #
338
- # Sequence Retrieving System
339
- #
340
- # * http://xml.nig.ac.jp/doc/RequestManager.txt
341
- #
342
- # === Examples
343
- #
344
- # serv = Bio::DDBJ::XML::RequestManager.new
345
- # puts serv.getAsyncResult('20070420102828140')
346
- #
347
- # === WSDL Methods
348
- #
349
- # * getAsyncResult( requestId )
350
- # * getAsyncResultMime( requestId )
351
- #
352
- # === Examples
353
- #
354
- # * http://xml.nig.ac.jp/doc/RequestManager.txt
355
- #
356
- class RequestManager < XML
357
- SERVER_URI = BASE_URI + "RequestManager.wsdl"
358
-
359
- # RequestManager using DDBJ REST interface
360
- class REST
361
- require 'bio/command'
362
-
363
- Uri = 'http://xml.nig.ac.jp/rest/Invoke'
364
- Service = 'RequestManager'
365
-
366
- def getAsyncResult(requestId)
367
- params = {
368
- 'service' => Service,
369
- 'method' => 'getAsyncResult',
370
- 'requestId' => requestId.to_s
371
- }
372
- r = Bio::Command.post_form(Uri, params)
373
- r.body
374
- end
375
- end #class REST
376
-
377
- unless defined? new_orig then
378
- class << RequestManager
379
- alias new_orig new
380
- private :new_orig
381
- end
382
- end
383
-
384
- # creates a new driver
385
- def self.new(wsdl = nil)
386
- begin
387
- new_orig(wsdl)
388
- rescue RuntimeError
389
- REST.new
390
- end
391
- end
392
- end #class RequestManager
393
-
394
- # === SRS
395
- #
396
- # Sequence Retrieving System
397
- #
398
- # * http://xml.nig.ac.jp/doc/SRS.txt
399
- #
400
- # === Examples
401
- #
402
- # serv = Bio::DDBJ::XML::SRS.new
403
- # puts serv.searchSimple('[pathway-des:sugar]')
404
- # puts serv.searchParam('[swissprot-des:cohesin]', '-f seq -sf fasta')
405
- #
406
- # === WSDL Methods
407
- #
408
- # * searchSimple(query)
409
- # * searchParam(query, param)
410
- #
411
- # === Examples
412
- #
413
- # * http://xml.nig.ac.jp/doc/SRS.txt
414
- #
415
- class SRS < XML
416
- SERVER_URI = BASE_URI + "SRS.wsdl"
417
- end
418
-
419
-
420
- # === TxSearch
421
- #
422
- # Searching taxonomy information.
423
- #
424
- # * http://xml.nig.ac.jp/doc/TxSearch.txt
425
- #
426
- # === Examples
427
- #
428
- # serv = Bio::DDBJ::XML::TxSearch.new
429
- # puts serv.searchSimple('*coli')
430
- # puts serv.searchSimple('*tardigrada*')
431
- # puts serv.getTxId('Escherichia coli')
432
- # puts serv.getTxName('562')
433
- #
434
- # query = ["Campylobacter coli", "Escherichia coli"].join("\n")
435
- # rank = ["family", "genus"].join("\n")
436
- # puts serv.searchLineage(query, rank, 'Bacteria')
437
- #
438
- # === WSDL Methdos
439
- #
440
- # * searchSimple(tx_Name)
441
- # * searchParam(tx_Name, tx_Clas, tx_Rank, tx_Rmax, tx_Dcls)
442
- # * getTxId(tx_Name)
443
- # * getTxName(tx_Id)
444
- # * searchLineage(query, ranks, superkingdom)
445
- #
446
- # === References
447
- #
448
- # * http://xml.nig.ac.jp/doc/TxSearch.txt
449
- #
450
- class TxSearch < XML
451
- SERVER_URI = BASE_URI + "TxSearch.wsdl"
452
- end
453
-
454
- end # XML
455
-
456
- end # DDBJ
457
- end # Bio
458
-