bio 1.3.1 → 1.4.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 (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
@@ -4,14 +4,15 @@
4
4
  # Copyright:: Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
5
5
  # License:: The Ruby License
6
6
  #
7
- # $Id: test_codontable.rb,v 1.6 2007/04/05 23:35:43 trevor Exp $
7
+ # $Id:$
8
8
  #
9
9
 
10
+ # loading helper routine for testing bioruby
10
11
  require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
13
-
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
14
14
 
15
+ # libraries needed for the tests
15
16
  require 'test/unit'
16
17
  require 'bio/data/codontable'
17
18
 
@@ -4,13 +4,15 @@
4
4
  # Copyright:: Copyright (C) 2005,2006 Mitsuteru Nakao <n@bioruby.org>
5
5
  # License:: The Ruby License
6
6
  #
7
- # $Id: test_na.rb,v 1.9 2007/04/05 23:35:43 trevor Exp $
7
+ # $Id:$
8
8
  #
9
9
 
10
+ # loading helper routine for testing bioruby
10
11
  require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
13
14
 
15
+ # libraries needed for the tests
14
16
  require 'test/unit'
15
17
  require 'bio/data/na'
16
18
 
@@ -1,8 +1,12 @@
1
1
  # To change this template, choose Tools | Templates
2
2
  # and open the template in the editor.
3
3
 
4
- $:.unshift File.join(File.dirname(__FILE__),'..','lib')
4
+ # loading helper routine for testing bioruby
5
+ require 'pathname'
6
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
7
+ 'bioruby_test_helper.rb')).cleanpath.to_s
5
8
 
9
+ # libraries needed for the tests
6
10
  require 'test/unit'
7
11
  require 'bio'
8
12
 
@@ -7,10 +7,12 @@
7
7
  # $Id:$
8
8
  #
9
9
 
10
+ # loading helper routine for testing bioruby
10
11
  require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
13
14
 
15
+ # libraries needed for the tests
14
16
  require 'test/unit'
15
17
  require 'bio/db/embl/common'
16
18
 
@@ -4,14 +4,15 @@
4
4
  # Copyright:: Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
5
5
  # License:: The Ruby License
6
6
  #
7
- # $Id: test_embl.rb,v 1.5.2.1 2008/02/20 09:56:22 aerts Exp $
7
+ # $Id:$
8
8
  #
9
9
 
10
+ # loading helper routine for testing bioruby
10
11
  require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
13
-
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
14
14
 
15
+ # libraries needed for the tests
15
16
  require 'test/unit'
16
17
  require 'bio/db/embl/embl'
17
18
 
@@ -19,8 +20,7 @@ module Bio
19
20
  class TestEMBL < Test::Unit::TestCase
20
21
 
21
22
  def setup
22
- bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
23
- output = File.open(File.join(bioruby_root, 'test', 'data', 'embl', 'AB090716.embl')).read
23
+ output = File.read(File.join(BioRubyTestDataPath, 'embl', 'AB090716.embl'))
24
24
  @obj = Bio::EMBL.new(output)
25
25
  end
26
26
 
@@ -4,14 +4,15 @@
4
4
  # Copyright:: Copyright (C) 2007 Mitsuteru Nakao <n@bioruby.org>
5
5
  # License:: The Ruby License
6
6
  #
7
- # $Id: test_embl_rel89.rb,v 1.2.2.1 2008/02/20 09:56:22 aerts Exp $
7
+ # $Id:$
8
8
  #
9
9
 
10
+ # loading helper routine for testing bioruby
10
11
  require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
13
-
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
14
14
 
15
+ # libraries needed for the tests
15
16
  require 'test/unit'
16
17
  require 'bio/db/embl/embl'
17
18
 
@@ -19,8 +20,7 @@ module Bio
19
20
  class TestEMBL89 < Test::Unit::TestCase
20
21
 
21
22
  def setup
22
- bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
23
- output = File.open(File.join(bioruby_root, 'test', 'data', 'embl', 'AB090716.embl.rel89')).read
23
+ output = File.read(File.join(BioRubyTestDataPath, 'embl', 'AB090716.embl.rel89'))
24
24
  @obj = Bio::EMBL.new(output)
25
25
  end
26
26
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # test/unit/bio/db/embl/test_embl.rb - Unit test for Bio::EMBL
2
+ # test/unit/bio/db/embl/test_embl_to_bioseq.rb - Unit test for Bio::EMBL to Bio::Sequence data converter
3
3
  #
4
4
  # Copyright:: Copyright (C) 2005, 2008
5
5
  # Mitsuteru Nakao <n@bioruby.org>
@@ -9,20 +9,20 @@
9
9
  # $Id:$
10
10
  #
11
11
 
12
+ # loading helper routine for testing bioruby
12
13
  require 'pathname'
13
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
14
- $:.unshift(libpath) unless $:.include?(libpath)
14
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
15
+ 'bioruby_test_helper.rb')).cleanpath.to_s
15
16
 
17
+ # libraries needed for the tests
16
18
  require 'test/unit'
17
- require 'bio'
18
19
  require 'bio/db/embl/embl'
19
20
 
20
21
  module Bio
21
22
  class TestEMBLToBioSequence < Test::Unit::TestCase
22
23
 
23
24
  def setup
24
- bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
25
- input = File.open(File.join(bioruby_root, 'test', 'data', 'embl', 'AB090716.embl.rel89')).read
25
+ input = File.read(File.join(BioRubyTestDataPath, 'embl', 'AB090716.embl.rel89'))
26
26
  embl_object = Bio::EMBL.new(input)
27
27
  embl_object.instance_eval { @data['OS'] = "Haplochromis sp. 'muzu rukwa'" }
28
28
  @bio_seq = embl_object.to_biosequence
@@ -112,8 +112,7 @@ module Bio
112
112
  # that Bio::Sequence can be made into a valid Bio::EMBL again.
113
113
  class TestEMBLToBioSequenceRoundTrip < Test::Unit::TestCase
114
114
  def setup
115
- bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
116
- input = File.open(File.join(bioruby_root, 'test', 'data', 'embl', 'AB090716.embl.rel89')).read
115
+ input = File.read(File.join(BioRubyTestDataPath, 'embl', 'AB090716.embl.rel89'))
117
116
  embl_object_1 = Bio::EMBL.new(input)
118
117
  embl_object_1.instance_eval { @data['OS'] = "Haplochromis sp. 'muzu rukwa'" }
119
118
  @bio_seq_1 = embl_object_1.to_biosequence
@@ -7,11 +7,12 @@
7
7
  # $Id:$
8
8
  #
9
9
 
10
+ # loading helper routine for testing bioruby
10
11
  require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__),
12
- ['..'] * 5, 'lib')).cleanpath.to_s
13
- $:.unshift(libpath) unless $:.include?(libpath)
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
14
14
 
15
+ # libraries needed for the tests
15
16
  require 'test/unit'
16
17
  require 'bio/db/embl/sptr'
17
18
 
@@ -19,11 +20,8 @@ module Bio
19
20
  class TestSPTR < Test::Unit::TestCase
20
21
 
21
22
  def setup
22
- bioruby_root = Pathname.new(File.join(File.dirname(__FILE__),
23
- ['..'] * 5)).cleanpath.to_s
24
- data = File.open(File.join(bioruby_root,
25
- 'test', 'data', 'uniprot',
26
- 'p53_human.uniprot')).read
23
+ data = File.read(File.join(BioRubyTestDataPath,
24
+ 'uniprot', 'p53_human.uniprot'))
27
25
  @obj = Bio::SPTR.new(data)
28
26
  end
29
27
 
@@ -4,13 +4,15 @@
4
4
  # Copyright:: Copyright (C) 2005 Mitsuteru Nakao <n@bioruby.org>
5
5
  # License:: The Ruby License
6
6
  #
7
- # $Id: test_uniprot.rb,v 1.5 2007/04/05 23:35:43 trevor Exp $
7
+ # $Id:$
8
8
  #
9
9
 
10
+ # loading helper routine for testing bioruby
10
11
  require 'pathname'
11
- libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s
12
- $:.unshift(libpath) unless $:.include?(libpath)
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
13
14
 
15
+ # libraries needed for the tests
14
16
  require 'test/unit'
15
17
  require 'bio/db/embl/uniprot'
16
18
 
@@ -18,8 +20,7 @@ module Bio
18
20
  class TestUniProt < Test::Unit::TestCase
19
21
 
20
22
  def setup
21
- bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s
22
- data = File.open(File.join(bioruby_root, 'test', 'data', 'uniprot', 'p53_human.uniprot')).read
23
+ data = File.read(File.join(BioRubyTestDataPath, 'uniprot', 'p53_human.uniprot'))
23
24
  @obj = Bio::UniProt.new(data)
24
25
  end
25
26
 
@@ -0,0 +1,346 @@
1
+ #
2
+ # test/unit/bio/db/fasta/test_format_qual.rb - Unit test for Bio::Sequence::Format::Formatter::Fasta_numeric and Qual
3
+ #
4
+ # Copyright:: Copyright (C) 2009 Naohisa Goto
5
+ # License:: The Ruby License
6
+ #
7
+ # $Id:$
8
+ #
9
+
10
+ # loading helper routine for testing bioruby
11
+ require 'pathname'
12
+ load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4,
13
+ 'bioruby_test_helper.rb')).cleanpath.to_s
14
+
15
+ # libraries needed for the tests
16
+ require 'test/unit'
17
+ require 'bio/sequence'
18
+ require 'bio/db/fasta/format_qual'
19
+
20
+ module Bio
21
+ class TestSequenceFormatFormatterFasta_numeric < Test::Unit::TestCase
22
+
23
+ def setup
24
+ @sequence = Bio::Sequence.new('acgt' * 50 + 'a')
25
+ @sequence.quality_scores = (-100..100).to_a.freeze
26
+ @sequence.entry_id = 'TEST0001'
27
+ @sequence.definition = 'this is test'
28
+ end
29
+
30
+ def test_output
31
+ expected = <<_END_EXPECTED_
32
+ >TEST0001 this is test
33
+ -100 -99 -98 -97 -96 -95 -94 -93 -92 -91 -90 -89 -88 -87 -86 -85 -84
34
+ -83 -82 -81 -80 -79 -78 -77 -76 -75 -74 -73 -72 -71 -70 -69 -68 -67
35
+ -66 -65 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52 -51 -50
36
+ -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33
37
+ -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16
38
+ -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9
39
+ 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
40
+ 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
41
+ 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
42
+ 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
43
+ _END_EXPECTED_
44
+
45
+ str = @sequence.output(:fasta_numeric)
46
+ assert_equal(expected, str)
47
+
48
+ # default width is 70
49
+ str = @sequence.output(:fasta_numeric, { :width => 70 })
50
+ assert_equal(expected, str)
51
+
52
+ # Modifying the sequence does not affect the output.
53
+ @sequence.delete!('a')
54
+ str = @sequence.output(:fasta_numeric)
55
+ assert_equal(expected, str)
56
+ end
57
+
58
+ def test_output_width_35
59
+ expected = <<_END_OF_EXPECTED_
60
+ >TEST0001 this is test
61
+ -100 -99 -98 -97 -96 -95 -94 -93
62
+ -92 -91 -90 -89 -88 -87 -86 -85 -84
63
+ -83 -82 -81 -80 -79 -78 -77 -76 -75
64
+ -74 -73 -72 -71 -70 -69 -68 -67 -66
65
+ -65 -64 -63 -62 -61 -60 -59 -58 -57
66
+ -56 -55 -54 -53 -52 -51 -50 -49 -48
67
+ -47 -46 -45 -44 -43 -42 -41 -40 -39
68
+ -38 -37 -36 -35 -34 -33 -32 -31 -30
69
+ -29 -28 -27 -26 -25 -24 -23 -22 -21
70
+ -20 -19 -18 -17 -16 -15 -14 -13 -12
71
+ -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1
72
+ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
73
+ 15 16 17 18 19 20 21 22 23 24 25 26
74
+ 27 28 29 30 31 32 33 34 35 36 37 38
75
+ 39 40 41 42 43 44 45 46 47 48 49 50
76
+ 51 52 53 54 55 56 57 58 59 60 61 62
77
+ 63 64 65 66 67 68 69 70 71 72 73 74
78
+ 75 76 77 78 79 80 81 82 83 84 85 86
79
+ 87 88 89 90 91 92 93 94 95 96 97 98
80
+ 99 100
81
+ _END_OF_EXPECTED_
82
+
83
+ str = @sequence.output(:fasta_numeric, { :width => 35 })
84
+ assert_equal(expected, str)
85
+ end
86
+
87
+ def test_output_width_nil
88
+ expected = ">TEST0001 this is test\n" +
89
+ (-100..100).collect { |x| x.to_s }.join(' ') + "\n"
90
+ str = @sequence.output(:fasta_numeric, { :width => nil })
91
+ assert_equal(expected, str)
92
+ end
93
+
94
+ end #clsaa TestSequenceFormatFormatterFasta_numeric
95
+
96
+ class TestSequenceFormatFormatterQual < Test::Unit::TestCase
97
+ def setup
98
+ @sequence = Bio::Sequence.new('acgt' * 28)
99
+ @sequence.quality_scores = [ -100, *(-10..100).to_a ].freeze
100
+ @sequence.entry_id = 'TEST0001'
101
+ @sequence.definition = 'this is test'
102
+ end
103
+
104
+ def test_output
105
+ expected = <<_END_EXPECTED_
106
+ >TEST0001 this is test
107
+ -100 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
108
+ 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
109
+ 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
110
+ 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
111
+ 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
112
+ _END_EXPECTED_
113
+
114
+ str = @sequence.output(:qual)
115
+ assert_equal(expected, str)
116
+
117
+ # default width is 70
118
+ str = @sequence.output(:qual, { :width => 70 })
119
+ assert_equal(expected, str)
120
+ end
121
+
122
+ def test_output_width45
123
+ expected = <<_END_EXPECTED_
124
+ >TEST0001 this is test
125
+ -100 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4
126
+ 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
127
+ 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
128
+ 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
129
+ 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
130
+ 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
131
+ 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
132
+ 97 98 99 100
133
+ _END_EXPECTED_
134
+
135
+ str = @sequence.output(:qual, { :width => 45 })
136
+ assert_equal(expected, str)
137
+ end
138
+
139
+ def test_output_after_truncating_sequence
140
+ expected = <<_END_EXPECTED_
141
+ >TEST0001 this is test
142
+ -100 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
143
+ 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
144
+ 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
145
+ 61 62 63 64 65 66 67 68 69 70 71 72
146
+ _END_EXPECTED_
147
+
148
+ # Modifying the sequence affects the output.
149
+ @sequence.delete!('a')
150
+ str = @sequence.output(:qual)
151
+ assert_equal(expected, str)
152
+ end
153
+
154
+ def test_output_after_adding_sequence
155
+ expected = <<_END_EXPECTED_
156
+ >TEST0001 this is test
157
+ -100 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
158
+ 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
159
+ 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
160
+ 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
161
+ 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 0 0 0 0 0 0 0 0 0
162
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
163
+ _END_EXPECTED_
164
+
165
+ # Modifying the sequence affects the output.
166
+ @sequence.gsub!(/a/, 'at')
167
+ str = @sequence.output(:qual)
168
+ assert_equal(expected, str)
169
+ end
170
+
171
+ def test_output_with_default_score
172
+ expected = <<_END_EXPECTED_
173
+ >TEST0001 this is test
174
+ -100 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
175
+ 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
176
+ 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
177
+ 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
178
+ 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 -10 -10 -10 -10
179
+ -10 -10 -10 -10
180
+ _END_EXPECTED_
181
+
182
+ # Modifying the sequence affects the output.
183
+ @sequence.concat('aaaatttt')
184
+ str = @sequence.output(:qual, { :default_score => -10 })
185
+ assert_equal(expected, str)
186
+ end
187
+
188
+ def test_output_with_converting_score_solexa2phred
189
+ expected = <<_END_EXPECTED_
190
+ >TEST0001 this is test
191
+ 0 0 1 1 1 1 1 1 2 2 3 3 4 4 5 5 6 7 8 9 10 10 11 12 13 14 15 16 17 18
192
+ 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
193
+ 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
194
+ 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
195
+ 88 89 90 91 92 93 94 95 96 97 98 99 100 -99 -99 -99 -99
196
+ _END_EXPECTED_
197
+
198
+ @sequence.quality_score_type = :solexa
199
+ @sequence.concat('aaaa')
200
+ str = @sequence.output(:qual, { :default_score => -99 })
201
+ assert_equal(expected, str)
202
+ end
203
+
204
+ def test_output_with_converting_score_phred2solexa
205
+ expected = <<_END_EXPECTED_
206
+ >TEST0001 this is test
207
+ -6 -2 0 2 3 5 6 7 8 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
208
+ 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
209
+ 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
210
+ 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
211
+ 96 97 98 99 100 -99 -99 -99 -99 -99 -99 -99 -99 -99 -99 -99 -99
212
+ _END_EXPECTED_
213
+
214
+ @sequence.quality_score_type = :phred
215
+ @sequence.quality_scores =
216
+ @sequence.quality_scores.find_all { |x| x > 0 }
217
+
218
+ str = @sequence.output(:qual,
219
+ { :default_score => -99,
220
+ :quality_score_type => :solexa
221
+ })
222
+ assert_equal(expected, str)
223
+
224
+ # If @sequence.quality_score_type == nil, :phred is assumed.
225
+ @sequence.quality_score_type = nil
226
+ str = @sequence.output(:qual,
227
+ { :default_score => -75,
228
+ :quality_score_type => :solexa
229
+ })
230
+ expected2 = expected.gsub(/ \-99/, ' -75')
231
+ assert_equal(expected2, str)
232
+ end
233
+
234
+ def test_output_from_error_probabilities
235
+ # @sequence.quality_scores
236
+ expected_qsc = <<_END_EXPECTED_
237
+ >TEST0001 this is test
238
+ -100 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
239
+ 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
240
+ 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
241
+ 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
242
+ 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
243
+ _END_EXPECTED_
244
+
245
+ # @sequence.error_probabilities to phred score
246
+ expected_ep_phred = <<_END_EXPECTED_
247
+ >TEST0001 this is test
248
+ 0 3 10 18 28 39 51 63 76 90 104 119 134 149 165 181 197 213 230 247
249
+ 264 282 300 317 336 354 372 391 409 428 447 467 486 505 525 545 565
250
+ 585 605 625 645 666 686 707 727 748 769 790 811 832 854 875 897 918
251
+ 940 962 983 1005 1027 1049 1071 1093 1116 1138 1160 1183 1205 1228
252
+ 1250 1273 1296 1319 1342 1365 1388 1411 1434 1457 1480 1503 1527 1550
253
+ 1574 1597 1621 1644 1668 1692 1715 1739 1763 1787 1811 1835 1859 1883
254
+ 1907 1931 1956 1980 2004 2029 2053 2078 2102 2127 2151 2176 2200 2225
255
+ 2250 2275
256
+ _END_EXPECTED_
257
+
258
+ # @sequence.error_probabilities to phred score
259
+ expected_ep_solexa = <<_END_EXPECTED_
260
+ >TEST0001 this is test
261
+ -80 0 9 18 28 39 51 63 76 90 104 119 134 149 165 181 197 213 230 247
262
+ 264 282 300 317 336 354 372 391 409 428 447 467 486 505 525 545 565
263
+ 585 605 625 645 666 686 707 727 748 769 790 811 832 854 875 897 918
264
+ 940 962 983 1005 1027 1049 1071 1093 1116 1138 1160 1183 1205 1228
265
+ 1250 1273 1296 1319 1342 1365 1388 1411 1434 1457 1480 1503 1527 1550
266
+ 1574 1597 1621 1644 1668 1692 1715 1739 1763 1787 1811 1835 1859 1883
267
+ 1907 1931 1956 1980 2004 2029 2053 2078 2102 2127 2151 2176 2200 2225
268
+ 2250 2275
269
+ _END_EXPECTED_
270
+
271
+ @sequence.error_probabilities =
272
+ (0...(@sequence.length)).collect { |i| ((i + 1) ** -i) }
273
+ # Because Solexa score does not allow 1.
274
+ @sequence.error_probabilities[0] = 0.99999999
275
+
276
+ # @sequence.quality_score_type: nil
277
+ # output :qual, :quality_score_type => (not set)
278
+ #
279
+ # ==> using @sequence.quality_scores
280
+ #
281
+ @sequence.quality_score_type = nil
282
+ str = @sequence.output(:qual)
283
+ assert_equal(expected_qsc, str)
284
+
285
+ # @sequence.quality_score_type: :phred
286
+ # output :qual, :quality_score_type => (not set)
287
+ #
288
+ # ==> using @sequence.error_probabilities
289
+ #
290
+ @sequence.quality_score_type = :phred
291
+ str = @sequence.output(:qual)
292
+ assert_equal(expected_ep_phred, str)
293
+
294
+ # @sequence.quality_score_type: nil
295
+ # output :qual, :quality_score_type => :phred
296
+ #
297
+ # ==> using @sequence.error_probabilities
298
+ #
299
+ @sequence.quality_score_type = nil
300
+ str = @sequence.output(:qual, :quality_score_type => :phred)
301
+ assert_equal(expected_ep_phred, str)
302
+
303
+ # @sequence.quality_score_type: :phred
304
+ # output :qual, :quality_score_type => :solexa
305
+ #
306
+ # ==> using @sequence.error_probabilities
307
+ #
308
+ @sequence.quality_score_type = :phred
309
+ str = @sequence.output(:qual, :quality_score_type => :solexa)
310
+ assert_equal(expected_ep_solexa, str)
311
+
312
+ # @sequence.quality_score_type: :solexa
313
+ # output :qual, :quality_score_type => :phred
314
+ #
315
+ # ==> using @sequence.error_probabilities
316
+ #
317
+ @sequence.quality_score_type = :solexa
318
+ str = @sequence.output(:qual, :quality_score_type => :phred)
319
+ assert_equal(expected_ep_phred, str)
320
+
321
+ # @sequence.quality_score_type: :phred
322
+ # output :qual, :quality_score_type => :phred
323
+ #
324
+ # ==> using @sequence.quality_scores
325
+ #
326
+ @sequence.quality_score_type = :phred
327
+ str = @sequence.output(:qual, :quality_score_type => :phred)
328
+ assert_equal(expected_qsc, str)
329
+
330
+ # After removing @sequence.quality_scores:
331
+ # @sequence.quality_score_type: :phred
332
+ # output :qual, :quality_score_type => :phred
333
+ #
334
+ # ==> using @sequence.error_probabilities
335
+ #
336
+ @sequence.quality_scores = nil
337
+ @sequence.quality_score_type = :phred
338
+ str = @sequence.output(:qual, :quality_score_type => :phred)
339
+ assert_equal(expected_ep_phred, str)
340
+ end
341
+
342
+ end #class TestSequenceFormatFormatterQual
343
+
344
+ end #module Bio
345
+
346
+