jandot-bio 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (335) hide show
  1. data/bin/bioruby +44 -0
  2. data/bin/br_biofetch.rb +47 -0
  3. data/bin/br_bioflat.rb +282 -0
  4. data/bin/br_biogetseq.rb +45 -0
  5. data/bin/br_pmfetch.rb +421 -0
  6. data/doc/Changes-0.7.rd +369 -0
  7. data/doc/KEGG_API.rd +1843 -0
  8. data/doc/KEGG_API.rd.ja +1834 -0
  9. data/doc/Tutorial.rd +1296 -0
  10. data/doc/Tutorial.rd.ja +2640 -0
  11. data/etc/bioinformatics/seqdatabase.ini +210 -0
  12. data/lib/bio.rb +279 -0
  13. data/lib/bio/alignment.rb +2518 -0
  14. data/lib/bio/appl/bl2seq/report.rb +334 -0
  15. data/lib/bio/appl/blast.rb +351 -0
  16. data/lib/bio/appl/blast/format0.rb +1438 -0
  17. data/lib/bio/appl/blast/format8.rb +83 -0
  18. data/lib/bio/appl/blast/report.rb +516 -0
  19. data/lib/bio/appl/blast/rexml.rb +135 -0
  20. data/lib/bio/appl/blast/rpsblast.rb +176 -0
  21. data/lib/bio/appl/blast/wublast.rb +550 -0
  22. data/lib/bio/appl/blast/xmlparser.rb +228 -0
  23. data/lib/bio/appl/blat/report.rb +489 -0
  24. data/lib/bio/appl/clustalw.rb +219 -0
  25. data/lib/bio/appl/clustalw/report.rb +152 -0
  26. data/lib/bio/appl/emboss.rb +203 -0
  27. data/lib/bio/appl/fasta.rb +237 -0
  28. data/lib/bio/appl/fasta/format10.rb +325 -0
  29. data/lib/bio/appl/gcg/msf.rb +212 -0
  30. data/lib/bio/appl/gcg/seq.rb +195 -0
  31. data/lib/bio/appl/genscan/report.rb +552 -0
  32. data/lib/bio/appl/hmmer.rb +126 -0
  33. data/lib/bio/appl/hmmer/report.rb +683 -0
  34. data/lib/bio/appl/iprscan/report.rb +374 -0
  35. data/lib/bio/appl/mafft.rb +259 -0
  36. data/lib/bio/appl/mafft/report.rb +226 -0
  37. data/lib/bio/appl/muscle.rb +52 -0
  38. data/lib/bio/appl/phylip/alignment.rb +129 -0
  39. data/lib/bio/appl/phylip/distance_matrix.rb +96 -0
  40. data/lib/bio/appl/probcons.rb +41 -0
  41. data/lib/bio/appl/psort.rb +548 -0
  42. data/lib/bio/appl/psort/report.rb +457 -0
  43. data/lib/bio/appl/pts1.rb +263 -0
  44. data/lib/bio/appl/sim4.rb +124 -0
  45. data/lib/bio/appl/sim4/report.rb +485 -0
  46. data/lib/bio/appl/sosui/report.rb +151 -0
  47. data/lib/bio/appl/spidey/report.rb +593 -0
  48. data/lib/bio/appl/targetp/report.rb +267 -0
  49. data/lib/bio/appl/tcoffee.rb +55 -0
  50. data/lib/bio/appl/tmhmm/report.rb +222 -0
  51. data/lib/bio/command.rb +337 -0
  52. data/lib/bio/data/aa.rb +349 -0
  53. data/lib/bio/data/codontable.rb +722 -0
  54. data/lib/bio/data/na.rb +223 -0
  55. data/lib/bio/db.rb +329 -0
  56. data/lib/bio/db/aaindex.rb +357 -0
  57. data/lib/bio/db/embl/common.rb +336 -0
  58. data/lib/bio/db/embl/embl.rb +402 -0
  59. data/lib/bio/db/embl/sptr.rb +1283 -0
  60. data/lib/bio/db/embl/swissprot.rb +42 -0
  61. data/lib/bio/db/embl/trembl.rb +41 -0
  62. data/lib/bio/db/embl/uniprot.rb +42 -0
  63. data/lib/bio/db/fantom.rb +599 -0
  64. data/lib/bio/db/fasta.rb +907 -0
  65. data/lib/bio/db/genbank/common.rb +290 -0
  66. data/lib/bio/db/genbank/ddbj.rb +22 -0
  67. data/lib/bio/db/genbank/genbank.rb +215 -0
  68. data/lib/bio/db/genbank/genpept.rb +60 -0
  69. data/lib/bio/db/genbank/refseq.rb +18 -0
  70. data/lib/bio/db/gff.rb +174 -0
  71. data/lib/bio/db/go.rb +481 -0
  72. data/lib/bio/db/kegg/brite.rb +41 -0
  73. data/lib/bio/db/kegg/compound.rb +131 -0
  74. data/lib/bio/db/kegg/drug.rb +98 -0
  75. data/lib/bio/db/kegg/enzyme.rb +148 -0
  76. data/lib/bio/db/kegg/expression.rb +155 -0
  77. data/lib/bio/db/kegg/genes.rb +263 -0
  78. data/lib/bio/db/kegg/genome.rb +241 -0
  79. data/lib/bio/db/kegg/glycan.rb +170 -0
  80. data/lib/bio/db/kegg/keggtab.rb +357 -0
  81. data/lib/bio/db/kegg/kgml.rb +256 -0
  82. data/lib/bio/db/kegg/orthology.rb +136 -0
  83. data/lib/bio/db/kegg/reaction.rb +82 -0
  84. data/lib/bio/db/kegg/taxonomy.rb +331 -0
  85. data/lib/bio/db/lasergene.rb +209 -0
  86. data/lib/bio/db/litdb.rb +107 -0
  87. data/lib/bio/db/medline.rb +323 -0
  88. data/lib/bio/db/nbrf.rb +191 -0
  89. data/lib/bio/db/newick.rb +658 -0
  90. data/lib/bio/db/nexus.rb +1854 -0
  91. data/lib/bio/db/pdb.rb +29 -0
  92. data/lib/bio/db/pdb/atom.rb +77 -0
  93. data/lib/bio/db/pdb/chain.rb +210 -0
  94. data/lib/bio/db/pdb/chemicalcomponent.rb +224 -0
  95. data/lib/bio/db/pdb/model.rb +148 -0
  96. data/lib/bio/db/pdb/pdb.rb +1911 -0
  97. data/lib/bio/db/pdb/residue.rb +176 -0
  98. data/lib/bio/db/pdb/utils.rb +399 -0
  99. data/lib/bio/db/prosite.rb +597 -0
  100. data/lib/bio/db/rebase.rb +457 -0
  101. data/lib/bio/db/soft.rb +404 -0
  102. data/lib/bio/db/transfac.rb +375 -0
  103. data/lib/bio/feature.rb +226 -0
  104. data/lib/bio/io/das.rb +461 -0
  105. data/lib/bio/io/dbget.rb +194 -0
  106. data/lib/bio/io/ddbjxml.rb +581 -0
  107. data/lib/bio/io/ebisoap.rb +158 -0
  108. data/lib/bio/io/ensembl.rb +229 -0
  109. data/lib/bio/io/fastacmd.rb +163 -0
  110. data/lib/bio/io/fetch.rb +181 -0
  111. data/lib/bio/io/flatfile.rb +1309 -0
  112. data/lib/bio/io/flatfile/bdb.rb +253 -0
  113. data/lib/bio/io/flatfile/index.rb +1371 -0
  114. data/lib/bio/io/flatfile/indexer.rb +787 -0
  115. data/lib/bio/io/higet.rb +73 -0
  116. data/lib/bio/io/hinv.rb +442 -0
  117. data/lib/bio/io/keggapi.rb +805 -0
  118. data/lib/bio/io/ncbirest.rb +256 -0
  119. data/lib/bio/io/ncbisoap.rb +155 -0
  120. data/lib/bio/io/pubmed.rb +307 -0
  121. data/lib/bio/io/registry.rb +292 -0
  122. data/lib/bio/io/soapwsdl.rb +119 -0
  123. data/lib/bio/io/sql.rb +365 -0
  124. data/lib/bio/location.rb +772 -0
  125. data/lib/bio/map.rb +410 -0
  126. data/lib/bio/pathway.rb +854 -0
  127. data/lib/bio/reference.rb +623 -0
  128. data/lib/bio/sequence.rb +475 -0
  129. data/lib/bio/sequence/aa.rb +125 -0
  130. data/lib/bio/sequence/common.rb +333 -0
  131. data/lib/bio/sequence/compat.rb +123 -0
  132. data/lib/bio/sequence/format.rb +181 -0
  133. data/lib/bio/sequence/generic.rb +24 -0
  134. data/lib/bio/sequence/na.rb +491 -0
  135. data/lib/bio/shell.rb +44 -0
  136. data/lib/bio/shell/core.rb +578 -0
  137. data/lib/bio/shell/demo.rb +146 -0
  138. data/lib/bio/shell/interface.rb +218 -0
  139. data/lib/bio/shell/irb.rb +95 -0
  140. data/lib/bio/shell/object.rb +71 -0
  141. data/lib/bio/shell/plugin/blast.rb +42 -0
  142. data/lib/bio/shell/plugin/codon.rb +218 -0
  143. data/lib/bio/shell/plugin/das.rb +58 -0
  144. data/lib/bio/shell/plugin/emboss.rb +23 -0
  145. data/lib/bio/shell/plugin/entry.rb +105 -0
  146. data/lib/bio/shell/plugin/flatfile.rb +101 -0
  147. data/lib/bio/shell/plugin/keggapi.rb +181 -0
  148. data/lib/bio/shell/plugin/midi.rb +430 -0
  149. data/lib/bio/shell/plugin/obda.rb +45 -0
  150. data/lib/bio/shell/plugin/psort.rb +56 -0
  151. data/lib/bio/shell/plugin/seq.rb +247 -0
  152. data/lib/bio/shell/plugin/soap.rb +87 -0
  153. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/bioruby_generator.rb +29 -0
  154. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_classes.rhtml +4 -0
  155. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_log.rhtml +27 -0
  156. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_methods.rhtml +11 -0
  157. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_modules.rhtml +4 -0
  158. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/_variables.rhtml +7 -0
  159. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-bg.gif +0 -0
  160. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-gem.png +0 -0
  161. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby-link.gif +0 -0
  162. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.css +368 -0
  163. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby.rhtml +47 -0
  164. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_controller.rb +144 -0
  165. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/bioruby_helper.rb +47 -0
  166. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/commands.rhtml +8 -0
  167. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/history.rhtml +10 -0
  168. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/index.rhtml +26 -0
  169. data/lib/bio/shell/rails/vendor/plugins/bioruby/generators/bioruby/templates/spinner.gif +0 -0
  170. data/lib/bio/shell/script.rb +25 -0
  171. data/lib/bio/shell/setup.rb +109 -0
  172. data/lib/bio/shell/web.rb +102 -0
  173. data/lib/bio/tree.rb +850 -0
  174. data/lib/bio/util/color_scheme.rb +191 -0
  175. data/lib/bio/util/color_scheme/buried.rb +59 -0
  176. data/lib/bio/util/color_scheme/helix.rb +59 -0
  177. data/lib/bio/util/color_scheme/hydropathy.rb +64 -0
  178. data/lib/bio/util/color_scheme/nucleotide.rb +31 -0
  179. data/lib/bio/util/color_scheme/strand.rb +59 -0
  180. data/lib/bio/util/color_scheme/taylor.rb +50 -0
  181. data/lib/bio/util/color_scheme/turn.rb +59 -0
  182. data/lib/bio/util/color_scheme/zappo.rb +50 -0
  183. data/lib/bio/util/contingency_table.rb +370 -0
  184. data/lib/bio/util/restriction_enzyme.rb +228 -0
  185. data/lib/bio/util/restriction_enzyme/analysis.rb +249 -0
  186. data/lib/bio/util/restriction_enzyme/analysis_basic.rb +217 -0
  187. data/lib/bio/util/restriction_enzyme/cut_symbol.rb +107 -0
  188. data/lib/bio/util/restriction_enzyme/double_stranded.rb +321 -0
  189. data/lib/bio/util/restriction_enzyme/double_stranded/aligned_strands.rb +130 -0
  190. data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair.rb +103 -0
  191. data/lib/bio/util/restriction_enzyme/double_stranded/cut_location_pair_in_enzyme_notation.rb +38 -0
  192. data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations.rb +76 -0
  193. data/lib/bio/util/restriction_enzyme/double_stranded/cut_locations_in_enzyme_notation.rb +107 -0
  194. data/lib/bio/util/restriction_enzyme/enzymes.yaml +7061 -0
  195. data/lib/bio/util/restriction_enzyme/range/cut_range.rb +24 -0
  196. data/lib/bio/util/restriction_enzyme/range/cut_ranges.rb +47 -0
  197. data/lib/bio/util/restriction_enzyme/range/horizontal_cut_range.rb +67 -0
  198. data/lib/bio/util/restriction_enzyme/range/sequence_range.rb +257 -0
  199. data/lib/bio/util/restriction_enzyme/range/sequence_range/calculated_cuts.rb +242 -0
  200. data/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb +51 -0
  201. data/lib/bio/util/restriction_enzyme/range/sequence_range/fragments.rb +41 -0
  202. data/lib/bio/util/restriction_enzyme/range/vertical_cut_range.rb +77 -0
  203. data/lib/bio/util/restriction_enzyme/single_strand.rb +199 -0
  204. data/lib/bio/util/restriction_enzyme/single_strand/cut_locations_in_enzyme_notation.rb +135 -0
  205. data/lib/bio/util/restriction_enzyme/single_strand_complement.rb +23 -0
  206. data/lib/bio/util/restriction_enzyme/string_formatting.rb +111 -0
  207. data/lib/bio/util/sirna.rb +288 -0
  208. data/sample/any2fasta.rb +59 -0
  209. data/sample/biofetch.rb +475 -0
  210. data/sample/color_scheme_na.rb +91 -0
  211. data/sample/dbget +37 -0
  212. data/sample/enzymes.rb +78 -0
  213. data/sample/fasta2tab.rb +99 -0
  214. data/sample/fastagrep.rb +72 -0
  215. data/sample/fastasort.rb +54 -0
  216. data/sample/fsplit.rb +51 -0
  217. data/sample/gb2fasta.rb +30 -0
  218. data/sample/gb2tab.rb +325 -0
  219. data/sample/gbtab2mysql.rb +161 -0
  220. data/sample/genes2nuc.rb +33 -0
  221. data/sample/genes2pep.rb +33 -0
  222. data/sample/genes2tab.rb +81 -0
  223. data/sample/genome2rb.rb +29 -0
  224. data/sample/genome2tab.rb +76 -0
  225. data/sample/goslim.rb +303 -0
  226. data/sample/gt2fasta.rb +47 -0
  227. data/sample/na2aa.rb +34 -0
  228. data/sample/pmfetch.rb +42 -0
  229. data/sample/pmsearch.rb +42 -0
  230. data/sample/psortplot_html.rb +214 -0
  231. data/sample/ssearch2tab.rb +96 -0
  232. data/sample/tdiary.rb +158 -0
  233. data/sample/tfastx2tab.rb +100 -0
  234. data/sample/vs-genes.rb +212 -0
  235. data/test/data/HMMER/hmmpfam.out +64 -0
  236. data/test/data/HMMER/hmmsearch.out +88 -0
  237. data/test/data/SOSUI/sample.report +11 -0
  238. data/test/data/TMHMM/sample.report +21 -0
  239. data/test/data/aaindex/DAYM780301 +30 -0
  240. data/test/data/aaindex/PRAM900102 +20 -0
  241. data/test/data/bl2seq/cd8a_cd8b_blastp.bl2seq +53 -0
  242. data/test/data/bl2seq/cd8a_p53_e-5blastp.bl2seq +37 -0
  243. data/test/data/blast/2.2.15.blastp.m7 +876 -0
  244. data/test/data/blast/b0002.faa +15 -0
  245. data/test/data/blast/b0002.faa.m0 +128 -0
  246. data/test/data/blast/b0002.faa.m7 +65 -0
  247. data/test/data/blast/b0002.faa.m8 +1 -0
  248. data/test/data/embl/AB090716.embl +65 -0
  249. data/test/data/embl/AB090716.embl.rel89 +63 -0
  250. data/test/data/fasta/example1.txt +75 -0
  251. data/test/data/fasta/example2.txt +21 -0
  252. data/test/data/genscan/sample.report +63 -0
  253. data/test/data/iprscan/merged.raw +32 -0
  254. data/test/data/iprscan/merged.txt +74 -0
  255. data/test/data/prosite/prosite.dat +2233 -0
  256. data/test/data/refseq/nm_126355.entret +64 -0
  257. data/test/data/soft/GDS100_partial.soft +92 -0
  258. data/test/data/soft/GSE3457_family_partial.soft +874 -0
  259. data/test/data/uniprot/p53_human.uniprot +1456 -0
  260. data/test/functional/bio/io/test_ensembl.rb +186 -0
  261. data/test/functional/bio/io/test_soapwsdl.rb +52 -0
  262. data/test/runner.rb +14 -0
  263. data/test/unit/bio/appl/bl2seq/test_report.rb +134 -0
  264. data/test/unit/bio/appl/blast/test_report.rb +417 -0
  265. data/test/unit/bio/appl/blast/test_xmlparser.rb +388 -0
  266. data/test/unit/bio/appl/genscan/test_report.rb +182 -0
  267. data/test/unit/bio/appl/hmmer/test_report.rb +342 -0
  268. data/test/unit/bio/appl/iprscan/test_report.rb +338 -0
  269. data/test/unit/bio/appl/mafft/test_report.rb +63 -0
  270. data/test/unit/bio/appl/sosui/test_report.rb +81 -0
  271. data/test/unit/bio/appl/targetp/test_report.rb +146 -0
  272. data/test/unit/bio/appl/test_blast.rb +163 -0
  273. data/test/unit/bio/appl/test_fasta.rb +130 -0
  274. data/test/unit/bio/appl/test_pts1.rb +140 -0
  275. data/test/unit/bio/appl/tmhmm/test_report.rb +126 -0
  276. data/test/unit/bio/data/test_aa.rb +90 -0
  277. data/test/unit/bio/data/test_codontable.rb +107 -0
  278. data/test/unit/bio/data/test_na.rb +80 -0
  279. data/test/unit/bio/db/embl/test_common.rb +117 -0
  280. data/test/unit/bio/db/embl/test_embl.rb +214 -0
  281. data/test/unit/bio/db/embl/test_embl_rel89.rb +219 -0
  282. data/test/unit/bio/db/embl/test_sptr.rb +1775 -0
  283. data/test/unit/bio/db/embl/test_uniprot.rb +31 -0
  284. data/test/unit/bio/db/kegg/test_genes.rb +45 -0
  285. data/test/unit/bio/db/pdb/test_pdb.rb +152 -0
  286. data/test/unit/bio/db/test_aaindex.rb +197 -0
  287. data/test/unit/bio/db/test_fasta.rb +250 -0
  288. data/test/unit/bio/db/test_gff.rb +127 -0
  289. data/test/unit/bio/db/test_lasergene.rb +95 -0
  290. data/test/unit/bio/db/test_newick.rb +293 -0
  291. data/test/unit/bio/db/test_nexus.rb +360 -0
  292. data/test/unit/bio/db/test_prosite.rb +1437 -0
  293. data/test/unit/bio/db/test_rebase.rb +101 -0
  294. data/test/unit/bio/db/test_soft.rb +138 -0
  295. data/test/unit/bio/io/test_ddbjxml.rb +75 -0
  296. data/test/unit/bio/io/test_ensembl.rb +109 -0
  297. data/test/unit/bio/io/test_fastacmd.rb +42 -0
  298. data/test/unit/bio/io/test_flatfile.rb +237 -0
  299. data/test/unit/bio/io/test_soapwsdl.rb +32 -0
  300. data/test/unit/bio/sequence/test_aa.rb +103 -0
  301. data/test/unit/bio/sequence/test_common.rb +174 -0
  302. data/test/unit/bio/sequence/test_compat.rb +69 -0
  303. data/test/unit/bio/sequence/test_na.rb +330 -0
  304. data/test/unit/bio/shell/plugin/test_seq.rb +185 -0
  305. data/test/unit/bio/test_alignment.rb +1025 -0
  306. data/test/unit/bio/test_command.rb +288 -0
  307. data/test/unit/bio/test_db.rb +96 -0
  308. data/test/unit/bio/test_feature.rb +116 -0
  309. data/test/unit/bio/test_location.rb +39 -0
  310. data/test/unit/bio/test_map.rb +230 -0
  311. data/test/unit/bio/test_pathway.rb +473 -0
  312. data/test/unit/bio/test_reference.rb +224 -0
  313. data/test/unit/bio/test_sequence.rb +329 -0
  314. data/test/unit/bio/test_shell.rb +18 -0
  315. data/test/unit/bio/test_tree.rb +593 -0
  316. data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +299 -0
  317. data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +103 -0
  318. data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +240 -0
  319. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +101 -0
  320. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +75 -0
  321. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +73 -0
  322. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +53 -0
  323. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +104 -0
  324. data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +83 -0
  325. data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +246 -0
  326. data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +44 -0
  327. data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +115 -0
  328. data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +147 -0
  329. data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +147 -0
  330. data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +60 -0
  331. data/test/unit/bio/util/test_color_scheme.rb +33 -0
  332. data/test/unit/bio/util/test_contingency_table.rb +94 -0
  333. data/test/unit/bio/util/test_restriction_enzyme.rb +42 -0
  334. data/test/unit/bio/util/test_sirna.rb +245 -0
  335. metadata +479 -0
@@ -0,0 +1,334 @@
1
+ #
2
+ # = bio/appl/bl2seq/report.rb - bl2seq (BLAST 2 sequences) parser
3
+ #
4
+ # Copyright:: Copyright (C) 2005 GOTO Naohisa <ng@bioruby.org>
5
+ # License:: The Ruby License
6
+ #
7
+ # $Id: report.rb,v 1.8 2007/04/05 23:35:39 trevor Exp $
8
+ #
9
+ # Bio::Bl2seq::Report is a NCBI bl2seq (BLAST 2 sequences) output parser.
10
+ #
11
+ # = Acknowledgements
12
+ #
13
+ # Thanks to Tomoaki NISHIYAMA <tomoakin __at__ kenroku.kanazawa-u.ac.jp>
14
+ # for providing bl2seq parser patches based on
15
+ # lib/bio/appl/blast/format0.rb.
16
+ #
17
+
18
+ require 'bio/appl/blast/format0'
19
+
20
+ module Bio
21
+ class Blast
22
+
23
+ class Bl2seq
24
+
25
+ # Bio::Bl2seq::Report is a NCBI bl2seq (BLAST 2 sequences) output parser.
26
+ # It inherits Bio::Blast::Default::Report.
27
+ # Most of its methods are the same as Bio::Blast::Default::Report,
28
+ # but it lacks many methods.
29
+ class Report < Bio::Blast::Default::Report
30
+
31
+ # Delimiter of each entry. Bio::FlatFile uses it.
32
+ # In Bio::Bl2seq::Report, it it nil (1 entry 1 file).
33
+ DELIMITER = RS = nil
34
+
35
+ undef format0_parse_header
36
+ undef program, version, version_number, version_date,
37
+ message, converged?, reference, db
38
+
39
+ # Splits headers.
40
+ def format0_split_headers(data)
41
+ @f0query = data.shift
42
+ end
43
+ private :format0_split_headers
44
+
45
+ # Splits the search results.
46
+ def format0_split_search(data)
47
+ iterations = []
48
+ while r = data[0] and /^\>/ =~ r
49
+ iterations << Iteration.new(data)
50
+ end
51
+ if iterations.size <= 0 then
52
+ iterations << Iteration.new(data)
53
+ end
54
+ iterations
55
+ end
56
+ private :format0_split_search
57
+
58
+ # Stores format0 database statistics.
59
+ # Internal use only. Users must not use the class.
60
+ class F0dbstat < Bio::Blast::Default::Report::F0dbstat #:nodoc:
61
+ # Returns number of sequences in database.
62
+ def db_num
63
+ unless defined?(@db_num)
64
+ parse_params
65
+ @db_num = @hash['Number of Sequences'].to_i
66
+ end
67
+ @db_num
68
+ end
69
+
70
+ # Returns number of letters in database.
71
+ def db_len
72
+ unless defined?(@db_len)
73
+ parse_params
74
+ @db_len = @hash['length of database'].to_i
75
+ end
76
+ @db_len
77
+ end
78
+ end #class F0dbstat
79
+
80
+ # Bio::Bl2seq::Report::Iteration stores information about
81
+ # a iteration.
82
+ # Normally, it may contain some Bio::Bl2seq::Report::Hit objects.
83
+ #
84
+ # Note that its main existance reason is to keep complatibility
85
+ # between Bio::Blast::Default::Report::* classes.
86
+ class Iteration < Bio::Blast::Default::Report::Iteration
87
+ # Creates a new Iteration object.
88
+ # It is designed to be called only internally from
89
+ # the Bio::Blast::Default::Report class.
90
+ # Users shall not use the method directly.
91
+ def initialize(data)
92
+ @f0stat = []
93
+ @f0dbstat = Bio::Blast::Default::Report::AlwaysNil.instance
94
+ @hits = []
95
+ @num = 1
96
+ while r = data[0] and /^\>/ =~ r
97
+ @hits << Hit.new(data)
98
+ end
99
+ end
100
+
101
+ # Returns the hits of the iteration.
102
+ # It returns an array of Bio::Bl2seq::Report::Hit objects.
103
+ def hits; @hits; end
104
+
105
+ undef message, pattern_in_database,
106
+ pattern, pattern_positions, hits_found_again,
107
+ hits_newly_found, hits_for_pattern, parse_hitlist,
108
+ converged?
109
+ end #class Iteration
110
+
111
+ # Bio::Bl2seq::Report::Hit contains information about a hit.
112
+ # It may contain some Bio::Blast::Default::Report::HSP objects.
113
+ # All methods are the same as Bio::Blast::Default::Report::Hit class.
114
+ # Please refer to Bio::Blast::Default::Report::Hit.
115
+ class Hit < Bio::Blast::Default::Report::Hit
116
+ end #class Hit
117
+
118
+ # Bio::Bl2seq::Report::HSP holds information about the hsp
119
+ # (high-scoring segment pair).
120
+ # NOTE that the HSP class below is NOT used because
121
+ # Ruby's constants namespace are normally statically determined
122
+ # and HSP object is created in Bio::Blast::Default::Report::Hit class.
123
+ # Please refer to Bio::Blast::Default::Report::HSP.
124
+ class HSP < Bio::Blast::Default::Report::HSP
125
+ end #class HSP
126
+
127
+ end #class Report
128
+ end #class Bl2seq
129
+
130
+ end #class Blast
131
+ end #module Bio
132
+
133
+ ######################################################################
134
+
135
+ if __FILE__ == $0
136
+
137
+ Bio::FlatFile.open(Bio::Blast::Bl2seq::Report, ARGF) do |ff|
138
+ ff.each do |rep|
139
+
140
+ print "# === Bio::Blast::Bl2seq::Report\n"
141
+ puts
142
+ #@#print " rep.program #=> "; p rep.program
143
+ #@#print " rep.version #=> "; p rep.version
144
+ #@#print " rep.reference #=> "; p rep.reference
145
+ #@#print " rep.db #=> "; p rep.db
146
+ #print " rep.query_id #=> "; p rep.query_id
147
+ print " rep.query_def #=> "; p rep.query_def
148
+ print " rep.query_len #=> "; p rep.query_len
149
+ #puts
150
+ #@#print " rep.version_number #=> "; p rep.version_number
151
+ #@#print " rep.version_date #=> "; p rep.version_date
152
+ puts
153
+
154
+ print "# === Parameters\n"
155
+ #puts
156
+ #print " rep.parameters #=> "; p rep.parameters
157
+ puts
158
+ print " rep.matrix #=> "; p rep.matrix
159
+ print " rep.expect #=> "; p rep.expect
160
+ #print " rep.inclusion #=> "; p rep.inclusion
161
+ print " rep.sc_match #=> "; p rep.sc_match
162
+ print " rep.sc_mismatch #=> "; p rep.sc_mismatch
163
+ print " rep.gap_open #=> "; p rep.gap_open
164
+ print " rep.gap_extend #=> "; p rep.gap_extend
165
+ #print " rep.filter #=> "; p rep.filter
166
+ #@#print " rep.pattern #=> "; p rep.pattern
167
+ #print " rep.entrez_query #=> "; p rep.entrez_query
168
+ #puts
169
+ #@#print " rep.pattern_positions #=> "; p rep.pattern_positions
170
+ puts
171
+
172
+ print "# === Statistics (last iteration's)\n"
173
+ #puts
174
+ #print " rep.statistics #=> "; p rep.statistics
175
+ puts
176
+ print " rep.db_num #=> "; p rep.db_num
177
+ print " rep.db_len #=> "; p rep.db_len
178
+ #print " rep.hsp_len #=> "; p rep.hsp_len
179
+ print " rep.eff_space #=> "; p rep.eff_space
180
+ print " rep.kappa #=> "; p rep.kappa
181
+ print " rep.lambda #=> "; p rep.lambda
182
+ print " rep.entropy #=> "; p rep.entropy
183
+ puts
184
+ print " rep.num_hits #=> "; p rep.num_hits
185
+ print " rep.gapped_kappa #=> "; p rep.gapped_kappa
186
+ print " rep.gapped_lambda #=> "; p rep.gapped_lambda
187
+ print " rep.gapped_entropy #=> "; p rep.gapped_entropy
188
+ print " rep.posted_date #=> "; p rep.posted_date
189
+ puts
190
+
191
+ #@#print "# === Message (last iteration's)\n"
192
+ #@#puts
193
+ #@#print " rep.message #=> "; p rep.message
194
+ #puts
195
+ #@#print " rep.converged? #=> "; p rep.converged?
196
+ #@#puts
197
+
198
+ print "# === Iterations\n"
199
+ puts
200
+ print " rep.itrerations.each do |itr|\n"
201
+ puts
202
+
203
+ rep.iterations.each do |itr|
204
+
205
+ print "# --- Bio::Blast::Bl2seq::Report::Iteration\n"
206
+ puts
207
+
208
+ print " itr.num #=> "; p itr.num
209
+ #print " itr.statistics #=> "; p itr.statistics
210
+ #@#print " itr.message #=> "; p itr.message
211
+ print " itr.hits.size #=> "; p itr.hits.size
212
+ #puts
213
+ #@#print " itr.hits_newly_found.size #=> "; p itr.hits_newly_found.size;
214
+ #@#print " itr.hits_found_again.size #=> "; p itr.hits_found_again.size;
215
+ #@#if itr.hits_for_pattern then
216
+ #@#itr.hits_for_pattern.each_with_index do |hp, hpi|
217
+ #@#print " itr.hits_for_pattern[#{hpi}].size #=> "; p hp.size;
218
+ #@#end
219
+ #@#end
220
+ #@#print " itr.converged? #=> "; p itr.converged?
221
+ puts
222
+
223
+ print " itr.hits.each do |hit|\n"
224
+ puts
225
+
226
+ itr.hits.each_with_index do |hit, i|
227
+
228
+ print "# --- Bio::Blast::Bl2seq::Default::Report::Hit"
229
+ print " ([#{i}])\n"
230
+ puts
231
+
232
+ #print " hit.num #=> "; p hit.num
233
+ #print " hit.hit_id #=> "; p hit.hit_id
234
+ print " hit.len #=> "; p hit.len
235
+ print " hit.definition #=> "; p hit.definition
236
+ #print " hit.accession #=> "; p hit.accession
237
+ #puts
238
+ print " hit.found_again? #=> "; p hit.found_again?
239
+
240
+ print " --- compatible/shortcut ---\n"
241
+ #print " hit.query_id #=> "; p hit.query_id
242
+ #print " hit.query_def #=> "; p hit.query_def
243
+ #print " hit.query_len #=> "; p hit.query_len
244
+ #print " hit.target_id #=> "; p hit.target_id
245
+ print " hit.target_def #=> "; p hit.target_def
246
+ print " hit.target_len #=> "; p hit.target_len
247
+
248
+ print " --- first HSP's values (shortcut) ---\n"
249
+ print " hit.evalue #=> "; p hit.evalue
250
+ print " hit.bit_score #=> "; p hit.bit_score
251
+ print " hit.identity #=> "; p hit.identity
252
+ #print " hit.overlap #=> "; p hit.overlap
253
+
254
+ print " hit.query_seq #=> "; p hit.query_seq
255
+ print " hit.midline #=> "; p hit.midline
256
+ print " hit.target_seq #=> "; p hit.target_seq
257
+
258
+ print " hit.query_start #=> "; p hit.query_start
259
+ print " hit.query_end #=> "; p hit.query_end
260
+ print " hit.target_start #=> "; p hit.target_start
261
+ print " hit.target_end #=> "; p hit.target_end
262
+ print " hit.lap_at #=> "; p hit.lap_at
263
+ print " --- first HSP's vaules (shortcut) ---\n"
264
+ print " --- compatible/shortcut ---\n"
265
+
266
+ puts
267
+ print " hit.hsps.size #=> "; p hit.hsps.size
268
+ if hit.hsps.size == 0 then
269
+ puts " (HSP not found: please see blastall's -b and -v options)"
270
+ puts
271
+ else
272
+
273
+ puts
274
+ print " hit.hsps.each do |hsp|\n"
275
+ puts
276
+
277
+ hit.hsps.each_with_index do |hsp, j|
278
+
279
+ print "# --- Bio::Blast::Default::Report::HSP (Bio::Blast::Bl2seq::Report::HSP)"
280
+ print " ([#{j}])\n"
281
+ puts
282
+ #print " hsp.num #=> "; p hsp.num
283
+ print " hsp.bit_score #=> "; p hsp.bit_score
284
+ print " hsp.score #=> "; p hsp.score
285
+ print " hsp.evalue #=> "; p hsp.evalue
286
+ print " hsp.identity #=> "; p hsp.identity
287
+ print " hsp.gaps #=> "; p hsp.gaps
288
+ print " hsp.positive #=> "; p hsp.positive
289
+ print " hsp.align_len #=> "; p hsp.align_len
290
+ #print " hsp.density #=> "; p hsp.density
291
+
292
+ print " hsp.query_frame #=> "; p hsp.query_frame
293
+ print " hsp.query_from #=> "; p hsp.query_from
294
+ print " hsp.query_to #=> "; p hsp.query_to
295
+
296
+ print " hsp.hit_frame #=> "; p hsp.hit_frame
297
+ print " hsp.hit_from #=> "; p hsp.hit_from
298
+ print " hsp.hit_to #=> "; p hsp.hit_to
299
+
300
+ #print " hsp.pattern_from#=> "; p hsp.pattern_from
301
+ #print " hsp.pattern_to #=> "; p hsp.pattern_to
302
+
303
+ print " hsp.qseq #=> "; p hsp.qseq
304
+ print " hsp.midline #=> "; p hsp.midline
305
+ print " hsp.hseq #=> "; p hsp.hseq
306
+ puts
307
+ print " hsp.percent_identity #=> "; p hsp.percent_identity
308
+ #print " hsp.mismatch_count #=> "; p hsp.mismatch_count
309
+ #
310
+ print " hsp.query_strand #=> "; p hsp.query_strand
311
+ print " hsp.hit_strand #=> "; p hsp.hit_strand
312
+ print " hsp.percent_positive #=> "; p hsp.percent_positive
313
+ print " hsp.percent_gaps #=> "; p hsp.percent_gaps
314
+ puts
315
+
316
+ end #each
317
+ end #if hit.hsps.size == 0
318
+ end
319
+ end
320
+ end #ff.each
321
+ end #FlatFile.open
322
+
323
+ end #if __FILE__ == $0
324
+
325
+ ######################################################################
326
+
327
+ =begin
328
+
329
+ = Bio::Blast::Bl2seq::Report
330
+
331
+ NCBI bl2seq (BLAST 2 sequences) output parser
332
+
333
+ =end
334
+
@@ -0,0 +1,351 @@
1
+ #
2
+ # = bio/appl/blast.rb - BLAST wrapper
3
+ #
4
+ # Copyright:: Copyright (C) 2001,2008 Mitsuteru C. Nakao <n@bioruby.org>
5
+ # Copyright:: Copyright (C) 2002,2003 Toshiaki Katayama <k@bioruby.org>
6
+ # Copyright:: Copyright (C) 2006 Jan Aerts <jan.aerts@bbsrc.ac.uk>
7
+ # License:: The Ruby License
8
+ #
9
+ # $Id: blast.rb,v 1.35 2008/04/15 13:54:39 ngoto Exp $
10
+ #
11
+
12
+ require 'net/http'
13
+ require 'cgi' unless defined?(CGI)
14
+ require 'bio/command'
15
+ require 'shellwords'
16
+
17
+ module Bio
18
+
19
+ # == Description
20
+ #
21
+ # The Bio::Blast class contains methods for running local or remote BLAST
22
+ # searches, as well as for parsing of the output of such BLASTs (i.e. the
23
+ # BLAST reports). For more information on similarity searches and the BLAST
24
+ # program, see http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html.
25
+ #
26
+ # == Usage
27
+ #
28
+ # require 'bio'
29
+ #
30
+ # # To run an actual BLAST analysis:
31
+ # # 1. create a BLAST factory
32
+ # remote_blast_factory = Bio::Blast.remote('blastp', 'SWISS',
33
+ # '-e 0.0001', 'genomenet')
34
+ # #or:
35
+ # local_blast_factory = Bio::Blast.local('blastn','/path/to/db')
36
+ #
37
+ # # 2. run the actual BLAST by querying the factory
38
+ # report = remote_blast_factory.query(sequence_text)
39
+ #
40
+ # # Then, to parse the report, see Bio::Blast::Report
41
+ #
42
+ # === Available databases for Bio::Blast.remote
43
+ #
44
+ # ----------+-------+---------------------------------------------------
45
+ # program | query | db (supported in GenomeNet)
46
+ # ----------+-------+---------------------------------------------------
47
+ # blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd,
48
+ # ----------+-------+ pir, prf, pdbstr
49
+ # blastx | NA |
50
+ # ----------+-------+---------------------------------------------------
51
+ # blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss,
52
+ # ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd,
53
+ # tblastn | AA | genes-nt, genome, vgenes.nuc
54
+ # ----------+-------+---------------------------------------------------
55
+ #
56
+ # == See also
57
+ #
58
+ # * Bio::Blast::Report
59
+ # * Bio::Blast::Report::Hit
60
+ # * Bio::Blast::Report::Hsp
61
+ #
62
+ # == References
63
+ #
64
+ # * http://www.ncbi.nlm.nih.gov/blast/
65
+ # * http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html
66
+ # * http://blast.genome.jp/ideas/ideas.html#blast
67
+ #
68
+ class Blast
69
+
70
+ autoload :Fastacmd, 'bio/io/fastacmd'
71
+ autoload :Report, 'bio/appl/blast/report'
72
+ autoload :Default, 'bio/appl/blast/format0'
73
+ autoload :WU, 'bio/appl/blast/wublast'
74
+ autoload :Bl2seq, 'bio/appl/bl2seq/report'
75
+ autoload :RPSBlast, 'bio/appl/blast/rpsblast'
76
+
77
+ # This is a shortcut for Bio::Blast.new:
78
+ # Bio::Blast.local(program, database, options)
79
+ # is equivalent to
80
+ # Bio::Blast.new(program, database, options, 'local')
81
+ # ---
82
+ # *Arguments*:
83
+ # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx'
84
+ # * _db_ (required): name of the local database
85
+ # * _options_: blastall options \
86
+ # (see http://www.genome.jp/dbget-bin/show_man?blast2)
87
+ # *Returns*:: Bio::Blast factory object
88
+ def self.local(program, db, option = '')
89
+ self.new(program, db, option, 'local')
90
+ end
91
+
92
+ # Bio::Blast.remote does exactly the same as Bio::Blast.new, but sets
93
+ # the remote server 'genomenet' as its default.
94
+ # ---
95
+ # *Arguments*:
96
+ # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx'
97
+ # * _db_ (required): name of the remote database
98
+ # * _options_: blastall options \
99
+ # (see http://www.genome.jp/dbget-bin/show_man?blast2)
100
+ # * _server_: server to use (DEFAULT = 'genomenet')
101
+ # *Returns*:: Bio::Blast factory object
102
+ def self.remote(program, db, option = '', server = 'genomenet')
103
+ self.new(program, db, option, server)
104
+ end
105
+
106
+ # the method Bio::Blast.report is moved from bio/appl/blast/report.rb.
107
+ # only for xml format
108
+ def self.reports(input, parser = nil)
109
+ ary = []
110
+ input.each("</BlastOutput>\n") do |xml|
111
+ xml.sub!(/[^<]*(<?)/, '\1') # skip before <?xml> tag
112
+ next if xml.empty? # skip trailing no hits
113
+ if block_given?
114
+ yield Report.new(xml, parser)
115
+ else
116
+ ary << Report.new(xml, parser)
117
+ end
118
+ end
119
+ return ary
120
+ end
121
+
122
+
123
+ # Program name (_-p_ option for blastall): blastp, blastn, blastx, tblastn
124
+ # or tblastx
125
+ attr_accessor :program
126
+
127
+ # Database name (_-d_ option for blastall)
128
+ attr_accessor :db
129
+
130
+ # Options for blastall
131
+ attr_accessor :options
132
+
133
+ # Server to submit the BLASTs to
134
+ attr_accessor :server
135
+
136
+ # Full path for blastall. (default: 'blastall').
137
+ attr_accessor :blastall
138
+
139
+ # Substitution matrix for blastall -M
140
+ attr_accessor :matrix
141
+
142
+ # Filter option for blastall -F (T or F).
143
+ attr_accessor :filter
144
+
145
+ # Returns a String containing blast execution output in as is the Bio::Blast#format.
146
+ attr_reader :output
147
+
148
+ # Output report format for blastall -m
149
+ #
150
+ # 0, pairwise; 1; 2; 3; 4; 5; 6; 7, XML Blast outpu;, 8, tabular;
151
+ # 9, tabular with comment lines; 10, ASN text; 11, ASN binery [intege].
152
+ attr_reader :format
153
+
154
+ #
155
+ attr_writer :parser # to change :xmlparser, :rexml, :tab
156
+
157
+
158
+ # Creates a Bio::Blast factory object.
159
+ #
160
+ # To run any BLAST searches, a factory has to be created that describes a
161
+ # certain BLAST pipeline: the program to use, the database to search, any
162
+ # options and the server to use. E.g.
163
+ #
164
+ # blast_factory = Bio::Blast.new('blastn','dbsts', '-e 0.0001 -r 4', 'genomenet')
165
+ #
166
+ # ---
167
+ # *Arguments*:
168
+ # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx'
169
+ # * _db_ (required): name of the (local or remote) database
170
+ # * _options_: blastall options \
171
+ # (see http://www.genome.jp/dbget-bin/show_man?blast2)
172
+ # * _server_: server to use (e.g. 'genomenet'; DEFAULT = 'local')
173
+ # *Returns*:: Bio::Blast factory object
174
+ def initialize(program, db, opt = [], server = 'local')
175
+ @program = program
176
+ @db = db
177
+ @server = server
178
+
179
+ @blastall = 'blastall'
180
+ @matrix = nil
181
+ @filter = nil
182
+
183
+ @output = ''
184
+ @parser = nil
185
+ @format = 0
186
+
187
+ set_options(opt)
188
+ end
189
+
190
+
191
+ # This method submits a sequence to a BLAST factory, which performs the
192
+ # actual BLAST.
193
+ #
194
+ # fasta_sequences = Bio::FlatFile.open(Bio::FastaFormat, 'my_sequences.fa')
195
+ # report = blast_factory.query(fasta_sequences)
196
+ #
197
+ # ---
198
+ # *Arguments*:
199
+ # * _query_ (required): single- or multiple-FASTA formatted sequence(s)
200
+ # *Returns*:: a Bio::Blast::Report object
201
+ def query(query)
202
+ return self.send("exec_#{@server}", query.to_s)
203
+ end
204
+
205
+ # Returns options of blastall
206
+ def option
207
+ # backward compatibility
208
+ Bio::Command.make_command_line(@options)
209
+ end
210
+
211
+ # Set options for blastall
212
+ def option=(str)
213
+ # backward compatibility
214
+ @options = Shellwords.shellwords(str)
215
+ end
216
+
217
+ private
218
+
219
+ def set_options(opt = nil)
220
+ opt = @options unless opt
221
+ begin
222
+ a = opt.to_ary
223
+ rescue NameError #NoMethodError
224
+ # backward compatibility
225
+ a = Shellwords.shellwords(opt)
226
+ end
227
+ unless a.find { |x| /\A\-m/ =~ x.to_s } then
228
+ if defined?(XMLParser) or defined?(REXML)
229
+ @format = 7
230
+ else
231
+ @format = 8
232
+ end
233
+ else
234
+ @format = a[a.index('-m') + 1].to_i
235
+ end
236
+ @options = [ *a ]
237
+ end
238
+
239
+
240
+ def parse_result(data)
241
+ Report.new(data, @parser)
242
+ end
243
+
244
+
245
+ def make_command_line
246
+ set_options
247
+ cmd = [ @blastall, '-p', @program, '-d', @db ]
248
+ if @matrix
249
+ cmd.concat([ '-M', @matrix ])
250
+ i = @options.index('-M')
251
+ @options.delete_at(i)
252
+ @options.delete_at(i)
253
+ end
254
+ if @filter
255
+ cmd.concat([ '-F', @filter ])
256
+ i = @options.index('-F')
257
+ @options.delete_at(i)
258
+ @options.delete_at(i)
259
+ end
260
+ if @format
261
+ cmd.concat([ '-m', @format.to_s ])
262
+ i = @options.index('-m')
263
+ @options.delete_at(i)
264
+ @options.delete_at(i)
265
+ end
266
+ cmd.concat(@options) if @options
267
+ end
268
+
269
+
270
+ def exec_local(query)
271
+ cmd = make_command_line
272
+ report = nil
273
+
274
+ @output = Bio::Command.query_command(cmd, query)
275
+ report = parse_result(@output)
276
+
277
+ return report
278
+ end
279
+
280
+
281
+ def exec_genomenet_tab(query)
282
+ @format = 8
283
+ exec_genomenet(query)
284
+ end
285
+
286
+
287
+ def exec_genomenet(query)
288
+ host = "blast.genome.jp"
289
+ #path = "/sit-bin/nph-blast"
290
+ path = "/sit-bin/blast" #2005.08.12
291
+
292
+ matrix = @matrix ? @matrix : 'blosum62'
293
+ filter = @filter ? @filter : 'T'
294
+
295
+ opt = []
296
+ opt.concat([ '-m', @format.to_s ]) if @format
297
+ opt.concat(@options) if @options
298
+
299
+ form = {
300
+ 'style' => 'raw',
301
+ 'prog' => @program,
302
+ 'dbname' => @db,
303
+ 'sequence' => CGI.escape(query),
304
+ 'other_param' => CGI.escape(Bio::Command.make_command_line_unix(opt)),
305
+ 'matrix' => matrix,
306
+ 'filter' => filter,
307
+ 'V_value' => 500, # default value for GenomeNet
308
+ 'B_value' => 250, # default value for GenomeNet
309
+ 'alignment_view' => 0,
310
+ }
311
+
312
+ data = []
313
+
314
+ form.each do |k, v|
315
+ data.push("#{k}=#{v}") if v
316
+ end
317
+
318
+ report = nil
319
+
320
+ begin
321
+ http = Bio::Command.new_http(host)
322
+ http.open_timeout = 300
323
+ http.read_timeout = 600
324
+ result, = http.post(path, data.join('&'))
325
+ @output = result.body
326
+ # workaround 2005.08.12
327
+ if /\<A +HREF=\"(http\:\/\/blast\.genome\.jp(\/tmp\/[^\"]+))\"\>Show all result\<\/A\>/i =~ @output.to_s then
328
+ result, = http.get($2)
329
+ @output = result.body
330
+ txt = @output.to_s.split(/\<pre\>/)[1]
331
+ raise 'cannot understand response' unless txt
332
+ txt.sub!(/\<\/pre\>.*\z/m, '')
333
+ txt.sub!(/.*^ \-{20,}\s*/m, '')
334
+ @output = txt.gsub(/\&lt\;/, '<')
335
+ report = parse_result(@output)
336
+ else
337
+ raise 'cannot understand response'
338
+ end
339
+ end
340
+
341
+ return report
342
+ end
343
+
344
+ def exec_ncbi(query)
345
+ raise NotImplementedError
346
+ end
347
+
348
+ end # class Blast
349
+
350
+ end # module Bio
351
+