bio 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,281 @@
1
+ /* body */
2
+
3
+ body {
4
+ color: #000000;
5
+ background-color: #ffffff;
6
+ margin-left: 5%;
7
+ margin-right: 5%;
8
+ font-family: verdana, arial;
9
+ }
10
+
11
+ em {
12
+ font-weight: bold;
13
+ font-style: normal;
14
+ }
15
+
16
+ /* link */
17
+
18
+ a:link {
19
+ color: #00ca65;
20
+ text-decoration: none;
21
+ }
22
+ a:visited {
23
+ color: #49ba18;
24
+ text-decoration: none;
25
+ }
26
+ a:hover, a:focus {
27
+ color: #c2fe20;
28
+ background-color: #ffffff;
29
+ text-decoration: underline;
30
+ }
31
+
32
+
33
+ /* header */
34
+
35
+ h1 {
36
+ color: #000000;
37
+ background-color: transparent;
38
+ border-color: #49ba18;
39
+ /* border-width: 1px 0px 1px 0px;*/
40
+ border-width: 0px 0px 5px 0px;
41
+ border-style: solid;
42
+ padding-bottom: 3px;
43
+ padding-right: 10%;
44
+ text-align: left;
45
+ }
46
+ h2 {
47
+ color: #000000;
48
+ /* background-color: transparent;*/
49
+ background-color: #b0ffb0;
50
+ border-color: #b0ffb0;
51
+ border-style: none;
52
+ border-width: 1px 0px 1px 0px;
53
+ margin-bottom: 0px;
54
+ margin-top: 1em;
55
+ padding: 3px;
56
+ }
57
+ h3 {
58
+ padding-top: 2px;
59
+ padding-left: 5px;
60
+ font-weight: bold;
61
+ border-style: solid;
62
+ border-color: #d8ffd8;
63
+ /* border-width: 2px 0px 0px 10px;*/
64
+ border-width: 2px 0px 0px 2px;
65
+ }
66
+ h4 {
67
+ padding-bottom: 1px;
68
+ padding-left: 5px;
69
+ font-weight: bold;
70
+ font-weight: bold;
71
+ border-style: solid;
72
+ border-color: #b0ffb0;
73
+ border-width: 0px 0px 2px 0px;
74
+ /* margin: 1.5em 10px 0px*/
75
+ }
76
+ h5 {
77
+ padding-top: 2px;
78
+ padding-left: 5px;
79
+ font-weight: bold;
80
+ border-style: dotted;
81
+ border-color: #d8ffd8;
82
+ border-width: 2px 0px 0px 2px;
83
+ /* margin: 1.5em 20px 0px*/
84
+ }
85
+ h6 {
86
+ padding-left: 5px;
87
+ font-weight: bold;
88
+ border-style: solid;
89
+ border-color: #b0ffb0;
90
+ border-width: 0px 0px 0px 5px;
91
+ /* margin: 1.5em 20px 0px*/
92
+ }
93
+
94
+
95
+ /* paragraph */
96
+
97
+ p {
98
+ margin-left: 0em! important;
99
+ text-indent: 0em
100
+ }
101
+
102
+
103
+ /* line */
104
+
105
+ hr {
106
+ border-style: solid;
107
+ border-color: #00ca65;
108
+ border-width: 1px;
109
+ }
110
+
111
+
112
+ /* list */
113
+
114
+ dl {
115
+ }
116
+ dt {
117
+ padding-left: 5px;
118
+ font-size: 110%;
119
+ border-style: solid;
120
+ border-color: #B0FFB0;
121
+ border-width: 0px 0px 0px 5px;
122
+ font-weight: bold;
123
+ }
124
+ dd {
125
+ }
126
+ li {
127
+ /* list-style-type: disc; */
128
+ }
129
+ ul,ol{
130
+ }
131
+
132
+
133
+ /* table */
134
+
135
+ th {
136
+ padding: 5px;
137
+ text-align: left;
138
+ }
139
+ td {
140
+ padding: 5px;
141
+ }
142
+
143
+ /* quote */
144
+
145
+ pre {
146
+ color: #000000;
147
+ background-color: #d8ffd8;
148
+ margin-left: 20px;
149
+ padding: 8px;
150
+ border-style: solid;
151
+ border-color: #b0ffb0;
152
+ border-width: 1px 5px 1px 5px;
153
+ white-space: pre;
154
+ }
155
+ blockquote {
156
+ color: #008080;
157
+ background-color: #ffffff;
158
+ margin-left: 20px;
159
+ padding: 8px;
160
+ border-style: solid;
161
+ border-color: #38c868;
162
+ border-width: 3px 1px 3px 1px;
163
+ }
164
+
165
+
166
+ /* image */
167
+
168
+ img {
169
+ border-width: 0px;
170
+ }
171
+
172
+
173
+ /* form */
174
+
175
+ input, select {
176
+ color: #000000;
177
+ background-color: transparent;
178
+ padding: 2px;
179
+ border-style: solid;
180
+ border-color: #71e63e;
181
+ border-width: 1px;
182
+ }
183
+ textarea {
184
+ color: #000000;
185
+ background-color: #ffffff;
186
+ border-style: solid;
187
+ border-color: #00ca65;
188
+ border-width: 1px;
189
+ font-family: monospace;
190
+ }
191
+
192
+ /* reviz */
193
+
194
+ table.reviz {
195
+ width: 100%;
196
+ }
197
+ th.file {
198
+ background-color: #008080;
199
+ width: 15%;
200
+ }
201
+ th.rev, th.age, th.author {
202
+ background-color: #38c868;
203
+ width: 10%;
204
+ }
205
+ th.log {
206
+ background-color: #c2fe20;
207
+ }
208
+
209
+ td.dir {
210
+ background-color: #b0ffb0;
211
+ background-image: url(reviz/dir.gif);
212
+ background-position: center left;
213
+ background-repeat: no-repeat;
214
+ text-indent: 15px;
215
+ }
216
+ td.file {
217
+ background-color: #b0ffb0;
218
+ background-image: url(reviz/file.gif);
219
+ background-position: center left;
220
+ background-repeat: no-repeat;
221
+ text-indent: 15px;
222
+ }
223
+ td.rev, td.age, td.author, td.log {
224
+ background-color: #d8ffd8;
225
+ }
226
+
227
+
228
+ /* rwiki */
229
+
230
+ .navi {
231
+ text-align: right;
232
+ }
233
+ .headerURL {
234
+ text-align: right;
235
+ font-size: 10pt;
236
+ }
237
+ address {
238
+ color: gray;
239
+ text-align: right;
240
+ font-style: normal;
241
+ font-variant: normal;
242
+ font-weight: normal;
243
+ }
244
+
245
+ /* hiki */
246
+
247
+ ins.added {
248
+ font-weight: bold;
249
+ }
250
+ del.deleted {
251
+ text-decoration: line-through;
252
+ }
253
+ form.update textarea.keyword {
254
+ width: 15em;
255
+ height: 3em;
256
+ }
257
+ div.adminmenu {
258
+ text-align: right;
259
+ }
260
+ div.caption {
261
+ text-align: right;
262
+ }
263
+ div.footer {
264
+ text-align: right;
265
+ }
266
+
267
+
268
+ /* top */
269
+
270
+ span.title {
271
+ font-size: +2
272
+ }
273
+ span.lead {
274
+ text-decoration: underline
275
+ }
276
+ span.expire {
277
+ color: #c04040
278
+ }
279
+ span.ruby {
280
+ font-weight: bold
281
+ }
@@ -0,0 +1,2 @@
1
+ require 'mkmf'
2
+ create_makefile("bioruby")
data/lib/bio.rb CHANGED
@@ -5,18 +5,29 @@
5
5
  # Toshiaki Katayama <k@bioruby.org>
6
6
  # License:: The Ruby License
7
7
  #
8
- # $Id: bio.rb,v 1.88 2007/12/29 19:19:07 k Exp $
8
+ # $Id:$
9
9
  #
10
10
 
11
11
  module Bio
12
12
 
13
- BIORUBY_VERSION = [1, 2, 1].extend(Comparable)
13
+ autoload :BIORUBY_VERSION, 'bio/version'
14
+ autoload :BIORUBY_EXTRA_VERSION, 'bio/version'
15
+ autoload :BIORUBY_VERSION_ID, 'bio/version'
14
16
 
15
17
  ### Basic data types
16
18
 
17
19
  ## Sequence
18
20
 
19
21
  autoload :Sequence, 'bio/sequence'
22
+ ## below are described in bio/sequence.rb
23
+ #class Sequence
24
+ # autoload :Common, 'bio/sequence/common'
25
+ # autoload :NA, 'bio/sequence/na'
26
+ # autoload :AA, 'bio/sequence/aa'
27
+ # autoload :Generic, 'bio/sequence/generic'
28
+ # autoload :Format, 'bio/sequence/format'
29
+ # autoload :Adapter, 'bio/sequence/adapter'
30
+ #end
20
31
 
21
32
  ## Locations/Location
22
33
 
@@ -26,12 +37,12 @@ module Bio
26
37
  ## Features/Feature
27
38
 
28
39
  autoload :Feature, 'bio/feature'
29
- autoload :Features, 'bio/feature'
40
+ autoload :Features, 'bio/compat/features'
30
41
 
31
42
  ## References/Reference
32
43
 
33
44
  autoload :Reference, 'bio/reference'
34
- autoload :References, 'bio/reference'
45
+ autoload :References, 'bio/compat/references'
35
46
 
36
47
  ## Pathway/Relation
37
48
 
@@ -144,6 +155,7 @@ module Bio
144
155
  autoload :DBGET, 'bio/io/dbget'
145
156
 
146
157
  autoload :Ensembl, 'bio/io/ensembl'
158
+ autoload :Hinv, 'bio/io/hinv'
147
159
 
148
160
  ## below are described in bio/appl/blast.rb
149
161
  #class Blast
@@ -169,8 +181,10 @@ module Bio
169
181
 
170
182
  class NCBI
171
183
  autoload :SOAP, 'bio/io/ncbisoap'
184
+ autoload :REST, 'bio/io/ncbirest'
172
185
  end
173
186
 
187
+ autoload :TogoWS, 'bio/io/togows'
174
188
 
175
189
  ### Applications
176
190
 
@@ -188,6 +202,9 @@ module Bio
188
202
  # autoload :Default, 'bio/appl/blast/format0'
189
203
  # autoload :WU, 'bio/appl/blast/wublast'
190
204
  # autoload :Bl2seq, 'bio/appl/bl2seq/report'
205
+ # autoload :RPSBlast, 'bio/appl/blast/rpsblast'
206
+ # autoload :NCBIOptions, 'bio/appl/blast/ncbioptions'
207
+ # autoload :Remote, 'bio/appl/blast/remote'
191
208
  #end
192
209
 
193
210
  autoload :HMMER, 'bio/appl/hmmer'
@@ -251,6 +268,14 @@ module Bio
251
268
 
252
269
  autoload :Iprscan, 'bio/appl/iprscan/report'
253
270
 
271
+ autoload :PAML, 'bio/appl/paml/common'
272
+ ## below are described in bio/appl/paml/common.rb
273
+ # module PAML
274
+ # autoload :Codeml, 'bio/appl/paml/codeml'
275
+ # autoload :Baseml, 'bio/appl/paml/baseml'
276
+ # autoload :Yn00, 'bio/appl/paml/yn00'
277
+ # end
278
+
254
279
  ### Utilities
255
280
 
256
281
  autoload :SiRNA, 'bio/util/sirna'
@@ -1,18 +1,19 @@
1
1
  #
2
2
  # = bio/appl/blast.rb - BLAST wrapper
3
3
  #
4
- # Copyright:: Copyright (C) 2001 Mitsuteru C. Nakao <n@bioruby.org>
4
+ # Copyright:: Copyright (C) 2001,2008 Mitsuteru C. Nakao <n@bioruby.org>
5
5
  # Copyright:: Copyright (C) 2002,2003 Toshiaki Katayama <k@bioruby.org>
6
6
  # Copyright:: Copyright (C) 2006 Jan Aerts <jan.aerts@bbsrc.ac.uk>
7
+ # Copyright:: Copyright (C) 2008 Naohisa Goto <ng@bioruby.org>
7
8
  # License:: The Ruby License
8
9
  #
9
- # $Id: blast.rb,v 1.33 2007/04/05 23:35:39 trevor Exp $
10
+ # $Id:$
10
11
  #
11
12
 
12
- require 'net/http'
13
- require 'cgi' unless defined?(CGI)
14
13
  require 'bio/command'
15
14
  require 'shellwords'
15
+ require 'stringio'
16
+ require 'bio/io/flatfile'
16
17
 
17
18
  module Bio
18
19
 
@@ -39,20 +40,6 @@ module Bio
39
40
  #
40
41
  # # Then, to parse the report, see Bio::Blast::Report
41
42
  #
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
43
  # == See also
57
44
  #
58
45
  # * Bio::Blast::Report
@@ -69,9 +56,13 @@ module Bio
69
56
 
70
57
  autoload :Fastacmd, 'bio/io/fastacmd'
71
58
  autoload :Report, 'bio/appl/blast/report'
59
+ autoload :Report_tab, 'bio/appl/blast/report'
72
60
  autoload :Default, 'bio/appl/blast/format0'
73
61
  autoload :WU, 'bio/appl/blast/wublast'
74
62
  autoload :Bl2seq, 'bio/appl/bl2seq/report'
63
+ autoload :RPSBlast, 'bio/appl/blast/rpsblast'
64
+ autoload :NCBIOptions, 'bio/appl/blast/ncbioptions'
65
+ autoload :Remote, 'bio/appl/blast/remote'
75
66
 
76
67
  # This is a shortcut for Bio::Blast.new:
77
68
  # Bio::Blast.local(program, database, options)
@@ -83,9 +74,14 @@ module Bio
83
74
  # * _db_ (required): name of the local database
84
75
  # * _options_: blastall options \
85
76
  # (see http://www.genome.jp/dbget-bin/show_man?blast2)
77
+ # * _blastall_: full path to blastall program (e.g. "/opt/bin/blastall"; DEFAULT: "blastall")
86
78
  # *Returns*:: Bio::Blast factory object
87
- def self.local(program, db, option = '')
88
- self.new(program, db, option, 'local')
79
+ def self.local(program, db, options = '', blastall = nil)
80
+ f = self.new(program, db, options, 'local')
81
+ if blastall then
82
+ f.blastall = blastall
83
+ end
84
+ f
89
85
  end
90
86
 
91
87
  # Bio::Blast.remote does exactly the same as Bio::Blast.new, but sets
@@ -102,17 +98,143 @@ module Bio
102
98
  self.new(program, db, option, server)
103
99
  end
104
100
 
105
- # the method Bio::Blast.report is moved from bio/appl/blast/report.rb.
106
- # only for xml format
101
+
102
+ # Bio::Blast.report parses given data,
103
+ # and returns an array of report
104
+ # (Bio::Blast::Report or Bio::Blast::Default::Report) objects,
105
+ # or yields each report object when a block is given.
106
+ #
107
+ # Supported formats: NCBI default (-m 0), XML (-m 7), tabular (-m 8).
108
+ #
109
+ # ---
110
+ # *Arguments*:
111
+ # * _input_ (required): input data
112
+ # * _parser_: type of parser. see Bio::Blast::Report.new
113
+ # *Returns*:: Undefiend when a block is given. Otherwise, an Array containing report (Bio::Blast::Report or Bio::Blast::Default::Report) objects.
107
114
  def self.reports(input, parser = nil)
115
+ begin
116
+ istr = input.to_str
117
+ rescue NoMethodError
118
+ istr = nil
119
+ end
120
+ if istr then
121
+ input = StringIO.new(istr)
122
+ end
123
+ raise 'unsupported input data type' unless input.respond_to?(:gets)
124
+
125
+ # if proper parser is given, emulates old behavior.
126
+ case parser
127
+ when :xmlparser, :rexml
128
+ ff = Bio::FlatFile.new(Bio::Blast::Report, input)
129
+ if block_given? then
130
+ ff.each do |e|
131
+ yield e
132
+ end
133
+ return []
134
+ else
135
+ return ff.to_a
136
+ end
137
+ when :tab
138
+ istr = input.read unless istr
139
+ rep = Report.new(istr, parser)
140
+ if block_given? then
141
+ yield rep
142
+ return []
143
+ else
144
+ return [ rep ]
145
+ end
146
+ end
147
+
148
+ # preparation of the new format autodetection rule if needed
149
+ if !defined?(@@reports_format_autodetection_rule) or
150
+ !@@reports_format_autodetection_rule then
151
+ regrule = Bio::FlatFile::AutoDetect::RuleRegexp
152
+ blastxml = regrule[ 'Bio::Blast::Report',
153
+ /\<\!DOCTYPE BlastOutput PUBLIC / ]
154
+ blast = regrule[ 'Bio::Blast::Default::Report',
155
+ /^BLAST.? +[\-\.\w]+ +\[[\-\.\w ]+\]/ ]
156
+ tblast = regrule[ 'Bio::Blast::Default::Report_TBlast',
157
+ /^TBLAST.? +[\-\.\w]+ +\[[\-\.\w ]+\]/ ]
158
+ tab = regrule[ 'Bio::Blast::Report_tab',
159
+ /^([^\t]*\t){11}[^\t]*$/ ]
160
+ auto = Bio::FlatFile::AutoDetect[ blastxml,
161
+ blast,
162
+ tblast,
163
+ tab
164
+ ]
165
+ # sets priorities
166
+ blastxml.is_prior_to blast
167
+ blast.is_prior_to tblast
168
+ tblast.is_prior_to tab
169
+ # rehash
170
+ auto.rehash
171
+ @@report_format_autodetection_rule = auto
172
+ end
173
+
174
+ # Creates a FlatFile object with dummy class
175
+ ff = Bio::FlatFile.new(Object, input)
176
+ ff.dbclass = nil
177
+
178
+ # file format autodetection
179
+ 3.times do
180
+ break if ff.eof? or
181
+ ff.autodetect(31, @@report_format_autodetection_rule)
182
+ end
183
+ # If format detection failed, assumed to be tabular (-m 8)
184
+ ff.dbclass = Bio::Blast::Report_tab unless ff.dbclass
185
+
186
+ if block_given? then
187
+ ff.each do |entry|
188
+ yield entry
189
+ end
190
+ ret = []
191
+ else
192
+ ret = ff.to_a
193
+ end
194
+ ret
195
+ end
196
+
197
+ #--
198
+ # the method Bio::Blast.reports is moved from bio/appl/blast/report.rb.
199
+ #++
200
+
201
+ # Note that this is the old implementation of Bio::Blast.reports.
202
+ # The aim of this method is keeping compatibility for older BLAST
203
+ # XML documents which might not be parsed by the new
204
+ # Bio::Blast.reports nor Bio::FlatFile.
205
+ # (Though we are not sure whether such documents exist or not.)
206
+ #
207
+ # Bio::Blast.reports_xml parses given data,
208
+ # and returns an array of Bio::Blast::Report objects, or
209
+ # yields each Bio::Blast::Report object when a block is given.
210
+ #
211
+ # It can be used only for XML format.
212
+ # For default (-m 0) format, consider using Bio::FlatFile, or
213
+ # Bio::Blast.reports.
214
+ #
215
+ # ---
216
+ # *Arguments*:
217
+ # * _input_ (required): input data
218
+ # * _parser_: type of parser. see Bio::Blast::Report.new
219
+ # *Returns*:: Undefiend when a block is given. Otherwise, an Array containing Bio::Blast::Report objects.
220
+ def self.reports_xml(input, parser = nil)
108
221
  ary = []
109
- input.each("</BlastOutput>\n") do |xml|
222
+ input.each_line("</BlastOutput>\n") do |xml|
110
223
  xml.sub!(/[^<]*(<?)/, '\1') # skip before <?xml> tag
111
224
  next if xml.empty? # skip trailing no hits
112
- if block_given?
113
- yield Report.new(xml, parser)
225
+ rep = Report.new(xml, parser)
226
+ if rep.reports then
227
+ if block_given?
228
+ rep.reports.each { |r| yield r }
229
+ else
230
+ ary.concat rep.reports
231
+ end
114
232
  else
115
- ary << Report.new(xml, parser)
233
+ if block_given?
234
+ yield rep
235
+ else
236
+ ary.push rep
237
+ end
116
238
  end
117
239
  end
118
240
  return ary
@@ -127,11 +249,33 @@ module Bio
127
249
  attr_accessor :db
128
250
 
129
251
  # Options for blastall
130
- attr_accessor :options
252
+ attr_reader :options
253
+
254
+ # Sets options for blastall
255
+ def options=(ary)
256
+ @options = set_options(ary)
257
+ end
131
258
 
132
259
  # Server to submit the BLASTs to
133
260
  attr_accessor :server
134
261
 
262
+ # Sets server to submit the BLASTs to.
263
+ # The exec_xxxx method should be defined in Bio::Blast or
264
+ # Bio::Blast::Remote::Xxxx class.
265
+ def server=(str)
266
+ @server = str
267
+ begin
268
+ m = Bio::Blast::Remote.const_get(@server.capitalize)
269
+ rescue NameError
270
+ m = nil
271
+ end
272
+ if m and !(self.is_a?(m)) then
273
+ # lazy include Bio::Blast::Remote::XXX module
274
+ self.class.class_eval { include m }
275
+ end
276
+ return @server
277
+ end
278
+
135
279
  # Full path for blastall. (default: 'blastall').
136
280
  attr_accessor :blastall
137
281
 
@@ -148,7 +292,7 @@ module Bio
148
292
  #
149
293
  # 0, pairwise; 1; 2; 3; 4; 5; 6; 7, XML Blast outpu;, 8, tabular;
150
294
  # 9, tabular with comment lines; 10, ASN text; 11, ASN binery [intege].
151
- attr_reader :format
295
+ attr_accessor :format
152
296
 
153
297
  #
154
298
  attr_writer :parser # to change :xmlparser, :rexml, :tab
@@ -173,7 +317,6 @@ module Bio
173
317
  def initialize(program, db, opt = [], server = 'local')
174
318
  @program = program
175
319
  @db = db
176
- @server = server
177
320
 
178
321
  @blastall = 'blastall'
179
322
  @matrix = nil
@@ -181,137 +324,179 @@ module Bio
181
324
 
182
325
  @output = ''
183
326
  @parser = nil
327
+ @format = nil
184
328
 
185
- begin
186
- a = opt.to_ary
187
- rescue NameError #NoMethodError
188
- # backward compatibility
189
- a = Shellwords.shellwords(opt)
190
- end
191
- unless a.find { |x| /\A\-m/ =~ x.to_s } then
192
- if defined?(XMLParser) or defined?(REXML)
193
- @format = 7
194
- else
195
- @format = 8
196
- end
197
- end
198
- @options = [ *a ]
329
+ @options = set_options(opt, program, db)
330
+ self.server = server
199
331
  end
200
332
 
333
+
201
334
  # This method submits a sequence to a BLAST factory, which performs the
202
335
  # actual BLAST.
203
336
  #
204
- # fasta_sequences = Bio::FlatFile.open(Bio::FastaFormat, 'my_sequences.fa')
205
- # report = blast_factory.query(fasta_sequences)
337
+ # # example 1
338
+ # seq = Bio::Sequence::NA.new('agggcattgccccggaagatcaagtcgtgctcctg')
339
+ # report = blast_factory.query(seq)
340
+ #
341
+ # # example 2
342
+ # str <<END_OF_FASTA
343
+ # >lcl|MySequence
344
+ # MPPSAISKISNSTTPQVQSSSAPNLTMLEGKGISVEKSFRVYSEEENQNQHKAKDSLGF
345
+ # KELEKDAIKNSKQDKKDHKNWLETLYDQAEQKWLQEPKKKLQDLIKNSGDNSRVILKDS
346
+ # END_OF_FASTA
347
+ # report = blast_factory.query(str)
348
+ #
349
+ # Bug note: When multi-FASTA is given and the format is 7 (XML) or 8 (tab),
350
+ # it should return an array of Bio::Blast::Report objects,
351
+ # but it returns a single Bio::Blast::Report object.
352
+ # This is a known bug and should be fixed in the future.
206
353
  #
207
354
  # ---
208
355
  # *Arguments*:
209
356
  # * _query_ (required): single- or multiple-FASTA formatted sequence(s)
210
- # *Returns*:: a Bio::Blast::Report object
357
+ # *Returns*:: a Bio::Blast::Report (or Bio::Blast::Default::Report) object when single query is given. When multiple sequences are given as the query, it returns an array of Bio::Blast::Report (or Bio::Blast::Default::Report) objects. If it can not parse result, nil will be returnd.
211
358
  def query(query)
212
- return self.send("exec_#{@server}", query.to_s)
359
+ case query
360
+ when Bio::Sequence
361
+ query = query.output(:fasta)
362
+ when Bio::Sequence::NA, Bio::Sequence::AA, Bio::Sequence::Generic
363
+ query = query.to_fasta('query', 70)
364
+ else
365
+ query = query.to_s
366
+ end
367
+
368
+ @output = self.__send__("exec_#{@server}", query)
369
+ report = parse_result(@output)
370
+ return report
213
371
  end
214
372
 
215
373
  # Returns options of blastall
216
374
  def option
217
375
  # backward compatibility
218
- Bio::Command.make_command_line(@options)
376
+ Bio::Command.make_command_line(options)
219
377
  end
220
378
 
221
379
  # Set options for blastall
222
380
  def option=(str)
223
381
  # backward compatibility
224
- @options = Shellwords.shellwords(str)
382
+ self.options = Shellwords.shellwords(str)
225
383
  end
226
384
 
227
-
228
385
  private
229
386
 
387
+ def set_options(opt = nil, program = nil, db = nil)
388
+ opt = @options unless opt
230
389
 
231
- def parse_result(data)
232
- Report.new(data, @parser)
233
- end
234
-
390
+ # when opt is a String, splits to an array
391
+ begin
392
+ a = opt.to_ary
393
+ rescue NameError #NoMethodError
394
+ # backward compatibility
395
+ a = Shellwords.shellwords(opt)
396
+ end
397
+ ncbiopt = NCBIOptions.new(a)
235
398
 
236
- def exec_local(query)
237
- cmd = [ @blastall, '-p', @program, '-d', @db ]
238
- cmd.concat([ '-M', @matrix ]) if @matrix
239
- cmd.concat([ '-F', @filter ]) if @filter
240
- cmd.concat([ '-m', @format.to_s ]) if @format
241
- cmd.concat(@options) if @options
399
+ if fmt = ncbiopt.get('-m') then
400
+ @format = fmt.to_i
401
+ else
402
+ Bio::Blast::Report #dummy to load XMLParser or REXML
403
+ if defined?(XMLParser) or defined?(REXML)
404
+ @format ||= 7
405
+ else
406
+ @format ||= 8
407
+ end
408
+ end
242
409
 
243
- report = nil
410
+ mtrx = ncbiopt.get('-M')
411
+ @matrix = mtrx if mtrx
412
+ fltr = ncbiopt.get('-F')
413
+ @filter = fltr if fltr
414
+
415
+ # special treatment for '-p'
416
+ if program then
417
+ @program = program
418
+ ncbiopt.delete('-p')
419
+ else
420
+ program = ncbiopt.get('-p')
421
+ @program = program if program
422
+ end
244
423
 
245
- @output = Bio::Command.query_command(cmd, query)
246
- report = parse_result(@output)
424
+ # special treatment for '-d'
425
+ if db then
426
+ @db = db
427
+ ncbiopt.delete('-d')
428
+ else
429
+ db = ncbiopt.get('-d')
430
+ @db = db if db
431
+ end
247
432
 
248
- return report
433
+ # returns an array of string containing options
434
+ return ncbiopt.options
249
435
  end
250
436
 
251
- def exec_genomenet_tab(query)
252
- @format = 8
253
- exec_genomenet(query)
437
+ # parses result
438
+ def parse_result(str)
439
+ if @format.to_i == 0 then
440
+ ary = Bio::FlatFile.open(Bio::Blast::Default::Report,
441
+ StringIO.new(str)) { |ff| ff.to_a }
442
+ case ary.size
443
+ when 0
444
+ return nil
445
+ when 1
446
+ return ary[0]
447
+ else
448
+ return ary
449
+ end
450
+ else
451
+ Report.new(str, @parser)
452
+ end
254
453
  end
255
454
 
256
- def exec_genomenet(query)
257
- host = "blast.genome.jp"
258
- #path = "/sit-bin/nph-blast"
259
- path = "/sit-bin/blast" #2005.08.12
260
-
261
- matrix = @matrix ? @matrix : 'blosum62'
262
- filter = @filter ? @filter : 'T'
263
-
264
- opt = []
265
- opt.concat([ '-m', @format.to_s ]) if @format
266
- opt.concat(@options) if @options
267
-
268
- form = {
269
- 'style' => 'raw',
270
- 'prog' => @program,
271
- 'dbname' => @db,
272
- 'sequence' => CGI.escape(query),
273
- 'other_param' => CGI.escape(Bio::Command.make_command_line_unix(opt)),
274
- 'matrix' => matrix,
275
- 'filter' => filter,
276
- 'V_value' => 500, # default value for GenomeNet
277
- 'B_value' => 250, # default value for GenomeNet
278
- 'alignment_view' => 0,
279
- }
280
-
281
- data = []
282
-
283
- form.each do |k, v|
284
- data.push("#{k}=#{v}") if v
455
+ # returns an array containing NCBI BLAST options
456
+ def make_command_line_options
457
+ set_options
458
+ cmd = []
459
+ if @program
460
+ cmd.concat([ '-p', @program ])
285
461
  end
286
-
287
- report = nil
288
-
289
- begin
290
- http = Bio::Command.new_http(host)
291
- http.open_timeout = 300
292
- http.read_timeout = 600
293
- result, = http.post(path, data.join('&'))
294
- @output = result.body
295
- # workaround 2005.08.12
296
- if /\<A +HREF=\"(http\:\/\/blast\.genome\.jp(\/tmp\/[^\"]+))\"\>Show all result\<\/A\>/i =~ @output.to_s then
297
- result, = http.get($2)
298
- @output = result.body
299
- txt = @output.to_s.split(/\<pre\>/)[1]
300
- raise 'cannot understand response' unless txt
301
- txt.sub!(/\<\/pre\>.*\z/m, '')
302
- txt.sub!(/.*^ \-{20,}\s*/m, '')
303
- @output = txt.gsub(/\&lt\;/, '<')
304
- report = parse_result(@output)
305
- else
306
- raise 'cannot understand response'
307
- end
462
+ if @db
463
+ cmd.concat([ '-d', @db ])
464
+ end
465
+ if @format
466
+ cmd.concat([ '-m', @format.to_s ])
308
467
  end
468
+ if @matrix
469
+ cmd.concat([ '-M', @matrix ])
470
+ end
471
+ if @filter
472
+ cmd.concat([ '-F', @filter ])
473
+ end
474
+ ncbiopts = NCBIOptions.new(@options)
475
+ ncbiopts.make_command_line_options(cmd)
476
+ end
309
477
 
310
- return report
478
+ # makes command line.
479
+ def make_command_line
480
+ cmd = make_command_line_options
481
+ cmd.unshift @blastall
482
+ cmd
483
+ end
484
+
485
+ # Local execution of blastall
486
+ def exec_local(query)
487
+ cmd = make_command_line
488
+ @output = Bio::Command.query_command(cmd, query)
489
+ return @output
311
490
  end
312
491
 
313
- def exec_ncbi(query)
314
- raise NotImplementedError
492
+ # This method is obsolete.
493
+ #
494
+ # Runs genomenet with '-m 8' option.
495
+ # Note that the format option is overwritten.
496
+ def exec_genomenet_tab(query)
497
+ warn "Bio::Blast#server=\"genomenet_tab\" is deprecated."
498
+ @format = 8
499
+ exec_genomenet(query)
315
500
  end
316
501
 
317
502
  end # class Blast