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
@@ -1,23 +1,10 @@
1
1
  #
2
2
  # test/unit/bio/db/test_prosite.rb - Unit test for Bio::PROSITE
3
3
  #
4
- # Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
4
+ # Copyright:: Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
5
+ # License:: The Ruby License
5
6
  #
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: test_prosite.rb,v 1.3 2005/12/18 18:21:58 k Exp $
7
+ # $Id: test_prosite.rb,v 1.6 2007/04/05 23:35:43 trevor Exp $
21
8
  #
22
9
 
23
10
  require 'pathname'
@@ -1438,12 +1425,12 @@ module Bio
1438
1425
 
1439
1426
  def test_pa2re
1440
1427
  pa = '[AC]-x-V-x(4)-{ED}.'
1441
- assert_equal(/[AC].V.{4}[^ED]/, @obj.pa2re(pa))
1428
+ assert_equal(/[AC].V.{4}[^ED]/i, @obj.pa2re(pa))
1442
1429
  end
1443
1430
 
1444
1431
  def test_self_pa2re
1445
1432
  pa = '[AC]-x-V-x(4)-{ED}.'
1446
- assert_equal(/[AC].V.{4}[^ED]/, Bio::PROSITE.pa2re(pa))
1433
+ assert_equal(/[AC].V.{4}[^ED]/i, Bio::PROSITE.pa2re(pa))
1447
1434
  end
1448
1435
 
1449
1436
  end # class TestPROSITE
@@ -1,30 +1,11 @@
1
1
  #
2
2
  # test/unit/bio/db/test_rebase.rb - Unit test for Bio::REBASE
3
3
  #
4
- # Copyright:: Copyright (C) 2005 Trevor Wennblom <trevor@corevx.com>
5
- # License:: LGPL
6
- #
7
- # $Id: test_rebase.rb,v 1.2 2006/01/20 09:53:24 k Exp $
8
- #
9
- #
10
- #--
11
- #
12
- # This library is free software; you can redistribute it and/or
13
- # modify it under the terms of the GNU Lesser General Public
14
- # License as published by the Free Software Foundation; either
15
- # version 2 of the License, or (at your option) any later version.
16
- #
17
- # This library is distributed in the hope that it will be useful,
18
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
- # Lesser General Public License for more details.
21
- #
22
- # You should have received a copy of the GNU Lesser General Public
23
- # License along with this library; if not, write to the Free Software
24
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
- #
26
- #++
4
+ # Author:: Trevor Wennblom <mailto:trevor@corevx.com>
5
+ # Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
6
+ # License:: The Ruby License
27
7
  #
8
+ # $Id: test_rebase.rb,v 1.5 2007/04/05 23:35:43 trevor Exp $
28
9
  #
29
10
 
30
11
  require 'pathname'
@@ -34,8 +15,8 @@ $:.unshift(libpath) unless $:.include?(libpath)
34
15
  require 'test/unit'
35
16
  require 'bio/db/rebase'
36
17
 
37
- module Bio
38
- class TestREBASE < Test::Unit::TestCase
18
+ module Bio #:nodoc:
19
+ class TestREBASE < Test::Unit::TestCase #:nodoc:
39
20
 
40
21
  def setup
41
22
  enzyme_data = <<END
@@ -108,6 +89,11 @@ END
108
89
 
109
90
  assert_equal(a['AatI'].supplier_names, ['Toyobo Biochemicals'])
110
91
  assert_equal(a['AatI'].suppliers, ['O'])
92
+
93
+ assert_equal(a.enzyme_name?('aasi'), true)
94
+ assert_equal(a.enzyme_name?('AarI'), true)
95
+ assert_equal(a.enzyme_name?('Aari'), true)
96
+ assert_equal(a.enzyme_name?('AbrI'), false)
111
97
  end
112
98
 
113
99
  end
@@ -0,0 +1,138 @@
1
+ #
2
+ # test/unit/bio/db/test_rebase.rb - Unit test for Bio::REBASE
3
+ #
4
+ # Author:: Trevor Wennblom <mailto:trevor@corevx.com>
5
+ # Copyright:: Copyright (c) 2005-2007 Midwinter Laboratories, LLC (http://midwinterlabs.com)
6
+ # License:: The Ruby License
7
+ #
8
+ # $Id: test_soft.rb,v 1.3 2007/04/05 23:35:43 trevor Exp $
9
+ #
10
+
11
+ require 'pathname'
12
+ libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
13
+ $:.unshift(libpath) unless $:.include?(libpath)
14
+
15
+ require 'test/unit'
16
+ require 'bio/db/soft'
17
+
18
+ module Bio #:nodoc:
19
+ class TestSOFT < Test::Unit::TestCase #:nodoc:
20
+
21
+ def setup
22
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4)).cleanpath.to_s
23
+ test_data_path = Pathname.new(File.join(bioruby_root, 'test', 'data', 'soft')).cleanpath.to_s
24
+ series_filename = File.join(test_data_path, 'GSE3457_family_partial.soft')
25
+ dataset_filename = File.join(test_data_path, 'GDS100_partial.soft')
26
+
27
+ @obj_series = Bio::SOFT.new( IO.readlines(series_filename))
28
+ @obj_dataset = Bio::SOFT.new( IO.readlines(dataset_filename))
29
+ end
30
+
31
+ def test_series
32
+ assert_equal( @obj_series.platform[:geo_accession], 'GPL2092')
33
+ assert_equal( @obj_series.platform[:organism], 'Populus')
34
+ assert_equal( @obj_series.platform[:contributor], ["Jingyi,,Li", "Olga,,Shevchenko", "Steve,H,Strauss", "Amy,M,Brunner"])
35
+ assert_equal( @obj_series.platform[:data_row_count], '240')
36
+ assert_equal( @obj_series.platform.keys.sort {|a,b| a.to_s <=> b.to_s}[0..2], [:contact_address, :contact_city, :contact_country])
37
+ assert_equal( @obj_series.platform[:"contact_zip/postal_code"], '97331')
38
+ assert_equal( @obj_series.platform[:table].header, ["ID", "GB_ACC", "SPOT_ID", "Function/Family", "ORGANISM", "SEQUENCE"])
39
+ assert_equal( @obj_series.platform[:table].header_description, {"ORGANISM"=>"sequence sources",
40
+ "SEQUENCE"=>"oligo sequence used",
41
+ "Function/Family"=>"gene functions and family",
42
+ "ID"=>"",
43
+ "SPOT_ID"=>"",
44
+ "GB_ACC"=>"Gene bank accession number"})
45
+ assert_equal( @obj_series.platform[:table].rows.size, 240)
46
+ assert_equal( @obj_series.platform[:table].rows[5], ["A039P68U",
47
+ "AI163321",
48
+ "",
49
+ "TF, flowering protein CONSTANS",
50
+ "P. tremula x P. tremuloides",
51
+ "AGAAAATTCGATATACTGTCCGTAAAGAGGTAGCACTTAGAATGCAACGGAATAAAGGGCAGTTCACCTC"])
52
+ assert_equal( @obj_series.platform[:table].rows[5][4], 'P. tremula x P. tremuloides')
53
+ assert_equal( @obj_series.platform[:table].rows[5][:organism], 'P. tremula x P. tremuloides')
54
+ assert_equal( @obj_series.platform[:table].rows[5]['ORGANISM'], 'P. tremula x P. tremuloides')
55
+
56
+ assert_equal( @obj_series.series[:geo_accession], 'GSE3457')
57
+ assert_equal( @obj_series.series[:contributor], ["Jingyi,,Li",
58
+ "Olga,,Shevchenko",
59
+ "Ove,,Nilsson",
60
+ "Steve,H,Strauss",
61
+ "Amy,M,Brunner"])
62
+ assert_equal( @obj_series.series[:platform_id], 'GPL2092')
63
+ assert_equal( @obj_series.series[:sample_id].size, 74)
64
+ assert_equal( @obj_series.series[:sample_id][0..4], ["GSM77557", "GSM77558", "GSM77559", "GSM77560", "GSM77561"])
65
+
66
+ assert_equal( @obj_series.database[:name], 'Gene Expression Omnibus (GEO)')
67
+ assert_equal( @obj_series.database[:ref], 'Nucleic Acids Res. 2005 Jan 1;33 Database Issue:D562-6')
68
+ assert_equal( @obj_series.database[:institute], 'NCBI NLM NIH')
69
+
70
+ assert_equal( @obj_series.samples.size, 2)
71
+ assert_equal( @obj_series.samples[:GSM77557][:series_id], 'GSE3457')
72
+ assert_equal( @obj_series.samples['GSM77557'][:series_id], 'GSE3457')
73
+ assert_equal( @obj_series.samples[:GSM77557][:platform_id], 'GPL2092')
74
+ assert_equal( @obj_series.samples[:GSM77557][:type], 'RNA')
75
+ assert_equal( @obj_series.samples[:GSM77557][:title], 'fb6a1')
76
+ assert_equal( @obj_series.samples[:GSM77557][:table].header, ["ID_REF", "VALUE"])
77
+ assert_equal( @obj_series.samples[:GSM77557][:table].header_description, {"ID_REF"=>"", "VALUE"=>"normalized signal intensities"})
78
+ assert_equal( @obj_series.samples[:GSM77557][:table].rows.size, 217)
79
+ assert_equal( @obj_series.samples[:GSM77557][:table].rows[5], ["A039P68U", "5.36"])
80
+ assert_equal( @obj_series.samples[:GSM77557][:table].rows[5][0], 'A039P68U')
81
+ assert_equal( @obj_series.samples[:GSM77557][:table].rows[5][:id_ref], 'A039P68U')
82
+ assert_equal( @obj_series.samples[:GSM77557][:table].rows[5]['ID_REF'], 'A039P68U')
83
+ end
84
+
85
+ def test_dataset
86
+ assert_equal( @obj_dataset.database[:name], 'Gene Expression Omnibus (GEO)')
87
+
88
+ assert_equal( @obj_dataset.database[:ref], 'Nucleic Acids Res. 2005 Jan 1;33 Database Issue:D562-6')
89
+ assert_equal( @obj_dataset.database[:institute], 'NCBI NLM NIH')
90
+
91
+ assert_equal( @obj_dataset.subsets.size, 8)
92
+ assert_equal( @obj_dataset.subsets.keys, ["GDS100_1",
93
+ "GDS100_2",
94
+ "GDS100_3",
95
+ "GDS100_4",
96
+ "GDS100_5",
97
+ "GDS100_6",
98
+ "GDS100_7",
99
+ "GDS100_8"])
100
+ assert_equal( @obj_dataset.subsets[:GDS100_7], {:sample_id=>"GSM548,GSM543",
101
+ :dataset_id=>"GDS100",
102
+ :description=>"60 minute",
103
+ :type=>"time"})
104
+ assert_equal( @obj_dataset.subsets['GDS100_7'][:sample_id], 'GSM548,GSM543')
105
+ assert_equal( @obj_dataset.subsets[:GDS100_7][:sample_id], 'GSM548,GSM543')
106
+ assert_equal( @obj_dataset.subsets[:GDS100_7][:dataset_id], 'GDS100')
107
+
108
+ assert_equal( @obj_dataset.dataset[:order], 'none')
109
+ assert_equal( @obj_dataset.dataset[:sample_organism], 'Escherichia coli')
110
+ assert_equal( @obj_dataset.dataset[:table].header, ["ID_REF",
111
+ "IDENTIFIER",
112
+ "GSM549",
113
+ "GSM542",
114
+ "GSM543",
115
+ "GSM547",
116
+ "GSM544",
117
+ "GSM545",
118
+ "GSM546",
119
+ "GSM548"])
120
+ assert_equal( @obj_dataset.dataset[:table].rows.size, 15)
121
+ assert_equal( @obj_dataset.dataset[:table].rows[5], ["6",
122
+ "EMPTY",
123
+ "0.097",
124
+ "0.217",
125
+ "0.242",
126
+ "0.067",
127
+ "0.104",
128
+ "0.162",
129
+ "0.104",
130
+ "0.154"])
131
+ assert_equal( @obj_dataset.dataset[:table].rows[5][4], '0.242')
132
+ assert_equal( @obj_dataset.dataset[:table].rows[5][:gsm549], '0.097')
133
+ assert_equal( @obj_dataset.dataset[:table].rows[5][:GSM549], '0.097')
134
+ assert_equal( @obj_dataset.dataset[:table].rows[5]['GSM549'], '0.097')
135
+ end
136
+ end
137
+
138
+ end
@@ -1,23 +1,10 @@
1
1
  #
2
2
  # test/unit/bio/io/test_ddbjxml.rb - Unit test for DDBJ XML.
3
3
  #
4
- # Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
4
+ # Copyright:: Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
5
+ # License:: The Ruby License
5
6
  #
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: test_ddbjxml.rb,v 1.1 2005/12/11 14:59:25 nakao Exp $
7
+ # $Id: test_ddbjxml.rb,v 1.4 2007/04/05 23:35:43 trevor Exp $
21
8
  #
22
9
 
23
10
  require 'pathname'
@@ -33,7 +20,8 @@ module Bio
33
20
  class TestDDBJXMLConstants < Test::Unit::TestCase
34
21
 
35
22
  def test_constants
36
- constants = ["DDBJ", "TxSearch", "ClustalW", "PML", "Gib", "Fasta", "BASE_URI", "SRS", "Gtop", "GetEntry", "Blast"].sort
23
+ constants = ["DDBJ", "TxSearch", "ClustalW", "PML", "Gib", "Fasta",
24
+ "BASE_URI", "SRS", "SERVER_URI", "Gtop", "GetEntry", "Blast"].sort
37
25
  assert_equal(constants, Bio::DDBJ::XML.constants.sort)
38
26
  end
39
27
 
@@ -0,0 +1,109 @@
1
+ #
2
+ # = test/unit/bio/io/test_ensembl.rb - Unit test for Bio::Ensembl.
3
+ #
4
+ # Copyright:: Copyright (C) 2006, 2007
5
+ # Mitsuteru C. Nakao <n@bioruby.org>
6
+ # License:: The Ruby License
7
+ #
8
+ # $Id: test_ensembl.rb,v 1.6 2007/04/05 23:35:43 trevor Exp $
9
+ #
10
+
11
+ require 'pathname'
12
+ libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
13
+ $:.unshift(libpath) unless $:.include?(libpath)
14
+
15
+ require 'test/unit'
16
+ require 'bio/io/ensembl'
17
+
18
+ # tests for ensembl.rb,v 1.4
19
+ class TestEnsembl_v14 < Test::Unit::TestCase
20
+ def test_ensembl_url
21
+ assert_equal('http://www.ensembl.org', Bio::Ensembl::ENSEMBL_URL)
22
+ end
23
+
24
+ def test_server
25
+ obj = Bio::Ensembl.new('Homo_sapiens')
26
+ assert_equal('http://www.ensembl.org', obj.server)
27
+ end
28
+
29
+ def test_organism
30
+ organism = 'Homo_sapiens'
31
+ obj = Bio::Ensembl.new(organism)
32
+ assert_equal(organism, obj.organism)
33
+ end
34
+
35
+ def test_self_human
36
+ organism = 'Homo_sapiens'
37
+ obj = Bio::Ensembl.human
38
+ assert_equal(organism, obj.organism)
39
+ end
40
+
41
+ def test_self_mouse
42
+ organism = 'Mus_musculus'
43
+ obj = Bio::Ensembl.mouse
44
+ assert_equal(organism, obj.organism)
45
+ end
46
+
47
+ def test_new_with_2_args
48
+ organism = 'Oryza_sativa'
49
+ server_url = 'http://www.gramene.org'
50
+ obj = Bio::Ensembl.new(organism, server_url)
51
+ assert_equal(organism, obj.organism)
52
+ assert_equal(server_url, obj.server)
53
+ end
54
+ end
55
+
56
+
57
+ class TestEnsembl < Test::Unit::TestCase
58
+ def test_server_name
59
+ assert_equal('http://www.ensembl.org', Bio::Ensembl::EBIServerURI)
60
+ end
61
+
62
+ def test_server_uri
63
+ assert_equal('http://www.ensembl.org', Bio::Ensembl.server_uri)
64
+ end
65
+
66
+ def test_set_server_uri
67
+ host = 'http://localhost'
68
+ Bio::Ensembl.server_uri(host)
69
+ assert_equal(host, Bio::Ensembl.server_uri)
70
+ end
71
+ end
72
+
73
+
74
+ class TestEnsemblBase < Test::Unit::TestCase
75
+ def test_exportview
76
+
77
+ end
78
+ end
79
+
80
+ class TestEnsemblBaseClient < Test::Unit::TestCase
81
+ def test_class
82
+
83
+ end
84
+ end
85
+
86
+
87
+ class TestEnsemblHuman < Test::Unit::TestCase
88
+ def test_organism
89
+ assert_equal("Homo_sapiens", Bio::Ensembl::Human::Organism)
90
+ end
91
+ end
92
+
93
+ class TestEnsemblMouse < Test::Unit::TestCase
94
+ def test_organism
95
+ assert_equal("Mus_musculus", Bio::Ensembl::Mouse::Organism)
96
+ end
97
+ end
98
+
99
+
100
+ class TestEnsemblOldStyleClient < Test::Unit::TestCase
101
+ class Rice < Bio::Ensembl::Base
102
+ Organism = 'Oryza_sativa'
103
+ end
104
+
105
+ def test_organism
106
+ assert_equal('Oryza_sativa', Rice::Organism)
107
+ end
108
+ end
109
+
@@ -1,23 +1,10 @@
1
1
  #
2
2
  # test/unit/bio/io/test_fastacmd.rb - Unit test for Bio::Blast::Fastacmd.
3
3
  #
4
- # Copyright (C) 2006 Mitsuteru Nakao <n@bioruby.org>
4
+ # Copyright:: Copyright (C) 2006 Mitsuteru Nakao <n@bioruby.org>
5
+ # License:: The Ruby License
5
6
  #
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: test_fastacmd.rb,v 1.1 2006/01/28 08:05:52 nakao Exp $
7
+ # $Id: test_fastacmd.rb,v 1.3 2007/04/05 23:35:43 trevor Exp $
21
8
  #
22
9
 
23
10
  require 'pathname'
@@ -0,0 +1,237 @@
1
+ #
2
+ # = test/unit/bio/io/test_flatfile.rb - unit test for Bio::FlatFile
3
+ #
4
+ # Copyright (C) 2006 Naohisa Goto <ng@bioruby.org>
5
+ #
6
+ # License:: The Ruby License
7
+ #
8
+ # $Id: test_flatfile.rb,v 1.2 2007/04/05 23:35:43 trevor Exp $
9
+ #
10
+
11
+ require 'pathname'
12
+ libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
13
+ $:.unshift(libpath) unless $:.include?(libpath)
14
+
15
+ require 'test/unit'
16
+ require 'bio'
17
+ require 'stringio'
18
+
19
+
20
+ module Bio
21
+
22
+ module TestFlatFile
23
+
24
+ bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4)).cleanpath.to_s
25
+ TestDataPath = Pathname.new(File.join(bioruby_root, 'test', 'data')).cleanpath.to_s
26
+ TestDataFastaFormat01 = File.join(TestDataPath, 'fasta', 'example1.txt')
27
+
28
+ class TestBufferedInputStreamClassMethod < Test::Unit::TestCase
29
+ def test_self_for_io
30
+ io = File.open(TestDataFastaFormat01)
31
+ obj = Bio::FlatFile::BufferedInputStream.for_io(io)
32
+ assert_instance_of(Bio::FlatFile::BufferedInputStream, obj)
33
+ assert_equal(TestDataFastaFormat01, obj.path)
34
+ end
35
+
36
+ def test_self_open_file
37
+ obj = Bio::FlatFile::BufferedInputStream.open_file(TestDataFastaFormat01)
38
+ assert_instance_of(Bio::FlatFile::BufferedInputStream, obj)
39
+ assert_equal(TestDataFastaFormat01, obj.path)
40
+ end
41
+
42
+ def test_self_open_file_with_block
43
+ obj2 = nil
44
+ Bio::FlatFile::BufferedInputStream.open_file(TestDataFastaFormat01) do |obj|
45
+ assert_instance_of(Bio::FlatFile::BufferedInputStream, obj)
46
+ assert_equal(TestDataFastaFormat01, obj.path)
47
+ obj2 = obj
48
+ end
49
+ assert_raise(IOError) { obj2.close }
50
+ end
51
+ end #class TestBufferedInputStreamClassMethod
52
+
53
+ class TestBufferedInputStream < Test::Unit::TestCase
54
+ def setup
55
+ io = File.open(TestDataFastaFormat01)
56
+ path = TestDataFastaFormat01
57
+ @obj = Bio::FlatFile::BufferedInputStream.new(io, path)
58
+ end
59
+
60
+ def test_to_io
61
+ assert_kind_of(IO, @obj.to_io)
62
+ end
63
+
64
+ def test_close
65
+ assert_nil(@obj.close)
66
+ end
67
+
68
+ def test_rewind
69
+ @obj.prefetch_gets
70
+ @obj.rewind
71
+ assert_equal('', @obj.prefetch_buffer)
72
+ end
73
+
74
+ def test_pos
75
+ @obj.gets
76
+ @obj.gets
77
+ @obj.prefetch_gets
78
+ assert_equal(117, @obj.pos) #the number depends on original data
79
+ end
80
+
81
+ def test_pos=()
82
+ str = @obj.gets
83
+ assert_equal(0, @obj.pos = 0)
84
+ end
85
+
86
+ def test_eof_false_first
87
+ assert_equal(false, @obj.eof?)
88
+ end
89
+
90
+ def test_eof_false_after_prefetch
91
+ while @obj.prefetch_gets; nil; end
92
+ assert_equal(false, @obj.eof?)
93
+ end
94
+
95
+ def test_eof_true
96
+ while @obj.gets; nil; end
97
+ assert_equal(true, @obj.eof?)
98
+ end
99
+
100
+ def test_gets
101
+ @obj.gets
102
+ @obj.gets
103
+ assert_equal("gagcaaatcgaaaaggagagatttctgcatatcaagagaaaattcgagctgagatacattccaagtgtggctactc", @obj.gets.chomp)
104
+ end
105
+
106
+ def test_gets_equal_prefetch_gets
107
+ @obj.prefetch_gets
108
+ str = @obj.prefetch_gets
109
+ @obj.prefetch_gets
110
+ @obj.gets
111
+ assert_equal(@obj.gets, str)
112
+ end
113
+
114
+ def test_ungets
115
+ @obj.gets
116
+ @obj.gets
117
+ str1 = @obj.gets
118
+ str2 = @obj.gets
119
+ assert_nil(@obj.ungets(str2))
120
+ assert_nil(@obj.ungets(str1))
121
+ assert_equal(str1, @obj.gets)
122
+ assert_equal(str2, @obj.gets)
123
+ end
124
+
125
+ def test_getc
126
+ assert_equal(?>, @obj.getc)
127
+ end
128
+
129
+ def test_getc_after_prefetch
130
+ @obj.prefetch_gets
131
+ assert_equal(?>, @obj.getc)
132
+ end
133
+
134
+ def test_ungetc
135
+ c = @obj.getc
136
+ assert_nil(@obj.ungetc(c))
137
+ assert_equal(c, @obj.getc)
138
+ end
139
+
140
+ def test_ungetc_after_prefetch
141
+ str = @obj.prefetch_gets
142
+ c = @obj.getc
143
+ assert_nil(@obj.ungetc(c))
144
+ assert_equal(str, @obj.gets)
145
+ end
146
+
147
+ def test_prefetch_buffer
148
+ str = @obj.prefetch_gets
149
+ str += @obj.prefetch_gets
150
+ assert_equal(str, @obj.prefetch_buffer)
151
+ end
152
+
153
+ def test_prefetch_gets
154
+ @obj.prefetch_gets
155
+ @obj.prefetch_gets
156
+ @obj.gets
157
+ str = @obj.prefetch_gets
158
+ @obj.gets
159
+ assert_equal(str, @obj.gets)
160
+ end
161
+
162
+ def test_prefetch_gets_with_arg
163
+ # test @obj.gets
164
+ str = @obj.prefetch_gets("\n>")
165
+ assert_equal(str, @obj.gets("\n>"))
166
+ # test using IO object
167
+ io = @obj.to_io
168
+ io.rewind
169
+ assert_equal(str, io.gets("\n>"))
170
+ end
171
+
172
+ def test_skip_spaces
173
+ @obj.gets('CDS')
174
+ assert_nil(@obj.skip_spaces)
175
+ assert_equal(?a, @obj.getc)
176
+ end
177
+
178
+ end #class TestBufferedInputStream
179
+
180
+ class TestFlatFileWithCustomClass < Test::Unit::TestCase
181
+
182
+ # very simple parser for tab-separated data
183
+ class SimpleFormat
184
+ # delimiter needed for flatfile
185
+ DELIMITER = RS = nil # nil means no delimiter and reading entire file
186
+ def initialize(str)
187
+ @data = str.split(/\n/).collect { |x| x.to_s.split(/\t/) }
188
+ end
189
+ attr_reader :data
190
+ end
191
+
192
+ def test_simpleformat
193
+ testdata = "AAA\tBBB\tCCCCC\tDDDD\n123\t456\n"
194
+ testio = StringIO.new(testdata)
195
+ Bio::FlatFile.open(SimpleFormat, testio) do |ff|
196
+ ff.each do |entry|
197
+ assert_equal([ [ 'AAA', 'BBB', 'CCCCC', 'DDDD' ],
198
+ [ '123', '456' ] ], entry.data)
199
+ end
200
+ end
201
+ end
202
+
203
+ # very simple parser for "//"-separated entries
204
+ class SimpleFormat2
205
+ # delimiter needed for flatfile
206
+ DELIMITER = RS = "//\n" # the end of each entry is "//\n"
207
+ def initialize(str)
208
+ # very simple parser only to store a text data
209
+ @data = str
210
+ end
211
+ attr_reader :data
212
+ end
213
+
214
+ def test_simpleformat2
215
+ testdata = <<__END_OF_TESTDATA__
216
+ test01
217
+ This is a test.
218
+ //
219
+ test02
220
+ This is an example.
221
+ //
222
+ __END_OF_TESTDATA__
223
+ a = testdata.split(/(\/\/\n)/)
224
+ results = [ a[0]+a[1], a[2]+a[3] ]
225
+ testio = StringIO.new(testdata)
226
+ Bio::FlatFile.open(SimpleFormat2, testio) do |ff|
227
+ ff.each do |entry|
228
+ assert_equal(results.shift, entry.data)
229
+ end
230
+ end
231
+ end
232
+
233
+ end #class TestFlatFileWithCustomClass
234
+
235
+ end #module TestFlatFile
236
+
237
+ end #module Bio