bio 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. data/bin/bioruby +14 -122
  2. data/bin/br_biofetch.rb +2 -2
  3. data/bin/br_bioflat.rb +2 -2
  4. data/bin/br_biogetseq.rb +2 -2
  5. data/bin/br_pmfetch.rb +3 -3
  6. data/doc/Changes-0.7.rd +77 -0
  7. data/doc/KEGG_API.rd +523 -232
  8. data/doc/KEGG_API.rd.ja +529 -207
  9. data/doc/Tutorial.rd +48 -11
  10. data/lib/bio.rb +59 -6
  11. data/lib/bio/alignment.rb +713 -103
  12. data/lib/bio/appl/bl2seq/report.rb +2 -18
  13. data/lib/bio/appl/blast.rb +108 -91
  14. data/lib/bio/appl/blast/format0.rb +33 -18
  15. data/lib/bio/appl/blast/format8.rb +6 -20
  16. data/lib/bio/appl/blast/report.rb +293 -429
  17. data/lib/bio/appl/blast/rexml.rb +8 -22
  18. data/lib/bio/appl/blast/wublast.rb +21 -12
  19. data/lib/bio/appl/blast/xmlparser.rb +180 -183
  20. data/lib/bio/appl/blat/report.rb +127 -30
  21. data/lib/bio/appl/clustalw.rb +87 -59
  22. data/lib/bio/appl/clustalw/report.rb +20 -22
  23. data/lib/bio/appl/emboss.rb +113 -20
  24. data/lib/bio/appl/fasta.rb +173 -198
  25. data/lib/bio/appl/fasta/format10.rb +244 -347
  26. data/lib/bio/appl/gcg/msf.rb +212 -0
  27. data/lib/bio/appl/gcg/seq.rb +195 -0
  28. data/lib/bio/appl/genscan/report.rb +5 -23
  29. data/lib/bio/appl/hmmer.rb +8 -45
  30. data/lib/bio/appl/hmmer/report.rb +2 -20
  31. data/lib/bio/appl/iprscan/report.rb +374 -0
  32. data/lib/bio/appl/mafft.rb +87 -50
  33. data/lib/bio/appl/mafft/report.rb +151 -44
  34. data/lib/bio/appl/muscle.rb +52 -0
  35. data/lib/bio/appl/phylip/alignment.rb +129 -0
  36. data/lib/bio/appl/phylip/distance_matrix.rb +96 -0
  37. data/lib/bio/appl/probcons.rb +41 -0
  38. data/lib/bio/appl/psort.rb +89 -96
  39. data/lib/bio/appl/psort/report.rb +6 -22
  40. data/lib/bio/appl/pts1.rb +263 -0
  41. data/lib/bio/appl/sim4.rb +26 -36
  42. data/lib/bio/appl/sim4/report.rb +2 -18
  43. data/lib/bio/appl/sosui/report.rb +5 -20
  44. data/lib/bio/appl/spidey/report.rb +2 -2
  45. data/lib/bio/appl/targetp/report.rb +4 -20
  46. data/lib/bio/appl/tcoffee.rb +55 -0
  47. data/lib/bio/appl/tmhmm/report.rb +4 -20
  48. data/lib/bio/command.rb +235 -64
  49. data/lib/bio/data/aa.rb +21 -26
  50. data/lib/bio/data/codontable.rb +2 -20
  51. data/lib/bio/data/na.rb +19 -4
  52. data/lib/bio/db.rb +27 -12
  53. data/lib/bio/db/aaindex.rb +2 -20
  54. data/lib/bio/db/embl/common.rb +4 -21
  55. data/lib/bio/db/embl/embl.rb +33 -85
  56. data/lib/bio/db/embl/sptr.rb +612 -302
  57. data/lib/bio/db/embl/swissprot.rb +10 -29
  58. data/lib/bio/db/embl/trembl.rb +10 -29
  59. data/lib/bio/db/embl/uniprot.rb +10 -29
  60. data/lib/bio/db/fantom.rb +15 -20
  61. data/lib/bio/db/fasta.rb +3 -3
  62. data/lib/bio/db/genbank/common.rb +37 -46
  63. data/lib/bio/db/genbank/ddbj.rb +6 -18
  64. data/lib/bio/db/genbank/genbank.rb +47 -186
  65. data/lib/bio/db/genbank/genpept.rb +4 -17
  66. data/lib/bio/db/genbank/refseq.rb +4 -17
  67. data/lib/bio/db/gff.rb +103 -35
  68. data/lib/bio/db/go.rb +4 -20
  69. data/lib/bio/db/kegg/brite.rb +26 -36
  70. data/lib/bio/db/kegg/compound.rb +81 -85
  71. data/lib/bio/db/kegg/drug.rb +98 -0
  72. data/lib/bio/db/kegg/enzyme.rb +133 -110
  73. data/lib/bio/db/kegg/expression.rb +2 -20
  74. data/lib/bio/db/kegg/genes.rb +208 -238
  75. data/lib/bio/db/kegg/genome.rb +164 -285
  76. data/lib/bio/db/kegg/glycan.rb +114 -157
  77. data/lib/bio/db/kegg/keggtab.rb +242 -303
  78. data/lib/bio/db/kegg/kgml.rb +117 -160
  79. data/lib/bio/db/kegg/orthology.rb +112 -0
  80. data/lib/bio/db/kegg/reaction.rb +54 -69
  81. data/lib/bio/db/kegg/taxonomy.rb +331 -0
  82. data/lib/bio/db/lasergene.rb +209 -0
  83. data/lib/bio/db/litdb.rb +3 -27
  84. data/lib/bio/db/medline.rb +228 -249
  85. data/lib/bio/db/nbrf.rb +3 -3
  86. data/lib/bio/db/newick.rb +510 -0
  87. data/lib/bio/db/nexus.rb +1854 -0
  88. data/lib/bio/db/pdb.rb +5 -17
  89. data/lib/bio/db/pdb/atom.rb +2 -18
  90. data/lib/bio/db/pdb/chain.rb +2 -18
  91. data/lib/bio/db/pdb/chemicalcomponent.rb +2 -18
  92. data/lib/bio/db/pdb/model.rb +2 -18
  93. data/lib/bio/db/pdb/pdb.rb +73 -34
  94. data/lib/bio/db/pdb/residue.rb +4 -20
  95. data/lib/bio/db/pdb/utils.rb +2 -18
  96. data/lib/bio/db/prosite.rb +403 -422
  97. data/lib/bio/db/rebase.rb +84 -40
  98. data/lib/bio/db/soft.rb +404 -0
  99. data/lib/bio/db/transfac.rb +5 -17
  100. data/lib/bio/feature.rb +106 -52
  101. data/lib/bio/io/das.rb +32 -42
  102. data/lib/bio/io/dbget.rb +2 -20
  103. data/lib/bio/io/ddbjxml.rb +77 -138
  104. data/lib/bio/io/ebisoap.rb +158 -0
  105. data/lib/bio/io/ensembl.rb +229 -0
  106. data/lib/bio/io/fastacmd.rb +89 -82
  107. data/lib/bio/io/fetch.rb +163 -96
  108. data/lib/bio/io/flatfile.rb +170 -73
  109. data/lib/bio/io/flatfile/bdb.rb +3 -16
  110. data/lib/bio/io/flatfile/index.rb +2 -2
  111. data/lib/bio/io/flatfile/indexer.rb +3 -2
  112. data/lib/bio/io/higet.rb +12 -31
  113. data/lib/bio/io/keggapi.rb +210 -269
  114. data/lib/bio/io/ncbisoap.rb +155 -0
  115. data/lib/bio/io/pubmed.rb +169 -147
  116. data/lib/bio/io/registry.rb +4 -20
  117. data/lib/bio/io/soapwsdl.rb +43 -38
  118. data/lib/bio/io/sql.rb +242 -305
  119. data/lib/bio/location.rb +407 -285
  120. data/lib/bio/map.rb +410 -0
  121. data/lib/bio/pathway.rb +558 -695
  122. data/lib/bio/reference.rb +272 -75
  123. data/lib/bio/sequence.rb +255 -13
  124. data/lib/bio/sequence/aa.rb +71 -10
  125. data/lib/bio/sequence/common.rb +187 -33
  126. data/lib/bio/sequence/compat.rb +59 -4
  127. data/lib/bio/sequence/format.rb +54 -7
  128. data/lib/bio/sequence/generic.rb +3 -3
  129. data/lib/bio/sequence/na.rb +328 -26
  130. data/lib/bio/shell.rb +11 -4
  131. data/lib/bio/shell/core.rb +221 -160
  132. data/lib/bio/shell/demo.rb +18 -15
  133. data/lib/bio/shell/interface.rb +14 -12
  134. data/lib/bio/shell/irb.rb +95 -0
  135. data/lib/bio/shell/object.rb +45 -26
  136. data/lib/bio/shell/plugin/blast.rb +42 -0
  137. data/lib/bio/shell/plugin/codon.rb +22 -14
  138. data/lib/bio/shell/plugin/das.rb +58 -0
  139. data/lib/bio/shell/plugin/emboss.rb +2 -2
  140. data/lib/bio/shell/plugin/entry.rb +22 -11
  141. data/lib/bio/shell/plugin/flatfile.rb +2 -2
  142. data/lib/bio/shell/plugin/keggapi.rb +13 -6
  143. data/lib/bio/shell/plugin/midi.rb +4 -4
  144. data/lib/bio/shell/plugin/obda.rb +2 -2
  145. data/lib/bio/shell/plugin/psort.rb +56 -0
  146. data/lib/bio/shell/plugin/seq.rb +35 -8
  147. data/lib/bio/shell/plugin/soap.rb +87 -0
  148. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/bioruby_generator.rb +29 -0
  149. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_classes.rhtml +4 -0
  150. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_log.rhtml +27 -0
  151. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_methods.rhtml +11 -0
  152. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_modules.rhtml +4 -0
  153. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/_variables.rhtml +7 -0
  154. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-bg.gif +0 -0
  155. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-console.png +0 -0
  156. data/lib/bio/shell/rails/{public/images/icon.png → vendor/plugins/generators/bioruby/templates/bioruby-gem.png} +0 -0
  157. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby-link.gif +0 -0
  158. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.css +369 -0
  159. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby.rhtml +47 -0
  160. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_controller.rb +144 -0
  161. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/bioruby_helper.rb +47 -0
  162. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/commands.rhtml +8 -0
  163. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/history.rhtml +10 -0
  164. data/lib/bio/shell/rails/vendor/plugins/generators/bioruby/templates/index.rhtml +22 -0
  165. data/lib/bio/shell/script.rb +25 -0
  166. data/lib/bio/shell/setup.rb +109 -0
  167. data/lib/bio/shell/web.rb +70 -58
  168. data/lib/bio/tree.rb +850 -0
  169. data/lib/bio/util/color_scheme.rb +84 -107
  170. data/lib/bio/util/color_scheme/buried.rb +5 -24
  171. data/lib/bio/util/color_scheme/helix.rb +5 -24
  172. data/lib/bio/util/color_scheme/hydropathy.rb +5 -24
  173. data/lib/bio/util/color_scheme/nucleotide.rb +5 -24
  174. data/lib/bio/util/color_scheme/strand.rb +5 -24
  175. data/lib/bio/util/color_scheme/taylor.rb +5 -24
  176. data/lib/bio/util/color_scheme/turn.rb +5 -24
  177. data/lib/bio/util/color_scheme/zappo.rb +5 -24
  178. data/lib/bio/util/contingency_table.rb +70 -43
  179. data/lib/bio/util/restriction_enzyme.rb +228 -0
  180. data/lib/bio/util/restriction_enzyme/analysis.rb +249 -0
  181. data/lib/bio/util/restriction_enzyme/analysis_basic.rb +217 -0
  182. data/lib/bio/util/restriction_enzyme/cut_symbol.rb +107 -0
  183. data/lib/bio/util/restriction_enzyme/double_stranded.rb +321 -0
  184. data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +130 -0
  185. data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +103 -0
  186. data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +38 -0
  187. data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +76 -0
  188. data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +107 -0
  189. data/lib/bio/util/restriction_enzyme/enzymes.yaml +7061 -0
  190. data/lib/bio/util/restriction_enzyme/range/cut_range.rb +24 -0
  191. data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +47 -0
  192. data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +67 -0
  193. data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +257 -0
  194. data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +242 -0
  195. data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +51 -0
  196. data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +41 -0
  197. data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +77 -0
  198. data/lib/bio/util/restriction_enzyme/single_strand.rb +199 -0
  199. data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +135 -0
  200. data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +23 -0
  201. data/lib/bio/util/restriction_enzyme/string_formatting.rb +111 -0
  202. data/lib/bio/util/sirna.rb +4 -22
  203. data/sample/color_scheme_na.rb +4 -12
  204. data/sample/enzymes.rb +78 -0
  205. data/sample/goslim.rb +5 -13
  206. data/sample/psortplot_html.rb +4 -12
  207. data/test/data/blast/2.2.15.blastp.m7 +876 -0
  208. data/test/data/embl/AB090716.embl.rel89 +63 -0
  209. data/test/data/fasta/example1.txt +75 -0
  210. data/test/data/fasta/example2.txt +21 -0
  211. data/test/data/iprscan/merged.raw +32 -0
  212. data/test/data/iprscan/merged.txt +74 -0
  213. data/test/data/soft/GDS100_partial.soft +92 -0
  214. data/test/data/soft/GSE3457_family_partial.soft +874 -0
  215. data/test/functional/bio/io/test_ensembl.rb +103 -0
  216. data/test/functional/bio/io/test_soapwsdl.rb +5 -17
  217. data/test/unit/bio/appl/bl2seq/test_report.rb +2 -2
  218. data/test/unit/bio/appl/blast/test_report.rb +3 -16
  219. data/test/unit/bio/appl/blast/test_xmlparser.rb +4 -16
  220. data/test/unit/bio/appl/genscan/test_report.rb +3 -16
  221. data/test/unit/bio/appl/hmmer/test_report.rb +3 -16
  222. data/test/unit/bio/appl/iprscan/test_report.rb +338 -0
  223. data/test/unit/bio/appl/mafft/test_report.rb +63 -0
  224. data/test/unit/bio/appl/sosui/test_report.rb +3 -16
  225. data/test/unit/bio/appl/targetp/test_report.rb +3 -16
  226. data/test/unit/bio/appl/test_blast.rb +3 -16
  227. data/test/unit/bio/appl/test_fasta.rb +4 -16
  228. data/test/unit/bio/appl/test_pts1.rb +140 -0
  229. data/test/unit/bio/appl/tmhmm/test_report.rb +3 -16
  230. data/test/unit/bio/data/test_aa.rb +4 -17
  231. data/test/unit/bio/data/test_codontable.rb +3 -16
  232. data/test/unit/bio/data/test_na.rb +3 -3
  233. data/test/unit/bio/db/embl/test_common.rb +3 -16
  234. data/test/unit/bio/db/embl/test_embl.rb +3 -16
  235. data/test/unit/bio/db/embl/test_embl_rel89.rb +219 -0
  236. data/test/unit/bio/db/embl/test_sptr.rb +1548 -41
  237. data/test/unit/bio/db/embl/test_uniprot.rb +3 -16
  238. data/test/unit/bio/db/kegg/test_genes.rb +3 -16
  239. data/test/unit/bio/db/pdb/test_pdb.rb +7 -24
  240. data/test/unit/bio/db/test_aaindex.rb +2 -2
  241. data/test/unit/bio/db/test_fasta.rb +3 -16
  242. data/test/unit/bio/db/test_gff.rb +3 -16
  243. data/test/unit/bio/db/test_lasergene.rb +95 -0
  244. data/test/unit/bio/db/test_newick.rb +56 -0
  245. data/test/unit/bio/db/test_nexus.rb +360 -0
  246. data/test/unit/bio/db/test_prosite.rb +5 -18
  247. data/test/unit/bio/db/test_rebase.rb +11 -25
  248. data/test/unit/bio/db/test_soft.rb +138 -0
  249. data/test/unit/bio/io/test_ddbjxml.rb +5 -17
  250. data/test/unit/bio/io/test_ensembl.rb +109 -0
  251. data/test/unit/bio/io/test_fastacmd.rb +3 -16
  252. data/test/unit/bio/io/test_flatfile.rb +237 -0
  253. data/test/unit/bio/io/test_soapwsdl.rb +4 -17
  254. data/test/unit/bio/sequence/test_aa.rb +3 -3
  255. data/test/unit/bio/sequence/test_common.rb +3 -16
  256. data/test/unit/bio/sequence/test_compat.rb +3 -16
  257. data/test/unit/bio/sequence/test_na.rb +29 -3
  258. data/test/unit/bio/shell/plugin/test_seq.rb +8 -8
  259. data/test/unit/bio/test_alignment.rb +16 -27
  260. data/test/unit/bio/test_command.rb +242 -25
  261. data/test/unit/bio/test_db.rb +3 -16
  262. data/test/unit/bio/test_feature.rb +4 -16
  263. data/test/unit/bio/test_location.rb +4 -16
  264. data/test/unit/bio/test_map.rb +230 -0
  265. data/test/unit/bio/test_pathway.rb +4 -16
  266. data/test/unit/bio/test_reference.rb +2 -2
  267. data/test/unit/bio/test_sequence.rb +7 -19
  268. data/test/unit/bio/test_shell.rb +3 -16
  269. data/test/unit/bio/test_tree.rb +593 -0
  270. data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +299 -0
  271. data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +103 -0
  272. data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +240 -0
  273. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +100 -0
  274. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +75 -0
  275. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +73 -0
  276. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +53 -0
  277. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +104 -0
  278. data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +83 -0
  279. data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +246 -0
  280. data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +44 -0
  281. data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +115 -0
  282. data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +147 -0
  283. data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +147 -0
  284. data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +60 -0
  285. data/test/unit/bio/util/test_color_scheme.rb +6 -18
  286. data/test/unit/bio/util/test_contingency_table.rb +6 -18
  287. data/test/unit/bio/util/test_restriction_enzyme.rb +42 -0
  288. data/test/unit/bio/util/test_sirna.rb +3 -16
  289. metadata +228 -169
  290. data/doc/BioRuby.rd.ja +0 -225
  291. data/doc/Design.rd.ja +0 -341
  292. data/doc/TODO.rd.ja +0 -138
  293. data/lib/bio/appl/fasta/format6.rb +0 -37
  294. data/lib/bio/db/kegg/cell.rb +0 -88
  295. data/lib/bio/db/kegg/ko.rb +0 -178
  296. data/lib/bio/shell/rails/Rakefile +0 -10
  297. data/lib/bio/shell/rails/app/controllers/application.rb +0 -4
  298. data/lib/bio/shell/rails/app/controllers/shell_controller.rb +0 -94
  299. data/lib/bio/shell/rails/app/helpers/application_helper.rb +0 -3
  300. data/lib/bio/shell/rails/app/models/shell_connection.rb +0 -30
  301. data/lib/bio/shell/rails/app/views/layouts/shell.rhtml +0 -37
  302. data/lib/bio/shell/rails/app/views/shell/history.rhtml +0 -5
  303. data/lib/bio/shell/rails/app/views/shell/index.rhtml +0 -2
  304. data/lib/bio/shell/rails/app/views/shell/show.rhtml +0 -13
  305. data/lib/bio/shell/rails/config/boot.rb +0 -19
  306. data/lib/bio/shell/rails/config/database.yml +0 -85
  307. data/lib/bio/shell/rails/config/environment.rb +0 -53
  308. data/lib/bio/shell/rails/config/environments/development.rb +0 -19
  309. data/lib/bio/shell/rails/config/environments/production.rb +0 -19
  310. data/lib/bio/shell/rails/config/environments/test.rb +0 -19
  311. data/lib/bio/shell/rails/config/routes.rb +0 -19
  312. data/lib/bio/shell/rails/doc/README_FOR_APP +0 -2
  313. data/lib/bio/shell/rails/public/404.html +0 -8
  314. data/lib/bio/shell/rails/public/500.html +0 -8
  315. data/lib/bio/shell/rails/public/dispatch.cgi +0 -10
  316. data/lib/bio/shell/rails/public/dispatch.fcgi +0 -24
  317. data/lib/bio/shell/rails/public/dispatch.rb +0 -10
  318. data/lib/bio/shell/rails/public/favicon.ico +0 -0
  319. data/lib/bio/shell/rails/public/images/rails.png +0 -0
  320. data/lib/bio/shell/rails/public/index.html +0 -277
  321. data/lib/bio/shell/rails/public/javascripts/controls.js +0 -750
  322. data/lib/bio/shell/rails/public/javascripts/dragdrop.js +0 -584
  323. data/lib/bio/shell/rails/public/javascripts/effects.js +0 -854
  324. data/lib/bio/shell/rails/public/javascripts/prototype.js +0 -1785
  325. data/lib/bio/shell/rails/public/robots.txt +0 -1
  326. data/lib/bio/shell/rails/public/stylesheets/main.css +0 -187
  327. data/lib/bio/shell/rails/script/about +0 -3
  328. data/lib/bio/shell/rails/script/breakpointer +0 -3
  329. data/lib/bio/shell/rails/script/console +0 -3
  330. data/lib/bio/shell/rails/script/destroy +0 -3
  331. data/lib/bio/shell/rails/script/generate +0 -3
  332. data/lib/bio/shell/rails/script/performance/benchmarker +0 -3
  333. data/lib/bio/shell/rails/script/performance/profiler +0 -3
  334. data/lib/bio/shell/rails/script/plugin +0 -3
  335. data/lib/bio/shell/rails/script/process/reaper +0 -3
  336. data/lib/bio/shell/rails/script/process/spawner +0 -3
  337. data/lib/bio/shell/rails/script/process/spinner +0 -3
  338. data/lib/bio/shell/rails/script/runner +0 -3
  339. data/lib/bio/shell/rails/script/server +0 -42
  340. data/lib/bio/shell/rails/test/test_helper.rb +0 -28
@@ -3,9 +3,9 @@
3
3
  #
4
4
  # Copyright:: Copyright (C) 2002, 2003, 2004, 2005
5
5
  # Toshiaki Katayama <k@bioruby.org>
6
- # License:: LGPL
6
+ # License:: The Ruby License
7
7
  #
8
- # $Id: registry.rb,v 1.16 2005/12/18 15:58:42 k Exp $
8
+ # $Id: registry.rb,v 1.19 2007/04/05 23:35:41 trevor Exp $
9
9
  #
10
10
  # == Description
11
11
  #
@@ -81,26 +81,10 @@
81
81
  # * http://cvs.open-bio.org/cgi-bin/viewcvs/viewcvs.cgi/obda-specs/?cvsroot=obf-common
82
82
  # * http://www.open-bio.org/registry/seqdatabase.ini
83
83
  #
84
- #--
85
- # This library is free software; you can redistribute it and/or
86
- # modify it under the terms of the GNU Lesser General Public
87
- # License as published by the Free Software Foundation; either
88
- # version 2 of the License, or (at your option) any later version.
89
- #
90
- # This library is distributed in the hope that it will be useful,
91
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
92
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93
- # Lesser General Public License for more details.
94
- #
95
- # You should have received a copy of the GNU Lesser General Public
96
- # License along with this library; if not, write to the Free Software
97
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
98
- #
99
- #++
100
- #
101
84
 
102
85
  require 'uri'
103
86
  require 'net/http'
87
+ require 'bio/command'
104
88
 
105
89
 
106
90
  module Bio
@@ -187,7 +171,7 @@ class Registry
187
171
 
188
172
  def read_remote(url)
189
173
  schema, user, host, port, reg, path, = URI.split(url)
190
- Net::HTTP.start(host, port) do |http|
174
+ Bio::Command.start_http(host, port) do |http|
191
175
  response, = http.get(path)
192
176
  parse_stanza(response.body)
193
177
  end
@@ -2,14 +2,18 @@
2
2
  # = bio/io/soapwsdl.rb - SOAP/WSDL interface class
3
3
  #
4
4
  # Copyright:: Copyright (C) 2004
5
- # KATAYAMA Toshiaki <k@bioruby.org>
6
- # License:: LGPL
7
- #
8
- # $Id: soapwsdl.rb,v 1.3 2005/12/18 16:51:18 nakao Exp $
9
- #
10
- # SOAP/WSDL
5
+ # Toshiaki Katayama <k@bioruby.org>
6
+ # License:: The Ruby License
11
7
  #
8
+ # $Id: soapwsdl.rb,v 1.7 2007/04/05 23:35:41 trevor Exp $
12
9
  #
10
+ begin
11
+ require 'soap/wsdlDriver'
12
+ rescue LoadError
13
+ end
14
+
15
+ module Bio
16
+
13
17
  # == Examples
14
18
  #
15
19
  # class API < Bio::SOAPWSDL
@@ -26,48 +30,24 @@
26
30
  # (case might be insensitive) as required by SOAP4R.
27
31
  #
28
32
  # --- soap_use_proxy
33
+ #
29
34
  # Set the value of this variable to 'on'.
30
35
  #
31
36
  # --- http_proxy
37
+ #
32
38
  # Set the URL of your proxy server (http://myproxy.com:8080 etc.).
33
39
  #
34
- # === Example
40
+ # === Example to use HTTP proxy
35
41
  #
36
42
  # % export soap_use_proxy=on
37
43
  # % export http_proxy=http://localhost:8080
38
44
  #
39
- #--
40
- #
41
- # This library is free software; you can redistribute it and/or
42
- # modify it under the terms of the GNU Lesser General Public
43
- # License as published by the Free Software Foundation; either
44
- # version 2 of the License, or (at your option) any later version.
45
- #
46
- # This library is distributed in the hope that it will be useful,
47
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
48
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
49
- # Lesser General Public License for more details.
50
- #
51
- # You should have received a copy of the GNU Lesser General Public
52
- # License along with this library; if not, write to the Free Software
53
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
54
- #
55
- #++
56
- #
57
-
58
- begin
59
- require 'soap/wsdlDriver'
60
- rescue LoadError
61
- end
62
-
63
- module Bio
64
-
65
45
  class SOAPWSDL
66
46
 
67
- # WSDL URL
47
+ # Returns URL of the current WSDL file.
68
48
  attr_reader :wsdl
69
49
 
70
- # log IO
50
+ # Returns current logging IO.
71
51
  attr_reader :log
72
52
 
73
53
 
@@ -89,26 +69,51 @@ class SOAPWSDL
89
69
  private :create_driver
90
70
 
91
71
 
92
- # Set a WSDL URL.
72
+ # Change the URL for WSDL file
73
+ #
74
+ # serv = Bio::SOAPWSDL.new("http://soap.genome.jp/KEGG.wsdl")
75
+ #
76
+ # or
77
+ #
78
+ # serv = Bio::SOAPWSDL.new
79
+ # serv.wsdl = "http://soap.genome.jp/KEGG.wsdl"
80
+ #
81
+ # Note that you can't read two or more different WSDL files at once.
82
+ # In that case, create Bio::SOAPWSDL object for each.
83
+ #
93
84
  def wsdl=(url)
94
85
  @wsdl = url
95
86
  create_driver
96
87
  end
97
88
 
98
89
 
99
- # Set log IO
90
+ # Change the IO for logging. The argument is passed to wiredump_dev method
91
+ # of the SOAP4R, thus
92
+ #
93
+ # serv = Bio::SOAPWSDL.new
94
+ # serv.log = STDERR
95
+ #
96
+ # will print all the SOAP transactions in standard error.
97
+ # This feature is especially useful for debug.
98
+ #
100
99
  def log=(io)
101
100
  @log = io
102
101
  @driver.wiredump_dev = @log
103
102
  end
104
103
 
105
104
 
105
+ # List of methods defined by WSDL
106
+ def list_methods
107
+ @driver.methods(false)
108
+ end
109
+
110
+
106
111
  def method_missing(*arg)
107
112
  @driver.send(*arg)
108
113
  end
109
114
  private :method_missing
110
115
 
111
- end # SOAP
116
+ end # SOAPWSDL
112
117
 
113
118
  end # Bio
114
119
 
@@ -1,23 +1,11 @@
1
1
  #
2
- # bio/io/sql.rb - BioSQL access module
2
+ # = bio/io/sql.rb - BioSQL access module
3
3
  #
4
- # Copyright (C) 2002 KATAYAMA Toshiaki <k@bioruby.org>
4
+ # Copyright:: Copyright (C) 2002 Toshiaki Katayama <k@bioruby.org>
5
+ # Copyright:: Copyright (C) 2006 Raoul Jean Pierre Bonnal <raoul.bonnal@itb.cnr.it>
6
+ # License:: The Ruby License
5
7
  #
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: sql.rb,v 1.4 2005/09/26 13:04:28 k Exp $
8
+ # $Id: sql.rb,v 1.8 2007/04/05 23:35:41 trevor Exp $
21
9
  #
22
10
 
23
11
  begin
@@ -30,293 +18,304 @@ require 'bio/feature'
30
18
 
31
19
  module Bio
32
20
 
33
- class SQL
21
+ class SQL
34
22
 
35
- def initialize(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
36
- @dbh = DBI.connect(db, user, pass)
37
- end
23
+ def initialize(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
24
+ @dbh = DBI.connect(db, user, pass)
25
+ end
38
26
 
39
- def close
40
- @dbh.disconnect
41
- end
27
+ def close
28
+ @dbh.disconnect
29
+ end
42
30
 
43
- def fetch(accession) # or display_id for fall back
44
- query = "select * from bioentry where accession = ?"
45
- entry = @dbh.execute(query, accession).fetch
46
- return Sequence.new(@dbh, entry) if entry
31
+ # Returns Bio::SQL::Sequence object.
32
+ def fetch(accession) # or display_id for fall back
33
+ query = "select * from bioentry where accession = ?"
34
+ entry = @dbh.execute(query, accession).fetch
35
+ return Sequence.new(@dbh, entry) if entry
47
36
 
48
- query = "select * from bioentry where display_id = ?"
49
- entry = @dbh.execute(query, accession).fetch
50
- return Sequence.new(@dbh, entry) if entry
51
- end
52
- alias get_by_id fetch
37
+ query = "select * from bioentry where display_id = ?"
38
+ entry = @dbh.execute(query, accession).fetch
39
+ return Sequence.new(@dbh, entry) if entry
40
+ end
41
+ alias get_by_id fetch
53
42
 
54
43
 
55
- # for lazy fetching
44
+ # for lazy fetching
56
45
 
57
- class Sequence
46
+ class Sequence
58
47
 
59
- def initialize(dbh, entry)
60
- @dbh = dbh
61
- @bioentry_id = entry['bioentry_id']
62
- @database_id = entry['biodatabase_id']
63
- @entry_id = entry['display_id']
64
- @accession = entry['accession']
65
- @version = entry['entry_version']
66
- @division = entry['division']
67
- end
68
- attr_reader :accession, :division, :entry_id, :version
48
+ def initialize(dbh, entry)
49
+ @dbh = dbh
50
+ @bioentry_id = entry['bioentry_id']
51
+ @database_id = entry['biodatabase_id']
52
+ @entry_id = entry['display_id']
53
+ @accession = entry['accession']
54
+ @version = entry['entry_version']
55
+ @division = entry['division']
56
+ end
57
+ attr_reader :accession, :division, :entry_id, :version
69
58
 
70
59
 
71
- def to_fasta
72
- if seq = seq
73
- return seq.to_fasta(@accession)
74
- end
60
+ def to_fasta
61
+ if seq = seq
62
+ return seq.to_fasta(@accession)
75
63
  end
64
+ end
76
65
 
77
- def seq
78
- query = "select * from biosequence where bioentry_id = ?"
79
- row = @dbh.execute(query, @bioentry_id).fetch
80
- return unless row
66
+ # Returns Bio::Sequence::NA or AA object.
67
+ def seq
68
+ query = "select * from biosequence where bioentry_id = ?"
69
+ row = @dbh.execute(query, @bioentry_id).fetch
70
+ return unless row
81
71
 
82
- mol = row['molecule']
83
- seq = row['biosequence_str']
72
+ mol = row['alphabet']
73
+ seq = row['seq']
84
74
 
85
- case mol
86
- when /.na/i # 'dna' or 'rna'
87
- Bio::Sequence::NA.new(seq)
88
- else # 'protein'
89
- Bio::Sequence::AA.new(seq)
90
- end
75
+ case mol
76
+ when /.na/i # 'dna' or 'rna'
77
+ Bio::Sequence::NA.new(seq)
78
+ else # 'protein'
79
+ Bio::Sequence::AA.new(seq)
91
80
  end
81
+ end
92
82
 
93
- def subseq(from, to)
94
- length = to - from + 1
95
- query = "select molecule, substring(biosequence_str, ?, ?) as subseq" +
96
- " from biosequence where bioentry_id = ?"
97
- row = @dbh.execute(query, from, length, @bioentry_id).fetch
98
- return unless row
99
-
100
- mol = row['molecule']
101
- seq = row['subseq']
102
-
103
- case mol
104
- when /.na/i # 'dna' or 'rna'
105
- Bio::Sequence::NA.new(seq)
106
- else # 'protein'
107
- Bio::Sequence::AA.new(seq)
108
- end
83
+ # Returns Bio::Sequence::NA or AA object (by lazy fetching).
84
+ def subseq(from, to)
85
+ length = to - from + 1
86
+ query = "select alphabet, substring(seq, ?, ?) as subseq" +
87
+ " from biosequence where bioentry_id = ?"
88
+ row = @dbh.execute(query, from, length, @bioentry_id).fetch
89
+ return unless row
90
+
91
+ mol = row['alphabet']
92
+ seq = row['subseq']
93
+
94
+ case mol
95
+ when /.na/i # 'dna' or 'rna'
96
+ Bio::Sequence::NA.new(seq)
97
+ else # 'protein'
98
+ Bio::Sequence::AA.new(seq)
109
99
  end
100
+ end
110
101
 
111
102
 
112
- def features
113
- array = []
114
- query = "select * from seqfeature where bioentry_id = ?"
115
- @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
116
- next unless row
117
-
118
- f_id = row['seqfeature_id']
119
- k_id = row['seqfeature_key_id']
120
- s_id = row['seqfeature_source_id']
121
- rank = row['seqfeature_rank'].to_i - 1
103
+ # Returns Bio::Features object.
104
+ def features
105
+ array = []
106
+ query = "select * from seqfeature where bioentry_id = ?"
107
+ @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
108
+ next unless row
122
109
 
123
- # key : type (gene, CDS, ...)
124
- type = feature_key(k_id)
110
+ f_id = row['seqfeature_id']
111
+ k_id = row['type_term_id']
112
+ s_id = row['source_term_id']
113
+ rank = row['rank'].to_i - 1
125
114
 
126
- # source : database (EMBL/GenBank/SwissProt)
127
- database = feature_source(s_id)
115
+ # key : type (gene, CDS, ...)
116
+ type = feature_key(k_id)
128
117
 
129
- # location : position
130
- locations = feature_locations(f_id)
118
+ # source : database (EMBL/GenBank/SwissProt)
119
+ database = feature_source(s_id)
131
120
 
132
- # qualifier
133
- qualifiers = feature_qualifiers(f_id)
134
-
135
- # rank
136
- array[rank] = Bio::Feature.new(type, locations, qualifiers)
137
- end
138
- return Bio::Features.new(array)
139
- end
121
+ # location : position
122
+ locations = feature_locations(f_id)
140
123
 
124
+ # qualifier
125
+ qualifiers = feature_qualifiers(f_id)
141
126
 
142
- def references
143
- array = []
144
- query = <<-END
145
- select * from bioentry_reference, reference
146
- where bioentry_id = ? and
147
- bioentry_reference.reference_id = reference.reference_id
148
- END
149
- @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
150
- next unless row
151
-
152
- hash = {
153
- 'start' => row['reference_start'],
154
- 'end' => row['reference_end'],
155
- 'journal' => row['reference_location'],
156
- 'title' => row['reference_title'],
157
- 'authors' => row['reference_authors'],
158
- 'medline' => row['reference_medline']
159
- }
160
- hash.default = ''
161
-
162
- rank = row['reference_rank'].to_i - 1
163
- array[rank] = hash
164
- end
165
- return array
127
+ # rank
128
+ array[rank] = Bio::Feature.new(type, locations, qualifiers)
166
129
  end
130
+ return Bio::Features.new(array)
131
+ end
167
132
 
168
133
 
169
- def comment
170
- query = "select * from comment where bioentry_id = ?"
171
- row = @dbh.execute(query, @bioentry_id).fetch
172
- row ? row['comment_text'] : ''
134
+ # Returns reference informations in Array of Hash (not Bio::Reference).
135
+ def references
136
+ array = []
137
+ query = <<-END
138
+ select * from bioentry_reference, reference
139
+ where bioentry_id = ? and
140
+ bioentry_reference.reference_id = reference.reference_id
141
+ END
142
+ @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
143
+ next unless row
144
+
145
+ hash = {
146
+ 'start' => row['start_pos'],
147
+ 'end' => row['end_pos'],
148
+ 'journal' => row['location'],
149
+ 'title' => row['title'],
150
+ 'authors' => row['authors'],
151
+ 'medline' => row['crc']
152
+ }
153
+ hash.default = ''
154
+
155
+ rank = row['rank'].to_i - 1
156
+ array[rank] = hash
173
157
  end
158
+ return array
159
+ end
174
160
 
175
- def comments
176
- array = []
177
- query = "select * from comment where bioentry_id = ?"
178
- @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
179
- next unless row
180
- rank = row['comment_rank'].to_i - 1
181
- array[rank] = row['comment_text']
182
- end
183
- return array
184
- end
185
161
 
186
- def database
187
- query = "select * from biodatabase where biodatabase_id = ?"
188
- row = @dbh.execute(query, @database_id).fetch
189
- row ? row['name'] : ''
190
- end
162
+ # Returns the first comment. For complete comments, use comments method.
163
+ def comment
164
+ query = "select * from comment where bioentry_id = ?"
165
+ row = @dbh.execute(query, @bioentry_id).fetch
166
+ row ? row['comment_text'] : ''
167
+ end
191
168
 
192
- def date
193
- query = "select * from bioentry_date where bioentry_id = ?"
194
- row = @dbh.execute(query, @bioentry_id).fetch
195
- row ? row['date'] : ''
169
+ # Returns comments in an Array of Strings.
170
+ def comments
171
+ array = []
172
+ query = "select * from comment where bioentry_id = ?"
173
+ @dbh.execute(query, @bioentry_id).fetch_all.each do |row|
174
+ next unless row
175
+ rank = row['rank'].to_i - 1
176
+ array[rank] = row['comment_text']
196
177
  end
178
+ return array
179
+ end
197
180
 
198
- def dblink
199
- query = "select * from bioentry_direct_links where source_bioentry_id = ?"
200
- row = @dbh.execute(query, @bioentry_id).fetch
201
- row ? [row['dbname'], row['accession']] : []
202
- end
181
+ def database
182
+ query = "select * from biodatabase where biodatabase_id = ?"
183
+ row = @dbh.execute(query, @database_id).fetch
184
+ row ? row['name'] : ''
185
+ end
203
186
 
204
- def definition
205
- query = "select * from bioentry_description where bioentry_id = ?"
206
- row = @dbh.execute(query, @bioentry_id).fetch
207
- row ? row['description'] : ''
208
- end
187
+ def date
188
+ query = "select * from bioentry_date where bioentry_id = ?"
189
+ row = @dbh.execute(query, @bioentry_id).fetch
190
+ row ? row['date'] : ''
191
+ end
209
192
 
210
- def keyword
211
- query = "select * from bioentry_keywords where bioentry_id = ?"
212
- row = @dbh.execute(query, @bioentry_id).fetch
213
- row ? row['keywords'] : ''
214
- end
193
+ def dblink
194
+ query = "select * from bioentry_direct_links where source_bioentry_id = ?"
195
+ row = @dbh.execute(query, @bioentry_id).fetch
196
+ row ? [row['dbname'], row['accession']] : []
197
+ end
215
198
 
216
- def taxonomy
217
- query = <<-END
218
- select full_lineage, common_name, ncbi_taxa_id
219
- from bioentry_taxa, taxa
220
- where bioentry_id = ? and bioentry_taxa.taxa_id = taxa.taxa_id
221
- END
222
- row = @dbh.execute(query, @bioentry_id).fetch
223
- @lineage = row ? row['full_lineage'] : ''
224
- @common_name = row ? row['common_name'] : ''
225
- @ncbi_taxa_id = row ? row['ncbi_taxa_id'] : ''
226
- row ? [@lineage, @common_name, @ncbi_taxa_id] : []
227
- end
199
+ def definition
200
+ query = "select * from bioentry_description where bioentry_id = ?"
201
+ row = @dbh.execute(query, @bioentry_id).fetch
202
+ row ? row['description'] : ''
203
+ end
228
204
 
229
- def lineage
230
- taxonomy unless @lineage
231
- return @lineage
232
- end
205
+ def keyword
206
+ query = "select * from bioentry_keywords where bioentry_id = ?"
207
+ row = @dbh.execute(query, @bioentry_id).fetch
208
+ row ? row['keywords'] : ''
209
+ end
233
210
 
234
- def common_name
235
- taxonomy unless @common_name
236
- return @common_name
237
- end
211
+ # Use lineage, common_name, ncbi_taxa_id methods to extract in detail.
212
+ def taxonomy
213
+ query = <<-END
214
+ select taxon_name.name, taxon.ncbi_taxon_id from bioentry
215
+ join taxon_name using(taxon_id) join taxon using (taxon_id)
216
+ where bioentry_id = ?
217
+ END
218
+ row = @dbh.execute(query, @bioentry_id).fetch
219
+ # @lineage = row ? row['full_lineage'] : ''
220
+ @common_name = row ? row['name'] : ''
221
+ @ncbi_taxa_id = row ? row['ncbi_taxon_id'] : ''
222
+ row ? [@lineage, @common_name, @ncbi_taxa_id] : []
223
+ end
238
224
 
239
- def ncbi_taxa_id
240
- taxonomy unless @ncbi_taxa_id
241
- return @ncbi_taxa_id
242
- end
225
+ def lineage
226
+ taxonomy unless @lineage
227
+ return @lineage
228
+ end
243
229
 
230
+ def common_name
231
+ taxonomy unless @common_name
232
+ return @common_name
233
+ end
244
234
 
245
- private
235
+ def ncbi_taxa_id
236
+ taxonomy unless @ncbi_taxa_id
237
+ return @ncbi_taxa_id
238
+ end
246
239
 
247
- def feature_key(k_id)
248
- query = "select * from seqfeature_key where seqfeature_key_id = ?"
249
- row = @dbh.execute(query, k_id).fetch
250
- row ? row['key_name'] : ''
251
- end
252
240
 
253
- def feature_source(s_id)
254
- query = "select * from seqfeature_source where seqfeature_source_id = ?"
255
- row = @dbh.execute(query, s_id).fetch
256
- row ? row['source_name'] : ''
257
- end
241
+ private
258
242
 
259
- def feature_locations(f_id)
260
- locations = []
261
- query = "select * from seqfeature_location where seqfeature_id = ?"
262
- @dbh.execute(query, f_id).fetch_all.each do |row|
263
- next unless row
243
+ def feature_key(k_id)
244
+ query = "select * from term where term_id= ?"
245
+ row = @dbh.execute(query, k_id).fetch
246
+ row ? row['name'] : ''
247
+ end
264
248
 
265
- location = Bio::Location.new
266
- location.strand = row['seq_strand']
267
- location.from = row['seq_start']
268
- location.to = row['seq_end']
249
+ def feature_source(s_id)
250
+ query = "select * from term where term_id = ?"
251
+ row = @dbh.execute(query, s_id).fetch
252
+ row ? row['name'] : ''
253
+ end
269
254
 
270
- xref = feature_locations_remote(row['seqfeature_location_id'])
271
- location.xref_id = xref.shift unless xref.empty?
255
+ def feature_locations(f_id)
256
+ locations = []
257
+ query = "select * from location where seqfeature_id = ?"
258
+ @dbh.execute(query, f_id).fetch_all.each do |row|
259
+ next unless row
272
260
 
273
- # just omit fuzzy location for now...
274
- #feature_locations_qv(row['seqfeature_location_id'])
261
+ location = Bio::Location.new
262
+ location.strand = row['strand']
263
+ location.from = row['start_pos']
264
+ location.to = row['end_pos']
275
265
 
276
- rank = row['location_rank'].to_i - 1
277
- locations[rank] = location
278
- end
279
- return Bio::Locations.new(locations)
280
- end
266
+ xref = feature_locations_remote(row['dbxref_if'])
267
+ location.xref_id = xref.shift unless xref.empty?
281
268
 
282
- def feature_locations_remote(l_id)
283
- query = "select * from remote_seqfeature_name where seqfeature_location_id = ?"
284
- row = @dbh.execute(query, l_id).fetch
285
- row ? [row['accession'], row['version']] : []
286
- end
269
+ # just omit fuzzy location for now...
270
+ #feature_locations_qv(row['seqfeature_location_id'])
287
271
 
288
- def feature_locations_qv(l_id)
289
- query = "select * from location_qualifier_value where seqfeature_location_id = ?"
290
- row = @dbh.execute(query, l_id).fetch
291
- row ? [row['qualifier_value'], row['slot_value']] : []
272
+ rank = row['rank'].to_i - 1
273
+ locations[rank] = location
292
274
  end
275
+ return Bio::Locations.new(locations)
276
+ end
293
277
 
294
- def feature_qualifiers(f_id)
295
- qualifiers = []
296
- query = "select * from seqfeature_qualifier_value where seqfeature_id = ?"
297
- @dbh.execute(query, f_id).fetch_all.each do |row|
298
- next unless row
278
+ def feature_locations_remote(l_id)
279
+ query = "select * from dbxref where dbxref_id = ?"
280
+ row = @dbh.execute(query, l_id).fetch
281
+ row ? [row['accession'], row['version']] : []
282
+ end
299
283
 
300
- key = feature_qualifiers_key(row['seqfeature_qualifier_id'])
301
- value = row['qualifier_value']
302
- qualifier = Bio::Feature::Qualifier.new(key, value)
284
+ def feature_locations_qv(l_id)
285
+ query = "select * from location_qualifier_value where location_id = ?"
286
+ row = @dbh.execute(query, l_id).fetch
287
+ row ? [row['value'], row['int_value']] : []
288
+ end
303
289
 
304
- rank = row['seqfeature_qualifier_rank'].to_i - 1
305
- qualifiers[rank] = qualifier
306
- end
307
- return qualifiers.compact # .compact is nasty hack for a while
308
- end
290
+ def feature_qualifiers(f_id)
291
+ qualifiers = []
292
+ query = "select * from seqfeature_qualifier_value where seqfeature_id = ?"
293
+ @dbh.execute(query, f_id).fetch_all.each do |row|
294
+ next unless row
309
295
 
310
- def feature_qualifiers_key(q_id)
311
- query = "select * from seqfeature_qualifier where seqfeature_qualifier_id = ?"
312
- row = @dbh.execute(query, q_id).fetch
313
- row ? row['qualifier_name'] : ''
296
+ key = feature_qualifiers_key(row['seqfeature_id'])
297
+ value = row['value']
298
+ qualifier = Bio::Feature::Qualifier.new(key, value)
299
+
300
+ rank = row['rank'].to_i - 1
301
+ qualifiers[rank] = qualifier
314
302
  end
303
+ return qualifiers.compact # .compact is nasty hack for a while
315
304
  end
316
305
 
306
+ def feature_qualifiers_key(q_id)
307
+ query = <<-END
308
+ select * from seqfeature_qualifier_value
309
+ join term using(term_id) where seqfeature_id = ?
310
+ END
311
+ row = @dbh.execute(query, q_id).fetch
312
+ row ? row['name'] : ''
313
+ end
317
314
  end
318
315
 
319
- end
316
+ end # SQL
317
+
318
+ end # Bio
320
319
 
321
320
 
322
321
  if __FILE__ == $0
@@ -364,65 +363,3 @@ if __FILE__ == $0
364
363
 
365
364
  end
366
365
 
367
-
368
- =begin
369
-
370
- = Bio::SQL
371
-
372
- --- Bio::SQL.new(db = 'dbi:Mysql:biosql', user = nil, pass = nil)
373
-
374
- --- Bio::SQL.close
375
-
376
- --- Bio::SQL#fetch(accession)
377
-
378
- Returns Bio::SQL::Sequence object.
379
-
380
- == Bio::SQL::Sequence
381
-
382
- --- Bio::SQL::Sequence.new(dbh, entry)
383
-
384
- --- Bio::SQL::Sequence#accession -> String
385
- --- Bio::SQL::Sequence#comment -> String
386
-
387
- Returns the first comment. For complete comments, use comments method.
388
-
389
- --- Bio::SQL::Sequence#comments -> Array
390
-
391
- Returns comments in an Array of Strings.
392
-
393
- --- Bio::SQL::Sequence#common_name -> String
394
- --- Bio::SQL::Sequence#database -> String
395
- --- Bio::SQL::Sequence#date -> String
396
- --- Bio::SQL::Sequence#dblink -> Array
397
- --- Bio::SQL::Sequence#definition -> String
398
- --- Bio::SQL::Sequence#division -> String
399
- --- Bio::SQL::Sequence#entry_id -> String
400
-
401
- --- Bio::SQL::Sequence#features
402
-
403
- Returns Bio::Features object.
404
-
405
- --- Bio::SQL::Sequence#keyword -> String
406
- --- Bio::SQL::Sequence#lineage -> String
407
- --- Bio::SQL::Sequence#ncbi_taxa_id -> String
408
-
409
- --- Bio::SQL::Sequence#references -> Array
410
-
411
- Returns reference informations in Array of Hash (not Bio::Reference).
412
-
413
- --- Bio::SQL::Sequence#seq
414
-
415
- Returns Bio::Sequence::NA or AA object.
416
-
417
- --- Bio::SQL::Sequence#subseq(from, to)
418
-
419
- Returns Bio::Sequence::NA or AA object (by lazy fetching).
420
-
421
- --- Bio::SQL::Sequence#taxonomy -> DBI::Row
422
-
423
- Use lineage, common_name, ncbi_taxa_id methods to extract in detail.
424
-
425
- --- Bio::SQL::Sequence#version -> String
426
-
427
- =end
428
-