bio 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. data/ChangeLog +3421 -0
  2. data/KNOWN_ISSUES.rdoc +88 -0
  3. data/README.rdoc +252 -0
  4. data/README_DEV.rdoc +285 -0
  5. data/Rakefile +143 -0
  6. data/bin/bioruby +0 -0
  7. data/bin/br_biofetch.rb +0 -0
  8. data/bin/br_bioflat.rb +12 -1
  9. data/bin/br_biogetseq.rb +0 -0
  10. data/bin/br_pmfetch.rb +4 -3
  11. data/bioruby.gemspec +477 -0
  12. data/bioruby.gemspec.erb +117 -0
  13. data/doc/Changes-0.7.rd +7 -0
  14. data/doc/Changes-1.3.rdoc +239 -0
  15. data/doc/Tutorial.rd +296 -184
  16. data/doc/Tutorial.rd.html +1031 -0
  17. data/doc/Tutorial.rd.ja +111 -45
  18. data/doc/Tutorial.rd.ja.html +2225 -0
  19. data/doc/bioruby.css +281 -0
  20. data/extconf.rb +2 -0
  21. data/lib/bio.rb +29 -4
  22. data/lib/bio/appl/blast.rb +306 -121
  23. data/lib/bio/appl/blast/ddbj.rb +142 -0
  24. data/lib/bio/appl/blast/format0.rb +35 -25
  25. data/lib/bio/appl/blast/format8.rb +2 -2
  26. data/lib/bio/appl/blast/genomenet.rb +263 -0
  27. data/lib/bio/appl/blast/ncbioptions.rb +220 -0
  28. data/lib/bio/appl/blast/remote.rb +106 -0
  29. data/lib/bio/appl/blast/report.rb +260 -9
  30. data/lib/bio/appl/blast/rexml.rb +12 -5
  31. data/lib/bio/appl/blast/rpsblast.rb +277 -0
  32. data/lib/bio/appl/blast/wublast.rb +133 -12
  33. data/lib/bio/appl/blast/xmlparser.rb +35 -18
  34. data/lib/bio/appl/blat/report.rb +46 -5
  35. data/lib/bio/appl/emboss.rb +62 -13
  36. data/lib/bio/appl/fasta.rb +9 -11
  37. data/lib/bio/appl/genscan/report.rb +3 -3
  38. data/lib/bio/appl/hmmer.rb +1 -1
  39. data/lib/bio/appl/hmmer/report.rb +10 -10
  40. data/lib/bio/appl/paml/baseml.rb +95 -0
  41. data/lib/bio/appl/paml/baseml/report.rb +32 -0
  42. data/lib/bio/appl/paml/codeml.rb +242 -0
  43. data/lib/bio/appl/paml/codeml/rates.rb +67 -0
  44. data/lib/bio/appl/paml/codeml/report.rb +67 -0
  45. data/lib/bio/appl/paml/common.rb +348 -0
  46. data/lib/bio/appl/paml/common_report.rb +38 -0
  47. data/lib/bio/appl/paml/yn00.rb +103 -0
  48. data/lib/bio/appl/paml/yn00/report.rb +32 -0
  49. data/lib/bio/appl/psort.rb +2 -2
  50. data/lib/bio/appl/pts1.rb +5 -5
  51. data/lib/bio/appl/tmhmm/report.rb +10 -1
  52. data/lib/bio/command.rb +297 -41
  53. data/lib/bio/compat/features.rb +157 -0
  54. data/lib/bio/compat/references.rb +128 -0
  55. data/lib/bio/db/biosql/biosql_to_biosequence.rb +67 -0
  56. data/lib/bio/db/biosql/sequence.rb +508 -0
  57. data/lib/bio/db/embl/common.rb +28 -12
  58. data/lib/bio/db/embl/embl.rb +107 -9
  59. data/lib/bio/db/embl/embl_to_biosequence.rb +85 -0
  60. data/lib/bio/db/embl/format_embl.rb +190 -0
  61. data/lib/bio/db/embl/sptr.rb +15 -16
  62. data/lib/bio/db/fantom.rb +6 -8
  63. data/lib/bio/db/fasta.rb +10 -507
  64. data/lib/bio/db/fasta/defline.rb +532 -0
  65. data/lib/bio/db/fasta/fasta_to_biosequence.rb +63 -0
  66. data/lib/bio/db/fasta/format_fasta.rb +97 -0
  67. data/lib/bio/db/genbank/common.rb +25 -8
  68. data/lib/bio/db/genbank/format_genbank.rb +187 -0
  69. data/lib/bio/db/genbank/genbank.rb +36 -1
  70. data/lib/bio/db/genbank/genbank_to_biosequence.rb +86 -0
  71. data/lib/bio/db/gff.rb +1791 -119
  72. data/lib/bio/db/kegg/glycan.rb +2 -6
  73. data/lib/bio/db/lasergene.rb +3 -3
  74. data/lib/bio/db/medline.rb +4 -1
  75. data/lib/bio/db/newick.rb +10 -10
  76. data/lib/bio/db/pdb/chain.rb +6 -2
  77. data/lib/bio/db/pdb/pdb.rb +12 -3
  78. data/lib/bio/db/rebase.rb +7 -8
  79. data/lib/bio/db/soft.rb +3 -3
  80. data/lib/bio/feature.rb +1 -88
  81. data/lib/bio/io/biosql/biodatabase.rb +64 -0
  82. data/lib/bio/io/biosql/bioentry.rb +29 -0
  83. data/lib/bio/io/biosql/bioentry_dbxref.rb +11 -0
  84. data/lib/bio/io/biosql/bioentry_path.rb +12 -0
  85. data/lib/bio/io/biosql/bioentry_qualifier_value.rb +10 -0
  86. data/lib/bio/io/biosql/bioentry_reference.rb +10 -0
  87. data/lib/bio/io/biosql/bioentry_relationship.rb +10 -0
  88. data/lib/bio/io/biosql/biosequence.rb +11 -0
  89. data/lib/bio/io/biosql/comment.rb +7 -0
  90. data/lib/bio/io/biosql/config/database.yml +20 -0
  91. data/lib/bio/io/biosql/dbxref.rb +13 -0
  92. data/lib/bio/io/biosql/dbxref_qualifier_value.rb +12 -0
  93. data/lib/bio/io/biosql/location.rb +32 -0
  94. data/lib/bio/io/biosql/location_qualifier_value.rb +11 -0
  95. data/lib/bio/io/biosql/ontology.rb +10 -0
  96. data/lib/bio/io/biosql/reference.rb +9 -0
  97. data/lib/bio/io/biosql/seqfeature.rb +32 -0
  98. data/lib/bio/io/biosql/seqfeature_dbxref.rb +11 -0
  99. data/lib/bio/io/biosql/seqfeature_path.rb +11 -0
  100. data/lib/bio/io/biosql/seqfeature_qualifier_value.rb +20 -0
  101. data/lib/bio/io/biosql/seqfeature_relationship.rb +11 -0
  102. data/lib/bio/io/biosql/taxon.rb +12 -0
  103. data/lib/bio/io/biosql/taxon_name.rb +9 -0
  104. data/lib/bio/io/biosql/term.rb +27 -0
  105. data/lib/bio/io/biosql/term_dbxref.rb +11 -0
  106. data/lib/bio/io/biosql/term_path.rb +12 -0
  107. data/lib/bio/io/biosql/term_relationship.rb +13 -0
  108. data/lib/bio/io/biosql/term_relationship_term.rb +11 -0
  109. data/lib/bio/io/biosql/term_synonym.rb +10 -0
  110. data/lib/bio/io/das.rb +7 -7
  111. data/lib/bio/io/ddbjxml.rb +57 -0
  112. data/lib/bio/io/ensembl.rb +2 -2
  113. data/lib/bio/io/fetch.rb +28 -14
  114. data/lib/bio/io/flatfile.rb +17 -853
  115. data/lib/bio/io/flatfile/autodetection.rb +545 -0
  116. data/lib/bio/io/flatfile/buffer.rb +237 -0
  117. data/lib/bio/io/flatfile/index.rb +17 -7
  118. data/lib/bio/io/flatfile/indexer.rb +30 -12
  119. data/lib/bio/io/flatfile/splitter.rb +297 -0
  120. data/lib/bio/io/hinv.rb +442 -0
  121. data/lib/bio/io/keggapi.rb +2 -2
  122. data/lib/bio/io/ncbirest.rb +733 -0
  123. data/lib/bio/io/pubmed.rb +34 -80
  124. data/lib/bio/io/registry.rb +2 -2
  125. data/lib/bio/io/sql.rb +178 -357
  126. data/lib/bio/io/togows.rb +458 -0
  127. data/lib/bio/location.rb +106 -11
  128. data/lib/bio/pathway.rb +120 -14
  129. data/lib/bio/reference.rb +115 -101
  130. data/lib/bio/sequence.rb +164 -183
  131. data/lib/bio/sequence/adapter.rb +108 -0
  132. data/lib/bio/sequence/common.rb +22 -45
  133. data/lib/bio/sequence/compat.rb +2 -2
  134. data/lib/bio/sequence/dblink.rb +54 -0
  135. data/lib/bio/sequence/format.rb +254 -77
  136. data/lib/bio/sequence/format_raw.rb +23 -0
  137. data/lib/bio/shell.rb +3 -1
  138. data/lib/bio/shell/core.rb +2 -2
  139. data/lib/bio/shell/plugin/entry.rb +33 -4
  140. data/lib/bio/shell/plugin/ncbirest.rb +64 -0
  141. data/lib/bio/shell/plugin/togows.rb +40 -0
  142. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/bioruby_generator.rb +0 -0
  143. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_classes.rhtml +0 -0
  144. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_log.rhtml +0 -0
  145. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_methods.rhtml +0 -0
  146. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_modules.rhtml +0 -0
  147. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/_variables.rhtml +0 -0
  148. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-bg.gif +0 -0
  149. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-gem.png +0 -0
  150. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby-link.gif +0 -0
  151. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.css +0 -0
  152. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby.rhtml +0 -0
  153. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_controller.rb +0 -0
  154. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/bioruby_helper.rb +0 -0
  155. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/commands.rhtml +0 -0
  156. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/history.rhtml +0 -0
  157. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/index.rhtml +0 -0
  158. data/lib/bio/shell/rails/vendor/plugins/{generators → bioruby/generators}/bioruby/templates/spinner.gif +0 -0
  159. data/lib/bio/tree.rb +4 -2
  160. data/lib/bio/util/color_scheme.rb +2 -2
  161. data/lib/bio/util/contingency_table.rb +2 -2
  162. data/lib/bio/util/restriction_enzyme.rb +2 -2
  163. data/lib/bio/util/restriction_enzyme/single_strand.rb +6 -5
  164. data/lib/bio/version.rb +25 -0
  165. data/rdoc.zsh +8 -0
  166. data/sample/any2fasta.rb +0 -0
  167. data/sample/biofetch.rb +0 -0
  168. data/sample/dbget +0 -0
  169. data/sample/demo_sequence.rb +158 -0
  170. data/sample/enzymes.rb +0 -0
  171. data/sample/fasta2tab.rb +0 -0
  172. data/sample/fastagrep.rb +72 -0
  173. data/sample/fastasort.rb +54 -0
  174. data/sample/fsplit.rb +0 -0
  175. data/sample/gb2fasta.rb +2 -3
  176. data/sample/gb2tab.rb +0 -0
  177. data/sample/gbtab2mysql.rb +0 -0
  178. data/sample/genes2nuc.rb +0 -0
  179. data/sample/genes2pep.rb +0 -0
  180. data/sample/genes2tab.rb +0 -0
  181. data/sample/genome2rb.rb +0 -0
  182. data/sample/genome2tab.rb +0 -0
  183. data/sample/goslim.rb +0 -0
  184. data/sample/gt2fasta.rb +0 -0
  185. data/sample/na2aa.rb +34 -0
  186. data/sample/pmfetch.rb +0 -0
  187. data/sample/pmsearch.rb +0 -0
  188. data/sample/ssearch2tab.rb +0 -0
  189. data/sample/tfastx2tab.rb +0 -0
  190. data/sample/vs-genes.rb +0 -0
  191. data/setup.rb +1596 -0
  192. data/test/data/blast/blastp-multi.m7 +188 -0
  193. data/test/data/command/echoarg2.bat +1 -0
  194. data/test/data/paml/codeml/control_file.txt +30 -0
  195. data/test/data/paml/codeml/output.txt +78 -0
  196. data/test/data/paml/codeml/rates +217 -0
  197. data/test/data/rpsblast/misc.rpsblast +193 -0
  198. data/test/data/soft/GDS100_partial.soft +0 -0
  199. data/test/data/soft/GSE3457_family_partial.soft +0 -0
  200. data/test/functional/bio/appl/test_pts1.rb +115 -0
  201. data/test/functional/bio/io/test_ensembl.rb +123 -80
  202. data/test/functional/bio/io/test_togows.rb +267 -0
  203. data/test/functional/bio/sequence/test_output_embl.rb +51 -0
  204. data/test/functional/bio/test_command.rb +301 -0
  205. data/test/runner.rb +17 -1
  206. data/test/unit/bio/appl/blast/test_ncbioptions.rb +112 -0
  207. data/test/unit/bio/appl/blast/test_report.rb +753 -35
  208. data/test/unit/bio/appl/blast/test_rpsblast.rb +398 -0
  209. data/test/unit/bio/appl/paml/codeml/test_rates.rb +45 -0
  210. data/test/unit/bio/appl/paml/codeml/test_report.rb +45 -0
  211. data/test/unit/bio/appl/paml/test_codeml.rb +174 -0
  212. data/test/unit/bio/appl/test_blast.rb +135 -4
  213. data/test/unit/bio/appl/test_fasta.rb +2 -2
  214. data/test/unit/bio/appl/test_pts1.rb +1 -64
  215. data/test/unit/bio/db/embl/test_common.rb +15 -15
  216. data/test/unit/bio/db/embl/test_embl.rb +4 -4
  217. data/test/unit/bio/db/embl/test_embl_rel89.rb +5 -5
  218. data/test/unit/bio/db/embl/test_embl_to_bioseq.rb +203 -0
  219. data/test/unit/bio/db/embl/test_sptr.rb +38 -1
  220. data/test/unit/bio/db/pdb/test_pdb.rb +2 -2
  221. data/test/unit/bio/db/test_gff.rb +1151 -25
  222. data/test/unit/bio/db/test_medline.rb +127 -0
  223. data/test/unit/bio/db/test_nexus.rb +5 -1
  224. data/test/unit/bio/db/test_prosite.rb +4 -4
  225. data/test/unit/bio/io/flatfile/test_autodetection.rb +375 -0
  226. data/test/unit/bio/io/flatfile/test_buffer.rb +251 -0
  227. data/test/unit/bio/io/flatfile/test_splitter.rb +369 -0
  228. data/test/unit/bio/io/test_ddbjxml.rb +8 -3
  229. data/test/unit/bio/io/test_fastacmd.rb +5 -5
  230. data/test/unit/bio/io/test_flatfile.rb +357 -106
  231. data/test/unit/bio/io/test_soapwsdl.rb +2 -2
  232. data/test/unit/bio/io/test_togows.rb +161 -0
  233. data/test/unit/bio/sequence/test_common.rb +210 -11
  234. data/test/unit/bio/sequence/test_compat.rb +3 -3
  235. data/test/unit/bio/sequence/test_dblink.rb +58 -0
  236. data/test/unit/bio/sequence/test_na.rb +2 -2
  237. data/test/unit/bio/test_command.rb +111 -50
  238. data/test/unit/bio/test_feature.rb +29 -1
  239. data/test/unit/bio/test_location.rb +566 -6
  240. data/test/unit/bio/test_pathway.rb +91 -65
  241. data/test/unit/bio/test_reference.rb +67 -13
  242. data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +3 -3
  243. data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +3 -3
  244. data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +3 -3
  245. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +4 -3
  246. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +3 -3
  247. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +3 -3
  248. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +3 -3
  249. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +3 -3
  250. data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +3 -3
  251. data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +3 -3
  252. data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +4 -4
  253. data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +3 -3
  254. data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +3 -3
  255. data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +3 -3
  256. data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +3 -3
  257. data/test/unit/bio/util/test_restriction_enzyme.rb +3 -3
  258. metadata +202 -167
  259. data/test/unit/bio/appl/blast/test_xmlparser.rb +0 -388
@@ -0,0 +1,442 @@
1
+ #
2
+ # = bio/io/hinv.rb - H-invDB web service (REST) client module
3
+ #
4
+ # Copyright:: Copyright (C) 2008 Toshiaki Katayama <k@bioruby.org>
5
+ # License:: The Ruby License
6
+ #
7
+ # $Id:$
8
+ #
9
+
10
+ require 'bio/command'
11
+ require 'rexml/document'
12
+
13
+ module Bio
14
+
15
+ # = Bio::Hinv
16
+ #
17
+ # Accessing the H-invDB web services.
18
+ #
19
+ # * http://www.h-invitational.jp/
20
+ # * http://www.jbirc.aist.go.jp/hinv/hws/doc/index.html
21
+ #
22
+ class Hinv
23
+
24
+ BASE_URI = "http://www.jbirc.aist.go.jp/hinv/hws/"
25
+
26
+ module Common
27
+ def query(options = nil)
28
+ response = Bio::Command.post_form(@url, options)
29
+ @result = response.body
30
+ @xml = REXML::Document.new(@result)
31
+ end
32
+ end
33
+
34
+
35
+ # Bio::Hinv.acc2hit("BC053657") # => "HIT000053961"
36
+ def self.acc2hit(acc)
37
+ serv = Acc2hit.new
38
+ serv.query("acc" => acc)
39
+ serv.result
40
+ end
41
+
42
+ # Bio::Hinv.hit2acc("HIT000022181") # => "AK097327"
43
+ def self.hit2acc(hit)
44
+ serv = Hit2acc.new
45
+ serv.query("hit" => hit)
46
+ serv.result
47
+ end
48
+
49
+ # Bio::Hinv.hit_cnt # => 187156
50
+ def self.hit_cnt
51
+ serv = HitCnt.new
52
+ serv.query
53
+ serv.result
54
+ end
55
+
56
+ # Bio::Hinv.hit_definition("HIT000000001") # => "Rho guanine ..."
57
+ def self.hit_definition(hit)
58
+ serv = HitDefinition.new
59
+ serv.query("hit" => hit)
60
+ serv.result
61
+ end
62
+
63
+ # Bio::Hinv.hit_pubmedid("HIT000053961") # => [7624364, 11279095, ... ]
64
+ def self.hit_pubmedid(hit)
65
+ serv = HitPubmedId.new
66
+ serv.query("hit" => hit)
67
+ serv.result
68
+ end
69
+
70
+ # Bio::Hinv.hit_xml("HIT000000001") # => "<?xml version="1.0" ..."
71
+ def self.hit_xml(hit)
72
+ serv = Bio::Hinv::HitXML.new
73
+ serv.query("hit" => hit)
74
+ puts serv.result
75
+ end
76
+
77
+ # Bio::Hinv.hix2hit("HIX0000004") # => ["HIT000012846", ... ]
78
+ def self.hix2hit(hix)
79
+ serv = Bio::Hinv::Hix2hit.new
80
+ serv.query("hix" => hix)
81
+ serv.result
82
+ end
83
+
84
+ # Bio::Hinv.hix_cnt # => 36073
85
+ def self.hix_cnt
86
+ serv = HixCnt.new
87
+ serv.query
88
+ serv.result
89
+ end
90
+
91
+ # Bio::Hinv.hix_represent("HIX0000001") # => "HIT000022181"
92
+ def self.hix_represent(hix)
93
+ serv = HixRepresent.new
94
+ serv.query("hix" => hix)
95
+ serv.result
96
+ end
97
+
98
+ # Bio::Hinv.id_search("HIT00002218*") # => ["HIT000022181", ... ]
99
+ def self.id_search(query)
100
+ serv = IdSearch.new
101
+ serv.query("query" => query)
102
+ serv.result
103
+ end
104
+
105
+ # Bio::Hinv.keyword_search("HIT00002218*") # => ["HIT000022181", ... ]
106
+ def self.keyword_search(query)
107
+ serv = KeywordSearch.new
108
+ serv.query("query" => query)
109
+ serv.result
110
+ end
111
+
112
+
113
+ # serv = Bio::Hinv::Acc2hit.new
114
+ # serv.query("acc" => "BC053657")
115
+ # puts serv.result
116
+ class Acc2hit
117
+ include Common
118
+
119
+ def initialize
120
+ @url = BASE_URI + "acc2hit.php"
121
+ end
122
+
123
+ # <?xml version='1.0' encoding='UTF-8'?>
124
+ # <H-Inv>
125
+ # <H-INVITATIONAL-ID>HIT000053961</H-INVITATIONAL-ID>
126
+ # </H-Inv>
127
+ def result
128
+ @xml.elements['//H-INVITATIONAL-ID'].text
129
+ end
130
+ end
131
+
132
+ # serv = Bio::Hinv::Hit2acc.new
133
+ # serv.query("hit" => "HIT000022181")
134
+ # puts serv.result
135
+ class Hit2acc
136
+ include Common
137
+
138
+ def initialize
139
+ @url = BASE_URI + "hit2acc.php"
140
+ end
141
+
142
+ # <?xml version='1.0' encoding='UTF-8'?>
143
+ # <H-Inv>
144
+ # <ACCESSION-NO>AK097327</ACCESSION-NO>
145
+ # </H-Inv>
146
+ def result
147
+ @xml.elements['//ACCESSION-NO'].text
148
+ end
149
+ end
150
+
151
+ # serv = Bio::Hinv::HitCnt.new
152
+ # serv.query
153
+ # puts serv.result
154
+ class HitCnt
155
+ include Common
156
+
157
+ def initialize
158
+ @url = BASE_URI + "hit_cnt.php"
159
+ end
160
+
161
+ # <?xml version='1.0' encoding='UTF-8'?>
162
+ # <H-Inv>
163
+ # <TRANSCRIPT_CNT>187156</TRANSCRIPT_CNT>
164
+ # </H-Inv>
165
+ def result
166
+ @xml.elements['//TRANSCRIPT_CNT'].text.to_i
167
+ end
168
+ end
169
+
170
+ # serv = Bio::Hinv::HitDefinition.new
171
+ # serv.query("hit" => "HIT000000001")
172
+ # puts serv.result
173
+ # puts serv.data_source_definition
174
+ # puts serv.cdna_rep_h_invitational
175
+ # puts serv.cdna_splicing_isoform_curation
176
+ # puts serv.data_source_db_reference_protein_motif_id
177
+ # puts serv.data_source_identity
178
+ # puts serv.data_source_coverage
179
+ # puts serv.data_source_homologous_species
180
+ # puts serv.data_source_similarity_category
181
+ class HitDefinition
182
+ include Common
183
+
184
+ def initialize
185
+ @url = BASE_URI + "hit_definition.php"
186
+ end
187
+
188
+ # <?xml version='1.0' encoding='UTF-8'?>
189
+ # <H-Inv>
190
+ # <HIT_FUNCTION>
191
+ # <H-INVITATIONAL-ID>HIT000000001</H-INVITATIONAL-ID>
192
+ # <DATA-SOURCE_DEFINITION>Rho guanine nucleotide exchange factor 10.</DATA-SOURCE_DEFINITION>
193
+ # <CDNA_REP-H-INVITATIONAL>Representative transcript</CDNA_REP-H-INVITATIONAL>
194
+ # <CDNA_SPLICING-ISOFORM_CURATION></CDNA_SPLICING-ISOFORM_CURATION>
195
+ # <DATA-SOURCE_DB-REFERENCE_PROTEIN-MOTIF-ID>NP_055444</DATA-SOURCE_DB-REFERENCE_PROTEIN-MOTIF-ID>
196
+ # <DATA-SOURCE_IDENTITY>100.0</DATA-SOURCE_IDENTITY>
197
+ # <DATA-SOURCE_COVERAGE>100.0</DATA-SOURCE_COVERAGE>
198
+ # <DATA-SOURCE_HOMOLOGOUS_SPECIES>Homo sapiens</DATA-SOURCE_HOMOLOGOUS_SPECIES>
199
+ # <DATA-SOURCE_SIMILARITY-CATEGORY>Identical to known human protein(Category I).</DATA-SOURCE_SIMILARITY-CATEGORY>
200
+ # </HIT_FUNCTION>
201
+ # </H-Inv>
202
+ def result
203
+ @xml.elements['//DATA-SOURCE_DEFINITION'].text
204
+ end
205
+ alias :data_source_definition :result
206
+
207
+ def cdna_rep_h_invitational
208
+ @xml.elements['//CDNA_REP-H-INVITATIONAL'].text
209
+ end
210
+ def cdna_splicing_isoform_curation
211
+ @xml.elements['//CDNA_SPLICING-ISOFORM_CURATION'].text
212
+ end
213
+ def data_source_db_reference_protein_motif_id
214
+ @xml.elements['//DATA-SOURCE_DB-REFERENCE_PROTEIN-MOTIF-ID'].text
215
+ end
216
+ def data_source_identity
217
+ @xml.elements['//DATA-SOURCE_IDENTITY'].text.to_f
218
+ end
219
+ def data_source_coverage
220
+ @xml.elements['//DATA-SOURCE_COVERAGE'].text.to_f
221
+ end
222
+ def data_source_homologous_species
223
+ @xml.elements['//DATA-SOURCE_HOMOLOGOUS_SPECIES'].text
224
+ end
225
+ def data_source_similarity_category
226
+ @xml.elements['//DATA-SOURCE_SIMILARITY-CATEGORY'].text
227
+ end
228
+ end
229
+
230
+ # serv = Bio::Hinv::HitPubmedId.new
231
+ # serv.query("hit" => "HIT000053961")
232
+ # puts serv.result
233
+ class HitPubmedId
234
+ include Common
235
+
236
+ def initialize
237
+ @url = BASE_URI + "hit_pubmedid.php"
238
+ end
239
+
240
+ # <?xml version='1.0' encoding='UTF-8'?>
241
+ # <H-Inv>
242
+ # <CDNA_DB-REFERENCE_PUBMED>7624364</CDNA_DB-REFERENCE_PUBMED>
243
+ # <CDNA_DB-REFERENCE_PUBMED>11279095</CDNA_DB-REFERENCE_PUBMED>
244
+ # <CDNA_DB-REFERENCE_PUBMED>15489334</CDNA_DB-REFERENCE_PUBMED>
245
+ # </H-Inv>
246
+ def result
247
+ list = []
248
+ @xml.elements.each('//CDNA_DB-REFERENCE_PUBMED') do |e|
249
+ list << e.text.to_i
250
+ end
251
+ return list
252
+ end
253
+ end
254
+
255
+ # serv = Bio::Hinv::HitXML.new
256
+ # serv.query("hit" => "HIT000000001")
257
+ # puts serv.result
258
+ class HitXML
259
+ include Common
260
+
261
+ def initialize
262
+ @url = BASE_URI + "hit_xml.php"
263
+ end
264
+
265
+ # <?xml version="1.0" standalone="yes" ?>
266
+ # <H-Inv>
267
+ # <cDNAXML>
268
+ # <CLUSTER-ID>HIX0021591</CLUSTER-ID>
269
+ # <CLUSTER-ID-VERSION>HIX0021591.11</CLUSTER-ID-VERSION>
270
+ # <H-INVITATIONAL-ID>HIT000000001</H-INVITATIONAL-ID>
271
+ # :
272
+ # </PROBE-MAPPING>
273
+ # </EXPRESSION>
274
+ # </cDNAXML>
275
+ # </H-Inv>
276
+ def result
277
+ @result
278
+ end
279
+ end
280
+
281
+ # serv = Bio::Hinv::Hix2hit.new
282
+ # serv.query("hix" => "HIX0000004")
283
+ # puts serv.result
284
+ class Hix2hit
285
+ include Common
286
+
287
+ def initialize
288
+ @url = BASE_URI + "hix2hit.php"
289
+ end
290
+
291
+ # <?xml version='1.0' encoding='UTF-8'?>
292
+ # <H-Inv>
293
+ # <H-INVITATIONAL-ID>HIT000012846</H-INVITATIONAL-ID>
294
+ # <H-INVITATIONAL-ID>HIT000022124</H-INVITATIONAL-ID>
295
+ # <H-INVITATIONAL-ID>HIT000007722</H-INVITATIONAL-ID>
296
+ # :
297
+ # <H-INVITATIONAL-ID>HIT000262478</H-INVITATIONAL-ID>
298
+ # </H-Inv>
299
+ def result
300
+ list = []
301
+ @xml.elements.each('//H-INVITATIONAL-ID') do |e|
302
+ list << e.text
303
+ end
304
+ return list
305
+ end
306
+ end
307
+
308
+ # serv = Bio::Hinv::HixCnt.new
309
+ # serv.query
310
+ # puts serv.result
311
+ class HixCnt
312
+ include Common
313
+
314
+ def initialize
315
+ @url = BASE_URI + "hix_cnt.php"
316
+ end
317
+
318
+ # <?xml version='1.0' encoding='UTF-8'?>
319
+ # <H-Inv>
320
+ # <LOCUS_CNT>36073</LOCUS_CNT>
321
+ # </H-Inv>
322
+ def result
323
+ @xml.elements['//LOCUS_CNT'].text.to_i
324
+ end
325
+ end
326
+
327
+ # serv = Bio::Hinv::HixRepresent.new
328
+ # serv.query("hix" => "HIX0000001")
329
+ # puts serv.result
330
+ # puts serv.rep_h_invitational_id
331
+ # puts serv.rep_accession_no
332
+ class HixRepresent
333
+ include Common
334
+
335
+ def initialize
336
+ @url = BASE_URI + "hix_represent.php"
337
+ end
338
+
339
+ # <?xml version='1.0' encoding='UTF-8'?>
340
+ # <H-Inv>
341
+ # <LOCUS>
342
+ # <CLUSTER-ID>HIX0000001</CLUSTER-ID>
343
+ # <REP-H-INVITATIONAL-ID>HIT000022181</REP-H-INVITATIONAL-ID>
344
+ # <REP-ACCESSION-NO>AK097327</REP-ACCESSION-NO>
345
+ # </LOCUS>
346
+ # </H-Inv>
347
+ def result
348
+ @xml.elements['//REP-H-INVITATIONAL-ID'].text
349
+ end
350
+ alias :rep_h_invitational_id :result
351
+
352
+ def rep_accession_no
353
+ @xml.elements['//REP-ACCESSION-NO'].text
354
+ end
355
+ end
356
+
357
+ # example at "http://www.jbirc.aist.go.jp/hinv/hws/doc/index_jp.html"
358
+ # is for hit_xml.php (not for hix_xml.php)
359
+ class HixXML
360
+ end
361
+
362
+ # serv = Bio::Hinv::KeywordSearch.new
363
+ # serv.query("query" => "HIT00002218*", "start" => 1, "end" => 100)
364
+ # puts serv.result
365
+ # puts serv.size
366
+ # puts serv.start
367
+ # puts serv.end
368
+ class KeywordSearch
369
+ include Common
370
+
371
+ def initialize
372
+ @url = BASE_URI + "keyword_search.php"
373
+ end
374
+
375
+ def query(hash = {})
376
+ default = {
377
+ "start" => 1,
378
+ "end" => 100
379
+ }
380
+ options = default.update(hash)
381
+ super(options)
382
+ end
383
+
384
+ # <?xml version='1.0' encoding='UTF-8'?>
385
+ # <HINVDB_SEARCH>
386
+ # <QUERY>HIT00002218*</QUERY>
387
+ # <SIZE>8</SIZE>
388
+ # <START>1</START>
389
+ # <END>8</END>
390
+ # <H-INVITATIONAL-ID>HIT000022180</H-INVITATIONAL-ID>
391
+ # <H-INVITATIONAL-ID>HIT000022181</H-INVITATIONAL-ID>
392
+ # <H-INVITATIONAL-ID>HIT000022183</H-INVITATIONAL-ID>
393
+ # <H-INVITATIONAL-ID>HIT000022184</H-INVITATIONAL-ID>
394
+ # <H-INVITATIONAL-ID>HIT000022185</H-INVITATIONAL-ID>
395
+ # <H-INVITATIONAL-ID>HIT000022186</H-INVITATIONAL-ID>
396
+ # <H-INVITATIONAL-ID>HIT000022188</H-INVITATIONAL-ID>
397
+ # <H-INVITATIONAL-ID>HIT000022189</H-INVITATIONAL-ID>
398
+ # </HINVDB_SEARCH>
399
+ def result
400
+ list = []
401
+ @xml.elements.each('//H-INVITATIONAL-ID') do |e|
402
+ list << e.text
403
+ end
404
+ return list
405
+ end
406
+
407
+ def size
408
+ @xml.elements['//SIZE'].text.to_i
409
+ end
410
+ def start
411
+ @xml.elements['//START'].text.to_i
412
+ end
413
+ def end
414
+ @xml.elements['//END'].text.to_i
415
+ end
416
+ end
417
+
418
+ # serv = Bio::Hinv::IdSearch.new
419
+ # serv.query("query" => "HIT00002218*", "id_type" => "H-INVITATIONAL-ID", "start" => 1, "end" => 100)
420
+ # puts serv.result
421
+ # puts serv.size
422
+ # puts serv.start
423
+ # puts serv.end
424
+ class IdSearch < KeywordSearch
425
+ def initialize
426
+ @url = BASE_URI + "id_search.php"
427
+ end
428
+
429
+ def query(hash = {})
430
+ default = {
431
+ "id_type" => "H-INVITATIONAL-ID",
432
+ "start" => 1,
433
+ "end" => 100
434
+ }
435
+ options = default.update(hash)
436
+ super(options)
437
+ end
438
+ end
439
+
440
+ end
441
+ end
442
+
@@ -4,7 +4,7 @@
4
4
  # Copyright:: Copyright (C) 2003, 2004 Toshiaki Katayama <k@bioruby.org>
5
5
  # License:: The Ruby License
6
6
  #
7
- # $Id: keggapi.rb,v 1.15 2007/07/20 21:56:45 k Exp $
7
+ # $Id:$
8
8
  #
9
9
 
10
10
  require 'bio/io/soapwsdl'
@@ -269,7 +269,7 @@ class API < Bio::SOAPWSDL
269
269
  filename ||= File.basename(path)
270
270
 
271
271
  http = Bio::Command.new_http(host, port)
272
- response, = http.get(path)
272
+ response = http.get(path)
273
273
  File.open(filename, "w+") do |f|
274
274
  f.print response.body
275
275
  end