bio 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. data/ChangeLog +2105 -3728
  2. data/KNOWN_ISSUES.rdoc +35 -3
  3. data/README.rdoc +8 -2
  4. data/RELEASE_NOTES.rdoc +166 -0
  5. data/bin/bioruby +4 -1
  6. data/bioruby.gemspec +146 -1
  7. data/bioruby.gemspec.erb +3 -1
  8. data/doc/ChangeLog-before-1.3.1 +3961 -0
  9. data/doc/Tutorial.rd +154 -22
  10. data/doc/Tutorial.rd.html +125 -68
  11. data/lib/bio.rb +21 -6
  12. data/lib/bio/appl/bl2seq/report.rb +11 -202
  13. data/lib/bio/appl/blast/format0.rb +0 -193
  14. data/lib/bio/appl/blast/report.rb +2 -147
  15. data/lib/bio/appl/blast/wublast.rb +0 -208
  16. data/lib/bio/appl/fasta.rb +4 -19
  17. data/lib/bio/appl/fasta/format10.rb +0 -14
  18. data/lib/bio/appl/genscan/report.rb +0 -176
  19. data/lib/bio/appl/hmmer.rb +1 -15
  20. data/lib/bio/appl/hmmer/report.rb +0 -100
  21. data/lib/bio/appl/meme/mast.rb +156 -0
  22. data/lib/bio/appl/meme/mast/report.rb +91 -0
  23. data/lib/bio/appl/meme/motif.rb +48 -0
  24. data/lib/bio/appl/psort.rb +0 -111
  25. data/lib/bio/appl/psort/report.rb +1 -45
  26. data/lib/bio/appl/pts1.rb +2 -4
  27. data/lib/bio/appl/sosui/report.rb +5 -54
  28. data/lib/bio/appl/targetp/report.rb +1 -104
  29. data/lib/bio/appl/tmhmm/report.rb +0 -36
  30. data/lib/bio/command.rb +94 -10
  31. data/lib/bio/data/aa.rb +1 -77
  32. data/lib/bio/data/codontable.rb +1 -95
  33. data/lib/bio/data/na.rb +1 -26
  34. data/lib/bio/db/aaindex.rb +1 -38
  35. data/lib/bio/db/fasta.rb +1 -134
  36. data/lib/bio/db/fasta/format_qual.rb +204 -0
  37. data/lib/bio/db/fasta/qual.rb +102 -0
  38. data/lib/bio/db/fastq.rb +645 -0
  39. data/lib/bio/db/fastq/fastq_to_biosequence.rb +40 -0
  40. data/lib/bio/db/fastq/format_fastq.rb +175 -0
  41. data/lib/bio/db/genbank/genbank.rb +1 -86
  42. data/lib/bio/db/gff.rb +0 -17
  43. data/lib/bio/db/go.rb +4 -72
  44. data/lib/bio/db/kegg/common.rb +112 -0
  45. data/lib/bio/db/kegg/compound.rb +29 -20
  46. data/lib/bio/db/kegg/drug.rb +74 -34
  47. data/lib/bio/db/kegg/enzyme.rb +26 -5
  48. data/lib/bio/db/kegg/genes.rb +128 -15
  49. data/lib/bio/db/kegg/genome.rb +3 -41
  50. data/lib/bio/db/kegg/glycan.rb +19 -24
  51. data/lib/bio/db/kegg/orthology.rb +16 -56
  52. data/lib/bio/db/kegg/reaction.rb +81 -28
  53. data/lib/bio/db/kegg/taxonomy.rb +1 -52
  54. data/lib/bio/db/litdb.rb +1 -16
  55. data/lib/bio/db/phyloxml/phyloxml.xsd +582 -0
  56. data/lib/bio/db/phyloxml/phyloxml_elements.rb +1174 -0
  57. data/lib/bio/db/phyloxml/phyloxml_parser.rb +954 -0
  58. data/lib/bio/db/phyloxml/phyloxml_writer.rb +228 -0
  59. data/lib/bio/db/prosite.rb +2 -95
  60. data/lib/bio/db/rebase.rb +5 -6
  61. data/lib/bio/db/sanger_chromatogram/abif.rb +120 -0
  62. data/lib/bio/db/sanger_chromatogram/chromatogram.rb +133 -0
  63. data/lib/bio/db/sanger_chromatogram/chromatogram_to_biosequence.rb +32 -0
  64. data/lib/bio/db/sanger_chromatogram/scf.rb +210 -0
  65. data/lib/bio/io/das.rb +0 -44
  66. data/lib/bio/io/ddbjxml.rb +1 -181
  67. data/lib/bio/io/flatfile.rb +1 -7
  68. data/lib/bio/io/flatfile/autodetection.rb +6 -0
  69. data/lib/bio/io/keggapi.rb +0 -442
  70. data/lib/bio/io/ncbirest.rb +130 -132
  71. data/lib/bio/io/ncbisoap.rb +2 -1
  72. data/lib/bio/io/pubmed.rb +0 -88
  73. data/lib/bio/location.rb +0 -73
  74. data/lib/bio/pathway.rb +0 -171
  75. data/lib/bio/sequence.rb +18 -1
  76. data/lib/bio/sequence/adapter.rb +3 -0
  77. data/lib/bio/sequence/format.rb +16 -0
  78. data/lib/bio/sequence/quality_score.rb +205 -0
  79. data/lib/bio/tree.rb +70 -5
  80. data/lib/bio/util/restriction_enzyme/single_strand.rb +3 -2
  81. data/lib/bio/util/sirna.rb +1 -23
  82. data/lib/bio/version.rb +1 -1
  83. data/sample/demo_aaindex.rb +67 -0
  84. data/sample/demo_aminoacid.rb +101 -0
  85. data/sample/demo_bl2seq_report.rb +220 -0
  86. data/sample/demo_blast_report.rb +285 -0
  87. data/sample/demo_codontable.rb +119 -0
  88. data/sample/demo_das.rb +105 -0
  89. data/sample/demo_ddbjxml.rb +212 -0
  90. data/sample/demo_fasta_remote.rb +51 -0
  91. data/sample/demo_fastaformat.rb +105 -0
  92. data/sample/demo_genbank.rb +132 -0
  93. data/sample/demo_genscan_report.rb +202 -0
  94. data/sample/demo_gff1.rb +49 -0
  95. data/sample/demo_go.rb +98 -0
  96. data/sample/demo_hmmer_report.rb +149 -0
  97. data/sample/demo_kegg_compound.rb +57 -0
  98. data/sample/demo_kegg_drug.rb +65 -0
  99. data/sample/demo_kegg_genome.rb +74 -0
  100. data/sample/demo_kegg_glycan.rb +72 -0
  101. data/sample/demo_kegg_orthology.rb +62 -0
  102. data/sample/demo_kegg_reaction.rb +66 -0
  103. data/sample/demo_kegg_taxonomy.rb +92 -0
  104. data/sample/demo_keggapi.rb +502 -0
  105. data/sample/demo_litdb.rb +42 -0
  106. data/sample/demo_locations.rb +99 -0
  107. data/sample/demo_ncbi_rest.rb +130 -0
  108. data/sample/demo_nucleicacid.rb +49 -0
  109. data/sample/demo_pathway.rb +196 -0
  110. data/sample/demo_prosite.rb +120 -0
  111. data/sample/demo_psort.rb +138 -0
  112. data/sample/demo_psort_report.rb +70 -0
  113. data/sample/demo_pubmed.rb +118 -0
  114. data/sample/demo_sirna.rb +63 -0
  115. data/sample/demo_sosui_report.rb +89 -0
  116. data/sample/demo_targetp_report.rb +135 -0
  117. data/sample/demo_tmhmm_report.rb +68 -0
  118. data/sample/pmfetch.rb +13 -4
  119. data/sample/pmsearch.rb +15 -4
  120. data/sample/test_phyloxml_big.rb +205 -0
  121. data/test/bioruby_test_helper.rb +61 -0
  122. data/test/data/KEGG/1.1.1.1.enzyme +935 -0
  123. data/test/data/KEGG/C00025.compound +102 -0
  124. data/test/data/KEGG/D00063.drug +104 -0
  125. data/test/data/KEGG/G00024.glycan +47 -0
  126. data/test/data/KEGG/G01366.glycan +18 -0
  127. data/test/data/KEGG/K02338.orthology +902 -0
  128. data/test/data/KEGG/R00006.reaction +14 -0
  129. data/test/data/fastq/README.txt +109 -0
  130. data/test/data/fastq/error_diff_ids.fastq +20 -0
  131. data/test/data/fastq/error_double_qual.fastq +22 -0
  132. data/test/data/fastq/error_double_seq.fastq +22 -0
  133. data/test/data/fastq/error_long_qual.fastq +20 -0
  134. data/test/data/fastq/error_no_qual.fastq +20 -0
  135. data/test/data/fastq/error_qual_del.fastq +20 -0
  136. data/test/data/fastq/error_qual_escape.fastq +20 -0
  137. data/test/data/fastq/error_qual_null.fastq +0 -0
  138. data/test/data/fastq/error_qual_space.fastq +21 -0
  139. data/test/data/fastq/error_qual_tab.fastq +21 -0
  140. data/test/data/fastq/error_qual_unit_sep.fastq +20 -0
  141. data/test/data/fastq/error_qual_vtab.fastq +20 -0
  142. data/test/data/fastq/error_short_qual.fastq +20 -0
  143. data/test/data/fastq/error_spaces.fastq +20 -0
  144. data/test/data/fastq/error_tabs.fastq +21 -0
  145. data/test/data/fastq/error_trunc_at_plus.fastq +19 -0
  146. data/test/data/fastq/error_trunc_at_qual.fastq +19 -0
  147. data/test/data/fastq/error_trunc_at_seq.fastq +18 -0
  148. data/test/data/fastq/error_trunc_in_plus.fastq +19 -0
  149. data/test/data/fastq/error_trunc_in_qual.fastq +20 -0
  150. data/test/data/fastq/error_trunc_in_seq.fastq +18 -0
  151. data/test/data/fastq/error_trunc_in_title.fastq +17 -0
  152. data/test/data/fastq/illumina_full_range_as_illumina.fastq +8 -0
  153. data/test/data/fastq/illumina_full_range_as_sanger.fastq +8 -0
  154. data/test/data/fastq/illumina_full_range_as_solexa.fastq +8 -0
  155. data/test/data/fastq/illumina_full_range_original_illumina.fastq +8 -0
  156. data/test/data/fastq/longreads_as_illumina.fastq +40 -0
  157. data/test/data/fastq/longreads_as_sanger.fastq +40 -0
  158. data/test/data/fastq/longreads_as_solexa.fastq +40 -0
  159. data/test/data/fastq/longreads_original_sanger.fastq +120 -0
  160. data/test/data/fastq/misc_dna_as_illumina.fastq +16 -0
  161. data/test/data/fastq/misc_dna_as_sanger.fastq +16 -0
  162. data/test/data/fastq/misc_dna_as_solexa.fastq +16 -0
  163. data/test/data/fastq/misc_dna_original_sanger.fastq +16 -0
  164. data/test/data/fastq/misc_rna_as_illumina.fastq +16 -0
  165. data/test/data/fastq/misc_rna_as_sanger.fastq +16 -0
  166. data/test/data/fastq/misc_rna_as_solexa.fastq +16 -0
  167. data/test/data/fastq/misc_rna_original_sanger.fastq +16 -0
  168. data/test/data/fastq/sanger_full_range_as_illumina.fastq +8 -0
  169. data/test/data/fastq/sanger_full_range_as_sanger.fastq +8 -0
  170. data/test/data/fastq/sanger_full_range_as_solexa.fastq +8 -0
  171. data/test/data/fastq/sanger_full_range_original_sanger.fastq +8 -0
  172. data/test/data/fastq/solexa_full_range_as_illumina.fastq +8 -0
  173. data/test/data/fastq/solexa_full_range_as_sanger.fastq +8 -0
  174. data/test/data/fastq/solexa_full_range_as_solexa.fastq +8 -0
  175. data/test/data/fastq/solexa_full_range_original_solexa.fastq +8 -0
  176. data/test/data/fastq/wrapping_as_illumina.fastq +12 -0
  177. data/test/data/fastq/wrapping_as_sanger.fastq +12 -0
  178. data/test/data/fastq/wrapping_as_solexa.fastq +12 -0
  179. data/test/data/fastq/wrapping_original_sanger.fastq +24 -0
  180. data/test/data/meme/db +0 -0
  181. data/test/data/meme/mast +0 -0
  182. data/test/data/meme/mast.out +13 -0
  183. data/test/data/meme/meme.out +3 -0
  184. data/test/data/phyloxml/apaf.xml +666 -0
  185. data/test/data/phyloxml/bcl_2.xml +2097 -0
  186. data/test/data/phyloxml/made_up.xml +144 -0
  187. data/test/data/phyloxml/ncbi_taxonomy_mollusca_short.xml +65 -0
  188. data/test/data/phyloxml/phyloxml_examples.xml +415 -0
  189. data/test/data/sanger_chromatogram/test_chromatogram_abif.ab1 +0 -0
  190. data/test/data/sanger_chromatogram/test_chromatogram_scf_v2.scf +0 -0
  191. data/test/data/sanger_chromatogram/test_chromatogram_scf_v3.scf +0 -0
  192. data/test/functional/bio/appl/test_pts1.rb +7 -5
  193. data/test/functional/bio/io/test_ensembl.rb +4 -3
  194. data/test/functional/bio/io/test_pubmed.rb +9 -3
  195. data/test/functional/bio/io/test_soapwsdl.rb +5 -4
  196. data/test/functional/bio/io/test_togows.rb +5 -4
  197. data/test/functional/bio/sequence/test_output_embl.rb +6 -4
  198. data/test/functional/bio/test_command.rb +54 -5
  199. data/test/runner.rb +5 -3
  200. data/test/unit/bio/appl/bl2seq/test_report.rb +5 -4
  201. data/test/unit/bio/appl/blast/test_ncbioptions.rb +4 -2
  202. data/test/unit/bio/appl/blast/test_report.rb +5 -4
  203. data/test/unit/bio/appl/blast/test_rpsblast.rb +5 -4
  204. data/test/unit/bio/appl/gcg/test_msf.rb +5 -5
  205. data/test/unit/bio/appl/genscan/test_report.rb +8 -9
  206. data/test/unit/bio/appl/hmmer/test_report.rb +5 -4
  207. data/test/unit/bio/appl/iprscan/test_report.rb +6 -5
  208. data/test/unit/bio/appl/mafft/test_report.rb +6 -5
  209. data/test/unit/bio/appl/meme/mast/test_report.rb +46 -0
  210. data/test/unit/bio/appl/meme/test_mast.rb +103 -0
  211. data/test/unit/bio/appl/meme/test_motif.rb +38 -0
  212. data/test/unit/bio/appl/paml/codeml/test_rates.rb +5 -4
  213. data/test/unit/bio/appl/paml/codeml/test_report.rb +5 -4
  214. data/test/unit/bio/appl/paml/test_codeml.rb +5 -4
  215. data/test/unit/bio/appl/sim4/test_report.rb +5 -4
  216. data/test/unit/bio/appl/sosui/test_report.rb +6 -5
  217. data/test/unit/bio/appl/targetp/test_report.rb +5 -3
  218. data/test/unit/bio/appl/test_blast.rb +5 -4
  219. data/test/unit/bio/appl/test_fasta.rb +4 -2
  220. data/test/unit/bio/appl/test_pts1.rb +4 -2
  221. data/test/unit/bio/appl/tmhmm/test_report.rb +6 -5
  222. data/test/unit/bio/data/test_aa.rb +5 -3
  223. data/test/unit/bio/data/test_codontable.rb +5 -4
  224. data/test/unit/bio/data/test_na.rb +5 -3
  225. data/test/unit/bio/db/biosql/tc_biosql.rb +5 -1
  226. data/test/unit/bio/db/embl/test_common.rb +4 -2
  227. data/test/unit/bio/db/embl/test_embl.rb +6 -6
  228. data/test/unit/bio/db/embl/test_embl_rel89.rb +6 -6
  229. data/test/unit/bio/db/embl/test_embl_to_bioseq.rb +7 -8
  230. data/test/unit/bio/db/embl/test_sptr.rb +6 -8
  231. data/test/unit/bio/db/embl/test_uniprot.rb +6 -5
  232. data/test/unit/bio/db/fasta/test_format_qual.rb +346 -0
  233. data/test/unit/bio/db/kegg/test_compound.rb +146 -0
  234. data/test/unit/bio/db/kegg/test_drug.rb +194 -0
  235. data/test/unit/bio/db/kegg/test_enzyme.rb +241 -0
  236. data/test/unit/bio/db/kegg/test_genes.rb +32 -4
  237. data/test/unit/bio/db/kegg/test_glycan.rb +260 -0
  238. data/test/unit/bio/db/kegg/test_orthology.rb +50 -0
  239. data/test/unit/bio/db/kegg/test_reaction.rb +96 -0
  240. data/test/unit/bio/db/pdb/test_pdb.rb +4 -2
  241. data/test/unit/bio/db/sanger_chromatogram/test_abif.rb +76 -0
  242. data/test/unit/bio/db/sanger_chromatogram/test_scf.rb +98 -0
  243. data/test/unit/bio/db/test_aaindex.rb +6 -6
  244. data/test/unit/bio/db/test_fasta.rb +5 -46
  245. data/test/unit/bio/db/test_fastq.rb +829 -0
  246. data/test/unit/bio/db/test_gff.rb +4 -2
  247. data/test/unit/bio/db/test_lasergene.rb +7 -5
  248. data/test/unit/bio/db/test_medline.rb +4 -2
  249. data/test/unit/bio/db/test_newick.rb +6 -6
  250. data/test/unit/bio/db/test_nexus.rb +4 -2
  251. data/test/unit/bio/db/test_phyloxml.rb +769 -0
  252. data/test/unit/bio/db/test_phyloxml_writer.rb +328 -0
  253. data/test/unit/bio/db/test_prosite.rb +6 -5
  254. data/test/unit/bio/db/test_qual.rb +63 -0
  255. data/test/unit/bio/db/test_rebase.rb +5 -3
  256. data/test/unit/bio/db/test_soft.rb +7 -6
  257. data/test/unit/bio/io/flatfile/test_autodetection.rb +6 -7
  258. data/test/unit/bio/io/flatfile/test_buffer.rb +6 -5
  259. data/test/unit/bio/io/flatfile/test_splitter.rb +4 -4
  260. data/test/unit/bio/io/test_ddbjxml.rb +4 -3
  261. data/test/unit/bio/io/test_ensembl.rb +5 -3
  262. data/test/unit/bio/io/test_fastacmd.rb +4 -3
  263. data/test/unit/bio/io/test_flatfile.rb +6 -5
  264. data/test/unit/bio/io/test_soapwsdl.rb +4 -3
  265. data/test/unit/bio/io/test_togows.rb +4 -2
  266. data/test/unit/bio/sequence/test_aa.rb +5 -3
  267. data/test/unit/bio/sequence/test_common.rb +4 -2
  268. data/test/unit/bio/sequence/test_compat.rb +4 -2
  269. data/test/unit/bio/sequence/test_dblink.rb +5 -3
  270. data/test/unit/bio/sequence/test_na.rb +4 -2
  271. data/test/unit/bio/sequence/test_quality_score.rb +330 -0
  272. data/test/unit/bio/shell/plugin/test_seq.rb +5 -3
  273. data/test/unit/bio/test_alignment.rb +5 -3
  274. data/test/unit/bio/test_command.rb +4 -3
  275. data/test/unit/bio/test_db.rb +5 -3
  276. data/test/unit/bio/test_feature.rb +4 -2
  277. data/test/unit/bio/test_location.rb +4 -2
  278. data/test/unit/bio/test_map.rb +5 -3
  279. data/test/unit/bio/test_pathway.rb +4 -2
  280. data/test/unit/bio/test_reference.rb +4 -2
  281. data/test/unit/bio/test_sequence.rb +5 -3
  282. data/test/unit/bio/test_shell.rb +5 -3
  283. data/test/unit/bio/test_tree.rb +6 -6
  284. data/test/unit/bio/util/restriction_enzyme/analysis/test_calculated_cuts.rb +4 -2
  285. data/test/unit/bio/util/restriction_enzyme/analysis/test_cut_ranges.rb +4 -2
  286. data/test/unit/bio/util/restriction_enzyme/analysis/test_sequence_range.rb +4 -2
  287. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_aligned_strands.rb +4 -2
  288. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair.rb +4 -2
  289. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_location_pair_in_enzyme_notation.rb +4 -2
  290. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations.rb +4 -2
  291. data/test/unit/bio/util/restriction_enzyme/double_stranded/test_cut_locations_in_enzyme_notation.rb +4 -2
  292. data/test/unit/bio/util/restriction_enzyme/single_strand/test_cut_locations_in_enzyme_notation.rb +4 -2
  293. data/test/unit/bio/util/restriction_enzyme/test_analysis.rb +4 -2
  294. data/test/unit/bio/util/restriction_enzyme/test_cut_symbol.rb +4 -2
  295. data/test/unit/bio/util/restriction_enzyme/test_double_stranded.rb +4 -2
  296. data/test/unit/bio/util/restriction_enzyme/test_single_strand.rb +17 -13
  297. data/test/unit/bio/util/restriction_enzyme/test_single_strand_complement.rb +17 -13
  298. data/test/unit/bio/util/restriction_enzyme/test_string_formatting.rb +4 -2
  299. data/test/unit/bio/util/test_color_scheme.rb +5 -3
  300. data/test/unit/bio/util/test_contingency_table.rb +5 -3
  301. data/test/unit/bio/util/test_restriction_enzyme.rb +4 -2
  302. data/test/unit/bio/util/test_sirna.rb +6 -4
  303. metadata +147 -2
@@ -0,0 +1,285 @@
1
+ #
2
+ # = sample/demo_blast_report.rb - demonstration of Bio::Blast::Report, Bio::Blast::Default::Report, and Bio::Blast::WU::Report
3
+ #
4
+ # Copyright:: Copyright (C) 2003 Toshiaki Katayama <k@bioruby.org>
5
+ # Copyright:: Copyright (C) 2003-2006,2008-2009 Naohisa Goto <ng@bioruby.org>
6
+ # License:: The Ruby License
7
+ #
8
+ #
9
+ # == Description
10
+ #
11
+ # Demonstration of Bio::Blast::Report (NCBI BLAST XML format parser),
12
+ # Bio::Blast::Default::Report (NCBI BLAST default (-m 0) format parser),
13
+ # and Bio::Blast::WU::Report (WU-BLAST default format parser).
14
+ #
15
+ # == Usage
16
+ #
17
+ # Specify files containing BLAST results.
18
+ #
19
+ # $ ruby demo_blast_report.rb files...
20
+ #
21
+ # Example usage using test data:
22
+ #
23
+ # $ ruby -Ilib sample/demo_blast_report.rb test/data/blast/b0002.faa.m7
24
+ # $ ruby -Ilib sample/demo_blast_report.rb test/data/blast/b0002.faa.m0
25
+ #
26
+ # == Development information
27
+ #
28
+ # The code was moved from lib/bio/appl/blast/report.rb,
29
+ # lib/bio/appl/blast/format0.rb, and lib/bio/appl/blast/wublast.rb,
30
+ # and modified.
31
+ #
32
+
33
+ require 'bio'
34
+
35
+ # dummpy class to return specific object
36
+ class Dummy
37
+ def initialize(obj)
38
+ @obj = obj
39
+ end
40
+ def size
41
+ @obj
42
+ end
43
+ def inspect
44
+ @obj.inspect
45
+ end
46
+ end #class Dummy
47
+
48
+ # wrapper class to ignore error
49
+ class Wrapper
50
+ def initialize(obj)
51
+ @obj = obj
52
+ end
53
+ def class
54
+ @obj.class
55
+ end
56
+ def respond_to?(*arg)
57
+ @obj.respond_to?(*arg)
58
+ end
59
+ def method_missing(meth, *arg, &block)
60
+ begin
61
+ @obj.__send__(meth, *arg, &block)
62
+ rescue NoMethodError => evar
63
+ Dummy.new(evar)
64
+ end
65
+ end
66
+ end #class Wrapper
67
+
68
+ def wrap(obj)
69
+ Wrapper.new(obj)
70
+ end
71
+
72
+ # -m0: not defined in Bio::Blast::Default::Report ???
73
+ # +m0: newly added in Bio::Blast::Default::Report ???
74
+ # -WU: not defined in Bio::Blast::WU::Report ???
75
+ # +WU: newly added in Bio::Blast::WU::Report ???
76
+
77
+ Bio::FlatFile.open(ARGF) do |ff|
78
+ puts "Detected file format: #{ff.dbclass}"
79
+ unless ff.dbclass then
80
+ ff.dbclass = Bio::Blast::Report
81
+ puts "Input data may be tab-delimited format (-m 8)."
82
+ end
83
+ ff.each do |rep|
84
+ rep = wrap(rep)
85
+
86
+ #print "# === Bio::Blast::Default::Report\n"
87
+ print "# === #{rep.class}\n"
88
+ puts
89
+ print " rep.program #=> "; p rep.program
90
+ print " rep.version #=> "; p rep.version
91
+ print " rep.reference #=> "; p rep.reference
92
+ print " rep.notice [WU] #=> "; p rep.notice #+WU
93
+ print " rep.db #=> "; p rep.db
94
+ print " rep.query_id #=> "; p rep.query_id #-m0,-WU
95
+ print " rep.query_def #=> "; p rep.query_def
96
+ print " rep.query_len #=> "; p rep.query_len
97
+ #puts
98
+ print " rep.version_number #=> "; p rep.version_number #+m0,+WU
99
+ print " rep.version_date #=> "; p rep.version_date #+m0,+WU
100
+ puts
101
+
102
+ print "# === Parameters\n"
103
+ #puts
104
+ print " rep.parameters #=> "; p rep.parameters #-m0
105
+ puts
106
+ print " rep.matrix #=> "; p rep.matrix #-WU
107
+ print " rep.expect #=> "; p rep.expect
108
+ print " rep.inclusion #=> "; p rep.inclusion #-m0,-WU
109
+ print " rep.sc_match #=> "; p rep.sc_match #-WU
110
+ print " rep.sc_mismatch #=> "; p rep.sc_mismatch #-WU
111
+ print " rep.gap_open #=> "; p rep.gap_open #-WU
112
+ print " rep.gap_extend #=> "; p rep.gap_extend #-WU
113
+ print " rep.filter #=> "; p rep.filter #-m0,-WU
114
+ print " rep.pattern #=> "; p rep.pattern #-WU
115
+ print " rep.entrez_query #=> "; p rep.entrez_query #-m0
116
+ #puts
117
+ print " rep.pattern_positions #=> "; p rep.pattern_positions #+m0
118
+ puts
119
+
120
+ print "# === Statistics (last iteration's)\n"
121
+ #puts
122
+ print " rep.statistics #=> "; p rep.statistics #-m0,-WU
123
+ puts
124
+ print " rep.db_num #=> "; p rep.db_num
125
+ print " rep.db_len #=> "; p rep.db_len
126
+ print " rep.hsp_len #=> "; p rep.hsp_len #-m0,-WU
127
+ print " rep.eff_space #=> "; p rep.eff_space #-WU
128
+ print " rep.kappa #=> "; p rep.kappa #-WU
129
+ print " rep.lambda #=> "; p rep.lambda #-WU
130
+ print " rep.entropy #=> "; p rep.entropy #-WU
131
+ puts
132
+ print " rep.num_hits #=> "; p rep.num_hits #+m0
133
+ print " rep.gapped_kappa #=> "; p rep.gapped_kappa #+m0
134
+ print " rep.gapped_lambda #=> "; p rep.gapped_lambda #+m0
135
+ print " rep.gapped_entropy #=> "; p rep.gapped_entropy #+m0
136
+ print " rep.posted_date #=> "; p rep.posted_date #+m0
137
+ puts
138
+
139
+ print "# === Message (last iteration's)\n"
140
+ puts
141
+ print " rep.message #=> "; p rep.message #-WU
142
+ #puts
143
+ print " rep.converged? #=> "; p rep.converged? #+m0
144
+ puts
145
+
146
+ print "# === Warning messages\n"
147
+ print " rep.warnings [WU] #=> "; p rep.warnings #+WU
148
+
149
+ print "# === Iterations\n"
150
+ puts
151
+ print " rep.itrerations.each do |itr|\n"
152
+ puts
153
+
154
+ rep.iterations.each do |itr|
155
+ itr = wrap(itr)
156
+
157
+ #print "# --- Bio::Blast::Default::Report::Iteration\n"
158
+ print "# --- #{itr.class}\n"
159
+ puts
160
+
161
+ print " itr.num #=> "; p itr.num
162
+ print " itr.statistics #=> "; p itr.statistics #-m0,-WU
163
+ print " itr.warnings [WU] #=> "; p itr.warnings #+WU
164
+ print " itr.message #=> "; p itr.message
165
+ print " itr.hits.size #=> "; p itr.hits.size
166
+ #puts
167
+ print " itr.hits_newly_found.size #=> "; p((itr.hits_newly_found.size rescue nil)); #+m0
168
+ print " itr.hits_found_again.size #=> "; p((itr.hits_found_again.size rescue nil)); #+m0
169
+ if itr.respond_to?(:hits_for_pattern) and itr.hits_for_pattern then #+m0
170
+ itr.hits_for_pattern.each_with_index do |hp, hpi|
171
+ print " itr.hits_for_pattern[#{hpi}].size #=> "; p hp.size;
172
+ end
173
+ end
174
+ print " itr.converged? #=> "; p itr.converged? #+m0,+WU
175
+ puts
176
+
177
+ print " itr.hits.each do |hit|\n"
178
+ puts
179
+
180
+ itr.hits.each_with_index do |hit, i|
181
+ hit = wrap(hit)
182
+
183
+ #print "# --- Bio::Blast::Default::Report::Hit"
184
+ print "# --- #{hit.class}"
185
+ print " ([#{i}])\n"
186
+ puts
187
+
188
+ print " hit.num #=> "; p hit.num #-m0,-WU
189
+ print " hit.hit_id #=> "; p hit.hit_id #-m0,-WU
190
+ print " hit.len #=> "; p hit.len
191
+ print " hit.definition #=> "; p hit.definition
192
+ print " hit.accession #=> "; p hit.accession #-m0,-WU
193
+ #puts
194
+ print " hit.found_again? #=> "; p hit.found_again? #+m0,+WU
195
+ print " hit.score [WU] #=> "; p hit.score #+WU
196
+ print " hit.pvalue [WU] #=> "; p hit.pvalue #+WU
197
+ print " hit.n_number [WU] #=> "; p hit.n_number #+WU
198
+
199
+ print " --- compatible/shortcut ---\n"
200
+ print " hit.query_id #=> "; p hit.query_id #-m0,-WU
201
+ print " hit.query_def #=> "; p hit.query_def #-m0,-WU
202
+ print " hit.query_len #=> "; p hit.query_len #-m0,-WU
203
+ print " hit.target_id #=> "; p hit.target_id #-m0,-WU
204
+ print " hit.target_def #=> "; p hit.target_def
205
+ print " hit.target_len #=> "; p hit.target_len
206
+
207
+ print " --- first HSP's values (shortcut) ---\n"
208
+ print " hit.evalue #=> "; p hit.evalue
209
+ print " hit.bit_score #=> "; p hit.bit_score
210
+ print " hit.identity #=> "; p hit.identity
211
+ print " hit.overlap #=> "; p hit.overlap #-m0,-WU
212
+
213
+ print " hit.query_seq #=> "; p hit.query_seq
214
+ print " hit.midline #=> "; p hit.midline
215
+ print " hit.target_seq #=> "; p hit.target_seq
216
+
217
+ print " hit.query_start #=> "; p hit.query_start
218
+ print " hit.query_end #=> "; p hit.query_end
219
+ print " hit.target_start #=> "; p hit.target_start
220
+ print " hit.target_end #=> "; p hit.target_end
221
+ print " hit.lap_at #=> "; p hit.lap_at
222
+ print " --- first HSP's vaules (shortcut) ---\n"
223
+ print " --- compatible/shortcut ---\n"
224
+
225
+ puts
226
+ print " hit.hsps.size #=> "; p hit.hsps.size
227
+ if hit.hsps.size == 0 then
228
+ puts " (HSP not found: please see blastall's -b and -v options)"
229
+ puts
230
+ else
231
+
232
+ puts
233
+ print " hit.hsps.each do |hsp|\n"
234
+ puts
235
+
236
+ hit.hsps.each_with_index do |hsp, j|
237
+ hsp = wrap(hsp)
238
+
239
+ #print "# --- Bio::Blast::Default::Report::Hsp"
240
+ print "# --- #{hsp.class}"
241
+ print " ([#{j}])\n"
242
+ puts
243
+ print " hsp.num #=> "; p hsp.num #-m0,-WU
244
+ print " hsp.bit_score #=> "; p hsp.bit_score
245
+ print " hsp.score #=> "; p hsp.score
246
+ print " hsp.evalue #=> "; p hsp.evalue
247
+ print " hsp.identity #=> "; p hsp.identity
248
+ print " hsp.gaps #=> "; p hsp.gaps
249
+ print " hsp.positive #=> "; p hsp.positive
250
+ print " hsp.align_len #=> "; p hsp.align_len
251
+ print " hsp.density #=> "; p hsp.density #-m0,-WU
252
+ print " hsp.pvalue [WU]#=> "; p hsp.pvalue #+WU
253
+ print " hsp.p_sum_n [WU]#=> "; p hsp.p_sum_n #+WU
254
+
255
+ print " hsp.query_frame #=> "; p hsp.query_frame
256
+ print " hsp.query_from #=> "; p hsp.query_from
257
+ print " hsp.query_to #=> "; p hsp.query_to
258
+
259
+ print " hsp.hit_frame #=> "; p hsp.hit_frame
260
+ print " hsp.hit_from #=> "; p hsp.hit_from
261
+ print " hsp.hit_to #=> "; p hsp.hit_to
262
+
263
+ print " hsp.pattern_from#=> "; p hsp.pattern_from #-m0,-WU
264
+ print " hsp.pattern_to #=> "; p hsp.pattern_to #-m0,-WU
265
+
266
+ print " hsp.qseq #=> "; p hsp.qseq
267
+ print " hsp.midline #=> "; p hsp.midline
268
+ print " hsp.hseq #=> "; p hsp.hseq
269
+ puts
270
+ print " hsp.percent_identity #=> "; p hsp.percent_identity
271
+ print " hsp.mismatch_count #=> "; p hsp.mismatch_count #-m0,-WU
272
+ #
273
+ print " hsp.query_strand #=> "; p hsp.query_strand #+m0,+WU
274
+ print " hsp.hit_strand #=> "; p hsp.hit_strand #+m0,+WU
275
+ print " hsp.percent_positive #=> "; p hsp.percent_positive #+m0,+WU
276
+ print " hsp.percent_gaps #=> "; p hsp.percent_gaps #+m0,+WU
277
+ puts
278
+
279
+ end #each
280
+ end #if hit.hsps.size == 0
281
+ end
282
+ end
283
+ end #ff.each
284
+ end #Bio::FlatFile.open
285
+
@@ -0,0 +1,119 @@
1
+ #
2
+ # = sample/demo_codontable.rb - demonstration of Bio::CodonTable
3
+ #
4
+ # Copyright:: Copyright (C) 2001, 2004
5
+ # Toshiaki Katayama <k@bioruby.org>
6
+ # License:: The Ruby License
7
+ #
8
+ #
9
+ # == Description
10
+ #
11
+ # Demonstration of Bio::CodonTable.
12
+ #
13
+ # == Usage
14
+ #
15
+ # Simply run this script.
16
+ #
17
+ # $ ruby demo_codontable.rb
18
+ #
19
+ # == Development information
20
+ #
21
+ # The code was moved from lib/bio/data/codontable.rb.
22
+ #
23
+
24
+ require 'bio'
25
+
26
+
27
+ #if __FILE__ == $0
28
+
29
+ begin
30
+ require 'pp'
31
+ alias p pp
32
+ rescue LoadError
33
+ end
34
+
35
+ puts "### Bio::CodonTable[1]"
36
+ p ct1 = Bio::CodonTable[1]
37
+
38
+ puts ">>> Bio::CodonTable#table"
39
+ p ct1.table
40
+
41
+ puts ">>> Bio::CodonTable#each"
42
+ ct1.each do |codon, aa|
43
+ puts "#{codon} -- #{aa}"
44
+ end
45
+
46
+ puts ">>> Bio::CodonTable#definition"
47
+ p ct1.definition
48
+
49
+ puts ">>> Bio::CodonTable#['atg']"
50
+ p ct1['atg']
51
+
52
+ puts ">>> Bio::CodonTable#revtrans('A')"
53
+ p ct1.revtrans('A')
54
+
55
+ puts ">>> Bio::CodonTable#start_codon?('atg')"
56
+ p ct1.start_codon?('atg')
57
+
58
+ puts ">>> Bio::CodonTable#start_codon?('aaa')"
59
+ p ct1.start_codon?('aaa')
60
+
61
+ puts ">>> Bio::CodonTable#stop_codon?('tag')"
62
+ p ct1.stop_codon?('tag')
63
+
64
+ puts ">>> Bio::CodonTable#stop_codon?('aaa')"
65
+ p ct1.stop_codon?('aaa')
66
+
67
+ puts ">>> ct1_copy = Bio::CodonTable.copy(1)"
68
+ p ct1_copy = Bio::CodonTable.copy(1)
69
+ puts ">>> ct1_copy['tga'] = 'U'"
70
+ p ct1_copy['tga'] = 'U'
71
+ puts " orig : #{ct1['tga']}"
72
+ puts " copy : #{ct1_copy['tga']}"
73
+
74
+
75
+ puts "### ct = Bio::CodonTable.new(hash, definition)"
76
+ hash = {
77
+ 'ttt' => 'F', 'tct' => 'S', 'tat' => 'Y', 'tgt' => 'C',
78
+ 'ttc' => 'F', 'tcc' => 'S', 'tac' => 'Y', 'tgc' => 'C',
79
+ 'tta' => 'L', 'tca' => 'S', 'taa' => '*', 'tga' => 'U',
80
+ 'ttg' => 'L', 'tcg' => 'S', 'tag' => '*', 'tgg' => 'W',
81
+
82
+ 'ctt' => 'L', 'cct' => 'P', 'cat' => 'H', 'cgt' => 'R',
83
+ 'ctc' => 'L', 'ccc' => 'P', 'cac' => 'H', 'cgc' => 'R',
84
+ 'cta' => 'L', 'cca' => 'P', 'caa' => 'Q', 'cga' => 'R',
85
+ 'ctg' => 'L', 'ccg' => 'P', 'cag' => 'Q', 'cgg' => 'R',
86
+
87
+ 'att' => 'I', 'act' => 'T', 'aat' => 'N', 'agt' => 'S',
88
+ 'atc' => 'I', 'acc' => 'T', 'aac' => 'N', 'agc' => 'S',
89
+ 'ata' => 'I', 'aca' => 'T', 'aaa' => 'K', 'aga' => 'R',
90
+ 'atg' => 'M', 'acg' => 'T', 'aag' => 'K', 'agg' => 'R',
91
+
92
+ 'gtt' => 'V', 'gct' => 'A', 'gat' => 'D', 'ggt' => 'G',
93
+ 'gtc' => 'V', 'gcc' => 'A', 'gac' => 'D', 'ggc' => 'G',
94
+ 'gta' => 'V', 'gca' => 'A', 'gaa' => 'E', 'gga' => 'G',
95
+ 'gtg' => 'V', 'gcg' => 'A', 'gag' => 'E', 'ggg' => 'G',
96
+ }
97
+ my_ct = Bio::CodonTable.new(hash, "my codon table")
98
+
99
+ puts ">>> ct.definition"
100
+ puts my_ct.definition
101
+
102
+ puts ">>> ct.definition=(str)"
103
+ my_ct.definition = "selenoproteins (Eukaryote)"
104
+ puts my_ct.definition
105
+
106
+ puts ">>> ct['tga']"
107
+ puts my_ct['tga']
108
+
109
+ puts ">>> ct.revtrans('U')"
110
+ puts my_ct.revtrans('U')
111
+
112
+ puts ">>> ct.stop_codon?('tga')"
113
+ puts my_ct.stop_codon?('tga')
114
+
115
+ puts ">>> ct.stop_codon?('tag')"
116
+ puts my_ct.stop_codon?('tag')
117
+
118
+ #end
119
+
@@ -0,0 +1,105 @@
1
+ #
2
+ # = sample/demo_go.rb - demonstration of Bio::DAS, BioDAS access module
3
+ #
4
+ # Copyright:: Copyright (C) 2003, 2004, 2007
5
+ # Shuichi Kawashima <shuichi@hgc.jp>,
6
+ # Toshiaki Katayama <k@bioruby.org>
7
+ # License:: The Ruby License
8
+ #
9
+ #
10
+ # == Description
11
+ #
12
+ # Demonstration of Bio::GO, BioDAS access module.
13
+ #
14
+ # == Requirements
15
+ #
16
+ # Internet connection is needed.
17
+ #
18
+ # == Usage
19
+ #
20
+ # Simply run this script.
21
+ #
22
+ # $ ruby demo_das.rb
23
+ #
24
+ # == Notes
25
+ #
26
+ # Demo using the WormBase DAS server is temporarily disabled because
27
+ # it does not work well possibly because of the server trouble.
28
+ #
29
+ # == Development information
30
+ #
31
+ # The code was moved from lib/bio/io/das.rb and modified as below:
32
+ #
33
+ # * Demo codes using UCSC DAS server is added.
34
+ #
35
+
36
+ require 'bio'
37
+
38
+ # begin
39
+ # require 'pp'
40
+ # alias p pp
41
+ # rescue LoadError
42
+ # end
43
+
44
+ if false #disabled
45
+ puts "### WormBase"
46
+ wormbase = Bio::DAS.new('http://www.wormbase.org/db/')
47
+
48
+ puts ">>> test get_dsn"
49
+ p wormbase.get_dsn
50
+
51
+ puts ">>> create segment obj Bio::DAS::SEGMENT.region('I', 1, 1000)"
52
+ seg = Bio::DAS::SEGMENT.region('I', 1, 1000)
53
+ p seg
54
+
55
+ puts ">>> test get_dna"
56
+ p wormbase.get_dna('elegans', seg)
57
+
58
+ puts "### test get_features"
59
+ p wormbase.get_features('elegans', seg)
60
+ end #if false #disabled
61
+
62
+ if true #enabled
63
+ puts "### UCSC"
64
+ ucsc = Bio::DAS.new('http://genome.ucsc.edu/cgi-bin/')
65
+
66
+ puts ">>> test get_dsn"
67
+ p ucsc.get_dsn
68
+
69
+ puts ">>> test get_entry_points('hg19')"
70
+ p ucsc.get_entry_points('hg19')
71
+
72
+ puts ">>> test get_types('hg19')"
73
+ p ucsc.get_types('hg19')
74
+
75
+ len = rand(50) * 10 + 100
76
+ pos = rand(243199373 - len)
77
+ puts ">>> create segment obj Bio::DAS::SEGMENT.region('2', #{pos}, #{pos + len - 1})"
78
+ seg2 = Bio::DAS::SEGMENT.region('2', pos, pos + len - 1)
79
+ p seg2
80
+
81
+ puts ">>> test get_dna"
82
+ p ucsc.get_dna('hg19', seg2)
83
+
84
+ puts "### test get_features"
85
+ p ucsc.get_features('hg19', seg2)
86
+ end #if true #enabled
87
+
88
+ if true #enabled
89
+ puts "### KEGG DAS"
90
+ kegg_das = Bio::DAS.new("http://das.hgc.jp/cgi-bin/")
91
+
92
+ dsn_list = kegg_das.get_dsn
93
+ org_list = dsn_list.collect {|x| x.source}
94
+
95
+ puts ">>> dsn : entry_points"
96
+ org_list.each do |org|
97
+ print "#{org} : "
98
+ list = kegg_das.get_entry_points(org)
99
+ list.segments.each do |seg|
100
+ print " #{seg.entry_id}"
101
+ end
102
+ puts
103
+ end
104
+ end #if true #enabled
105
+