From 4c74f0aa5b9a572a2552767d4c4c0c15166e092a Mon Sep 17 00:00:00 2001 From: martinahansen Date: Fri, 8 Mar 2013 09:29:16 +0000 Subject: [PATCH] rewrite of FASTQ internals git-svn-id: http://biopieces.googlecode.com/svn/trunk@2111 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/assemble_pairs | 3 +- bp_bin/blast_seq | 6 +- bp_bin/patscan_seq | 2 +- bp_bin/read_fastq | 29 +- bp_bin/scores_to_dec | 26 +- bp_bin/trim_seq | 10 +- bp_bin/write_fastq | 14 +- bp_bin/write_fastq_files | 16 +- bp_test/in/assemble_pairs.in | 20 +- bp_test/in/mask_seq.in | 2 +- bp_test/in/mean_scores.in | 6 +- bp_test/in/read_fastq.in.1 | 12 +- bp_test/in/read_fastq.in.1.gz | Bin 0 -> 148 bytes bp_test/in/read_fastq.in.2 | 14 +- bp_test/in/read_fastq.in.2.gz | Bin 115 -> 0 bytes bp_test/in/trim_seq.in | 2 +- bp_test/in/write_fastq.in | 14 +- bp_test/in/write_fastq_files.in | 30 +- bp_test/out/assemble_pairs.out.1 | 10 +- bp_test/out/assemble_pairs.out.2 | 6 +- bp_test/out/mask_seq.out.1 | 2 +- bp_test/out/mask_seq.out.2 | 2 +- bp_test/out/mask_seq.out.3 | 2 +- bp_test/out/mean_scores.out.1 | 6 +- bp_test/out/mean_scores.out.2 | 6 +- bp_test/out/mean_scores.out.3 | 6 +- bp_test/out/read_fastq.out.1 | 16 +- bp_test/out/read_fastq.out.2 | 18 +- bp_test/out/read_fastq.out.3 | 8 +- bp_test/out/scores_to_dec.out.1 | 2 +- bp_test/out/trim_seq.out.1 | 2 +- bp_test/out/trim_seq.out.2 | 2 +- bp_test/out/trim_seq.out.3 | 2 +- bp_test/out/trim_seq.out.4 | 2 +- bp_test/out/trim_seq.out.5 | 2 +- bp_test/out/trim_seq.out.6 | 2 +- bp_test/out/write_fastq.out.1 | 12 +- bp_test/out/write_fastq.out.2 | 12 +- .../ILLUMINA-52179E.fastq | 4 - .../write_fastq_files.out.1/ILLUMINA.fastq | 8 - .../out/write_fastq_files.out.1/test.fastq | 4 + .../out/write_fastq_files.out.1/test2.fastq | 8 + .../out/write_fastq_files.out.2/test.fastq | 4 + .../out/write_fastq_files.out.2/test2.fastq | 8 + bp_test/test/test_read_fastq | 12 +- bp_test/test/test_write_fastq | 10 +- bp_test/test/test_write_fastq_files | 16 + code_ruby/lib/maasha/seq.rb | 71 ++-- code_ruby/test/helper.rb | 5 + code_ruby/test/maasha/align/test_match.rb | 22 +- code_ruby/test/maasha/align/test_matches.rb | 16 +- code_ruby/test/maasha/align/test_mem.rb | 5 +- code_ruby/test/maasha/seq/test_backtrack.rb | 51 +-- code_ruby/test/maasha/seq/test_digest.rb | 12 +- code_ruby/test/maasha/seq/test_dynamic.rb | 32 +- code_ruby/test/maasha/seq/test_trim.rb | 64 +-- code_ruby/test/maasha/test_base36.rb | 12 +- code_ruby/test/maasha/test_biopieces.rb | 83 ++-- code_ruby/test/maasha/test_bitarray.rb | 56 +-- code_ruby/test/maasha/test_bits.rb | 14 +- code_ruby/test/maasha/test_boulder.rb | 18 +- code_ruby/test/maasha/test_cigar.rb | 23 +- code_ruby/test/maasha/test_fasta.rb | 24 +- code_ruby/test/maasha/test_fastq.rb | 15 +- code_ruby/test/maasha/test_locator.rb | 16 +- code_ruby/test/maasha/test_math_aux.rb | 8 +- code_ruby/test/maasha/test_sam.rb | 117 +++--- code_ruby/test/maasha/test_seq.rb | 390 +++++++----------- 68 files changed, 677 insertions(+), 777 deletions(-) create mode 100644 bp_test/in/read_fastq.in.1.gz delete mode 100644 bp_test/in/read_fastq.in.2.gz delete mode 100644 bp_test/out/write_fastq_files.out.1/ILLUMINA-52179E.fastq delete mode 100644 bp_test/out/write_fastq_files.out.1/ILLUMINA.fastq create mode 100644 bp_test/out/write_fastq_files.out.1/test.fastq create mode 100644 bp_test/out/write_fastq_files.out.1/test2.fastq create mode 100644 bp_test/out/write_fastq_files.out.2/test.fastq create mode 100644 bp_test/out/write_fastq_files.out.2/test2.fastq create mode 100644 code_ruby/test/helper.rb diff --git a/bp_bin/assemble_pairs b/bp_bin/assemble_pairs index 440810b..c9e0eb0 100755 --- a/bp_bin/assemble_pairs +++ b/bp_bin/assemble_pairs @@ -87,7 +87,6 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| io_in2.close cmd = "pandaseq" - cmd << " -6" cmd << " -F" cmd << " -B" cmd << " -N" @@ -105,7 +104,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| Fastq.open(file_out) do |ios| ios.each do |entry| - output.puts entry.convert_scores!('illumina18', 'illumina15').to_bp + output.puts entry.to_bp end end end diff --git a/bp_bin/blast_seq b/bp_bin/blast_seq index e371b5c..3feaa65 100755 --- a/bp_bin/blast_seq +++ b/bp_bin/blast_seq @@ -132,8 +132,7 @@ if ( $options->{ 'verbose' } ) "-W $options->{ 'word_size' }", "-f $options->{ 'extend_threshold' }", "-o $tmp_out", - ), - 1 + ) ); } else @@ -153,8 +152,7 @@ else "-f $options->{ 'extend_threshold' }", "-o $tmp_out", "> /dev/null 2>&1" - ), - 1 + ) ); } diff --git a/bp_bin/patscan_seq b/bp_bin/patscan_seq index c8ff362..bc07fca 100755 --- a/bp_bin/patscan_seq +++ b/bp_bin/patscan_seq @@ -68,7 +68,7 @@ class Patscan def results_parse results = Hash.new { |h, k| h[k] = [] } - Fasta.open(@out_file, mode='r') do |ios| + Fasta.open(@out_file, 'r') do |ios| ios.each do |entry| if entry.seq_name =~ /([^:]+):\[(\d+),(\d+)\]/ id = $1.to_i diff --git a/bp_bin/read_fastq b/bp_bin/read_fastq index bbfbdd4..78a3fcc 100755 --- a/bp_bin/read_fastq +++ b/bp_bin/read_fastq @@ -31,7 +31,7 @@ require 'maasha/biopieces' require 'maasha/fastq' -allowed_enc = 'auto,sanger,solexa,illumina1.3,illumina1.5,illumina1.8' +allowed_enc = 'auto,base_33,base_64' casts = [] casts << {:long=>'data_in', :short=>'i', :type=>'files!', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} @@ -40,9 +40,10 @@ casts << {:long=>'encoding', :short=>'e', :type=>'string', :mandatory=>false, :d options = Biopieces.options_parse(ARGV, casts) -num = 0 -first = true -last = false +MAX_TEST = 1_000 + +num = 0 +last = false Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| unless options[:data_in] and options[:data_in].first == '-' @@ -53,25 +54,25 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| if options[:data_in] options[:data_in].each do |file| - encoding = options[:encoding].downcase.delete('.') + encoding = options[:encoding].downcase.to_sym Fastq.open(file, mode='r') do |fastq| fastq.each do |entry| - if encoding == 'auto' - if entry.qual_base33? # sanger or illumina18 - encoding = 'illumina18' - elsif entry.qual_base64? # solexa or illumina13 or illumina15 - encoding = 'illumina13' + if encoding == :auto + if entry.qual_base33? + encoding = :base_33 + elsif entry.qual_base64? + encoding = :base_64 else raise SeqError, "Could not auto-detect quality score encoding" end end - entry.convert_scores!(encoding, 'illumina13') + entry.qual_convert!(encoding, :base_33) + entry.qual_coerce!(:base_33) - if first -# raise SeqError, "Quality score outside valid range" unless entry.qual_valid?('illumina13') - first = false + if num < MAX_TEST + raise SeqError, "Quality score outside valid range" unless entry.qual_valid?(:base_33) end output.puts entry.to_bp diff --git a/bp_bin/scores_to_dec b/bp_bin/scores_to_dec index b93587f..b69f37c 100755 --- a/bp_bin/scores_to_dec +++ b/bp_bin/scores_to_dec @@ -30,29 +30,19 @@ require 'maasha/biopieces' require 'maasha/seq' - -# Expading class Hash with possibly evil monkey patch. -class Hash - # Method to convert scores from ASCII encode string to - # a semi-colon seperated string of decimal values. - def scores2dec! - if self[:SCORES] - self[:SCORES].gsub! /./ do |score| - score = (score.ord - Seq::SCORE_BASE).to_s + ";" - end - - self[:SCORES].chomp! ";" - end - - self - end -end +require 'narray' options = Biopieces.options_parse(ARGV) Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| input.each_record do |record| - output.puts record.scores2dec! + if record[:SCORES] + na = NArray.to_na(record[:SCORES], "byte") + na -= Seq::SCORE_BASE + record[:SCORES] = na.to_a.join("; ") + end + + output.puts record end end diff --git a/bp_bin/trim_seq b/bp_bin/trim_seq index 7afec9c..c89eefb 100755 --- a/bp_bin/trim_seq +++ b/bp_bin/trim_seq @@ -39,15 +39,17 @@ casts << {:long=>'trim', :short=>'t', :type=>'string', :mandatory=>true, :de options = Biopieces.options_parse(ARGV, casts) +trim = options[:trim].to_sym + Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| input.each_record do |record| if record[:SEQ] and record[:SCORES] entry = Seq.new_bp(record) - case options[:trim] - when /both/ then entry.quality_trim!(options[:min_qual], options[:min_len]) - when /left/ then entry.quality_trim_left!(options[:min_qual], options[:min_len]) - when /right/ then entry.quality_trim_right!(options[:min_qual], options[:min_len]) + case trim + when :both then entry.quality_trim!(options[:min_qual], options[:min_len]) + when :left then entry.quality_trim_left!(options[:min_qual], options[:min_len]) + when :right then entry.quality_trim_right!(options[:min_qual], options[:min_len]) end record.merge! entry.to_bp diff --git a/bp_bin/write_fastq b/bp_bin/write_fastq index 796e187..30bdd89 100755 --- a/bp_bin/write_fastq +++ b/bp_bin/write_fastq @@ -31,17 +31,17 @@ require 'maasha/biopieces' require 'maasha/fastq' -allowed_enc = 'sanger,solexa,illumina1.3,illumina1.5,illumina1.8' +allowed_enc = 'base_33,base_64' casts = [] -casts << {:long=>'no_stream', :short=>'x', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} -casts << {:long=>'data_out', :short=>'o', :type=>'file', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} -casts << {:long=>'encoding', :short=>'e', :type=>'string', :mandatory=>false, :default=>'illumina1.3', :allowed=>allowed_enc, :disallowed=>nil} -casts << {:long=>'compress', :short=>'Z', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'no_stream', :short=>'x', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'data_out', :short=>'o', :type=>'file', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'encoding', :short=>'e', :type=>'string', :mandatory=>false, :default=>'base_33', :allowed=>allowed_enc, :disallowed=>nil} +casts << {:long=>'compress', :short=>'Z', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} options = Biopieces.options_parse(ARGV, casts) -encoding = options[:encoding].downcase.delete('.') +encoding = options[:encoding].to_sym Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| if options[:data_out] @@ -57,7 +57,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| input.each do |record| if record[:SEQ_NAME] and record[:SEQ] and record[:SCORES] entry = Seq.new_bp(record) - entry.convert_scores!('illumina13', encoding) + entry.qual_convert!(:base_33, encoding) io_out.puts entry.to_fastq end diff --git a/bp_bin/write_fastq_files b/bp_bin/write_fastq_files index a116040..0b50842 100755 --- a/bp_bin/write_fastq_files +++ b/bp_bin/write_fastq_files @@ -32,13 +32,18 @@ require 'maasha/biopieces' require 'maasha/fastq' require 'pp' +allowed_enc = 'base_33,base_64' + casts = [] -casts << {:long=>'key', :short=>'k', :type=>'string', :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil} -casts << {:long=>'dir', :short=>'d', :type=>'dir!', :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil} -casts << {:long=>'no_stream', :short=>'x', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'key', :short=>'k', :type=>'string', :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'dir', :short=>'d', :type=>'dir!', :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'no_stream', :short=>'x', :type=>'flag', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} +casts << {:long=>'encoding', :short=>'e', :type=>'string', :mandatory=>false, :default=>'base_33', :allowed=>allowed_enc, :disallowed=>nil} options = Biopieces.options_parse(ARGV, casts) +encoding = options[:encoding].to_sym + key = options[:key].to_sym fh_hash = {} @@ -46,7 +51,8 @@ fh_hash = {} Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| input.each_record do |record| if record[:SEQ_NAME] and record[:SEQ] and record[:SCORES] and record[key] - seq = Seq.new_bp(record) + entry = Seq.new_bp(record) + entry.qual_convert!(:base_33, encoding) if fh_hash[record[key].to_sym] fastq_io = fh_hash[record[key].to_sym] @@ -56,7 +62,7 @@ Biopieces.open(options[:stream_in], options[:stream_out]) do |input, output| fh_hash[record[key].to_sym] = fastq_io end - fastq_io.puts seq.to_fastq + fastq_io.puts entry.to_fastq end output.puts record unless options[:no_stream] diff --git a/bp_test/in/assemble_pairs.in b/bp_test/in/assemble_pairs.in index 82a4fbb..75e2a5c 100644 --- a/bp_test/in/assemble_pairs.in +++ b/bp_test/in/assemble_pairs.in @@ -1,50 +1,50 @@ SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:14862:1868 1:N:0:14 SEQ: TGGGGAATATTGGACAATGGGGGCAACCCTGATCCAGCAATACCGCGTGTGTGAAGAAGGCCTGAGGGTTGTAAAGCACTTTCAATTGTGAAGAAAAGTTAACGGTTAATAACCGTTAGCCTTGACGTTAACTTTAGAAGAAGCACCGGCTAACTCCGTGCCAGCAGCCGCGGTAATACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCGTAAAGCGTGCGTAGGCGGTTTATTCAGTCAGATGTG SEQ_LEN: 249 -SCORES: [^^^^^^accccccccfffffffgghhhdghggeffgeggfgeggcgdgdgge`eefeegeggeegggdeddggggggggggggeeegeggggggggggggfacdffffffffffffffffdfdfffffbdffffdbbdbdddbfff[`cfbfffdffdfffffdfbdW]Q]cb[dddffb^[cfbbbdbYb^bbdffffbbH^dfddY^bWSMFWOIYbW^b]^^QbdQQMSWbY^Ibb^YbIY^b^b +SCORES: !??????BDDDDDDDDGGGGGGGHHIIIEHIHHFGGHFHHGHFHHDHEHEHHFAFFGFFHFHHFFHHHEFEEHHHHHHHHHHHHFFFHFHHHHHHHHHHHHGBDEGGGGGGGGGGGGGGGGEGEGGGGGCEGGGGECCECEEECGGG!ADGCGGGEGGEGGGGGEGCE8!2!DC!EEEGGC?!DGCCCEC:C?CCEGGGGCC)?EGEE:?C84.'80*:C8?C!??2CE22.48C:?*CC?:C*:?C?C --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:14862:1868 2:N:0:14 SEQ: CCTGTTTGCTACCCACGCTTTCGTACCTCAGCGTCAGTATTGGTCCAGAAAGCTGCCTTCGCCATTGATGTTCCTTCTGATATCTACGCATTTCACCGCTACACCAGAAATTCCACTTTCCTCTACCATACTCTAGTTGACCAGTTTCAAATGCAGTTCCCAGGTTAAGCCCGGGGCTTTCACATCTGACTTAATAAACCGCCTACGCACGCTTTACGCCCAGTAATTC SEQ_LEN: 229 -SCORES: ^^^^^aa[L[accccceddeeegeeghZeZdfggcgdeX^dbcb^eeeeeffefghg^fecdd]dggeebfegghhhhhgggghgcgeggggccfffgggggggggeee_eec]aeceaea^\ccd\cdcddcacdadbed`\bad``beb`KK\\bd\\KK\HIP^`YYY^WcWFSZ``YYb`bddd^`^``bddddbIFSWHMOHF`Zc^`HHIPOWMM^IPIPYYY +SCORES: ?????BB!-!BDDDDDFEEFFFHFFHI;F;EGHHDHEF9?ECDC?FFFFFGGFGHIH?GFDEE!EHHFFCGFHHIIIIIHHHHIHDHFHHHHDDGGGHHHHHHHHHFFF@FFD!BFDFBFB?=DDE=DEDEEDBDEBECFEA=CBEAACFCA,,==CE==,,=)*1?A:::?8D8'4;AA::CACEEE?A?AACEEEEC*'48).0)'A;D?A))*108..?*1*1::: --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:13906:2139 1:N:0:14 SEQ: TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCTTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAACGTTGGTGGTGAAATCCCAGAGCTTAACGCTGGAACTG SEQ_LEN: 251 -SCORES: [^^^X^aaacaccacceeeeeeggghegegghggeggggdccdfgggbdgd^degefgegeghghhhgbdbdgggheghhhgfgeggggggddeeeeeddeeedeeedddddeeeeeeebdeaddcdeeeeeededeeddeeeecccc`^dddeedddcdb`dd^Y`c``]`ddec`^bddeY^b`Wdddd`dddY``bdeedbdddd^Y^b`HMOY`dWWHMOYYbdddddb^`IY``YIHMM^]`ddeY +SCORES: !???9?BBBDBDDBDDFFFFFFHHHIFHFHHIHHFHHHHEDDEGHHHCEHE?EFHFGHFHFHIHIIIHCECEHHHIFHIIIHGHFHHHHHHEEFFFFFEEFFFEFFFEEEEEFFFFFFFCEFBEEDEFFFFFFEFEFFEEFFFFDDDDA?EEEFFEEEDECAEE?:ADAA!AEEFDA?CEEF:?CA8EEEEAEEE:AACEFFECEEEE?:?CA).0:AE88).0::CEEEEEC?A*:AA:*)..?!AEEF: --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:13906:2139 2:N:0:14 SEQ: TCTTCGCTACCCATGCTTTCGTTCCTCAGCGTCAGTAATGATCCAGAAAGCTGCCTTCGCAATCGGTATTCTTTCTAATATCTACGAATTTCACCTCTACACTAGAAATTCTGCTTTCCTCTATCATACTCTAGCTAAAAAGTTTTGATGGCAGTTCCAGAGTTAAGCTCTGGGATTTCACCACCAACTTTTTTAACCACCTACGAACTCTTTAAGCCCAGTAATTCCGAACTACGCTAGGTCCCTT SEQ_LEN: 247 -SCORES: [^^aa^cc`acacceeeeeegeghgegghhgdgdge^d^Obcefeegghgeeegggfc_d_dcaeg]Tdfggghhhffbfgggeghgg`eabffffggeeegeeegegee^ccacegM^eeeeeaeeedcdddedee\acddddbbdd`\`a\^bdb\`bK[T\adYbdI^I^d^I^YIYIPYW^`^`ddedd]dYIPYW`ddd^H^W^Y^Ybd`d``dIWP^I^bddYW^^IIPHTMHMW`IY`Y^ +SCORES: !??BB?DDABDBDDFFFFFFHFHIHFHHIIHEHEHF?E?0CDFGFFHHIHFFFHHHGD@E@EDBFH!5EGHHHIIIGGCGHHHFHIHHAFBCGGGGHHFFFHFFFHFHFF?DDBDFH.?FFFFFBFFFEDEEEFEFF=BDEEEECCEEA=AB=?CEC=AC,!5=BE:CE*?*?E?*?:*:*1:8?A?AEEFEE!E:*1:8AEEE?)?8?:?:CEAEAAE*81?*?CEE:8??**1)5.).8A*:A:? --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:14865:2158 1:N:0:14 SEQ: TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCTTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGGTGGTGAAATCCCAGAGCTTAACTCTGGAACT SEQ_LEN: 250 -SCORES: ^^^^^aaaaaccaccaeeeeeedbgegegegfggefc^]begggggg]cddeeeeceege_eggghegddggghhggghghgggcdggggeddeee^eddddeddeeddY]bddedeeeadddddcdedYY`dY^`dbdede^`]ZcWWZbdddded`Z`dbdddbdZO^]OY``c``dbdeedddbd``bdYb`YI^bW^bdYYbdW`bb`YS^Y`bYWWWWHYIY^d`IYYWIIPIIPP^^Yd^b`Y^ +SCORES: ?????BBBBBDDBDDBFFFFFFECHFHFHFHGHHFGD?!CFHHHHHH!DEEFFFFDFFHF@FHHHIFHEEHHHIIHHHIHIHHHDEHHHHFEEFFF?FEEEEFEEFFEE:!CEEFEFFFBEEEEEDEFE::AE:?AECEFEF?A!;D88;CEEEEFEA;AECEEECE;0?!0:AADAAECEFFEEECEAACE:CA:*?C8?CE::CE8ACCA:4?:AC:8888):*:?EA*::8**1**11??:E?CA:? --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:14865:2158 2:N:0:14 SEQ: CTTCGCTACCCATGCTTTCGTTCCTCAGTGTCAGTAATGATCCAGAAAGCTGCCTTCGCAATCGGTATTCTTTCTAATATCTACGAATTTCACCTCTACACTAGAAATTCTGCTTTCCTCTATCATACTCTAGCTAAAAAGTTTTGATGGCAGTTCCAGAGTTAAGCTCTGGGATTTCACCACCAACTTTTTTAACCACCTACGAACTCTTTAAGCCCAGTAATTCCGAACTACGCTAGGTCCCTTC SEQ_LEN: 247 -SCORES: [^^a^aa^aaaaaee^eeegZegeegafObX`egb^e\^bb^ee\b^daeffgcgggeccdcc_d]beggghggg^^`dfegb^edeeeabdfggeggefgggeggebcM_ccegg^eeee\b^aeeecee^aec\ZccddcddddddZbbadddda^a^^a^b^aZd^da`YNY`b^`YI^d`b``I^bdbZINOIY^`bb``^b^ddddddY`YIWOOY``Y`ddYHOS^^Y`ZW`^b`NOIYY` +SCORES: !??B?BB?BBBBBFF?FFFH;FHFFHBG0C9AFHC?F=?CC?FF=C?EBFGGHDHHHFDDEDD@E!CFHHHIHHH??AEGFHC?FEFFFBCEGHHFHHFGHHHFHHFCD.@DDFHH?FFFF=C?BFFFDFF?BFD=;DDEEDEEEEEE;CCBEEEEB?B??B?C?B;E?EBA:/:AC?A:*?EACAA*?CEC;*/0*:?ACCAA?C?EEEEEE:A:*800:AA:AEE:)04??:A;8A?CA/0*::A --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:17246:2253 1:N:0:14 SEQ: AGGGAATCTTGCACAATGGGGGAAACCCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCCTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGAACTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGATGGTGAAATCCCAAGGCTCAACCTTGGAACT SEQ_LEN: 249 -SCORES: [^^^aL[L^[aaaaaeeeZ]bdddbbZdeeg\dfad\bdegc_bcbd]J]Tb\ea`d`cgedggggggdbbf\bc\bbe\cb\cc`bddTYcddddbadbdbR^RZ^aY_bdddbddb^bb^^^^d^b```d^`bdddddddd^^^^`ZHYY`b`dd^d`IWYbddFHOW`dbd^ddd^Y^^YY`bdI^I^IY`NYIWW`^`^bb`dY^bIIS`NY`dbYYINON^YY^IIOMHIYWYNNNYYINY^Y^ +SCORES: !???B-!-?!BBBBBFFF;!CEEECC;EFFH=EGBE=CEFHD@CDCE!+!5C=FBAEADHFEHHHHHHECCG=CD=CCF=DC=DDACEE5:DEEEECBECEC3?3;?B:@CEEECEEC?CC????E?CAAAE?ACEEEEEEEE????A;)::ACAEE?EA*8:CEE')08AECE?EEE?:??::ACE*?*?*:A/:*88A?A?CCAE:?C**4A/:AEC::*/0/?::?**0.)*:8:///::*/:?:? --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:17246:2253 2:N:0:14 SEQ: CCTCTTCGCTACCCATGCTTTCGTTCCTCAGTGTCAGTAATGATCCAGAAAGTTGCCTTCGCTTTTGATGTTCTTTCTAATATCTACGAATTTCACCTCTACACTAGAAATTCCACTTTCCTCTATCATACTCTAGCTAAAAAGTTTTGATGGCAGTTCCAAGGTTGAGCCTTGGGATTTCACCATCAACTTTTTTAACCACCTACGAACTCTTTAAGCCCAGTAATTCCGAACTACGCTAGGTCCCTTC SEQ_LEN: 250 -SCORES: ^^^^^aa^^aacaaaaaeeeeegeghheeacO`OXbfeff^Obccfgcfeggfdefgghhgd_beggJ`dfgeghhggbdegggfcggghhgghgaffggcfeggggaafeeccecegebeeg^MbbeeggggeeeeeeccaedccddddedMSK^a`\\`\\IT\`KaaK`\b``bddeddeI`ddbOI`dddbZbPOIIOWO^^HWWF`bdb``YYYYIW^bY^deYY^`HQ`YIHFMWS```O^dd` +SCORES: ?????BB??BBDBBBBBFFFFFHFHIIFFBD0A09CGFGG?0CDDGHDGFHHGEFGHHIIHE@CFHH+AEGHFHIIHHCEFHHHGDHHHIIHHIHBGGHHDGFHHHHBBGFFDDFDFHFCFFH?.CCFFHHHHFFFFFFDDBFEDDEEEEFE.4,?BA==A==*5=A,BB,A=CAACEEFEEF*AEEC0*AEEEC;C10**080??)88'ACECAA::::*8?C:?EF::?A)2A:*)'.84AAA0?EEA --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:13072:2276 1:N:0:14 SEQ: GGGAATTTTGCGCAATGGGCGAAAGCCTGACGCAGCAACGCCGCGGGATCGAAGAAGCTCTGCGGAGTGTAAAGATCTGTCATAAGGGAAGAATAACGAGTATTCTAACAAAATATTCGTCTGACGGTACCTTATAAGAAAGCCACGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAGGGGGGCAAGCGTTATCCGGAATCATTGGGCGTAAAGGGGTCGTATGAGGACTGATCAG SEQ_LEN: 239 -SCORES: ^^^^^a^aa[LT_abXbeea]Jb]b]d^_a\]K]T]edK]VV]bdH[[Ybc\_cdegccabeeddWY\_Kac\KRZadddd^Zabbdbbbd^aZ^aRY``WW^YIIYb```WWYYYYY^^WIH`bHMW^HIY^^^YO^bd``dWIISZWZ``Y^^YWY^^W^ddY`b^ZSQMHS^IYYWHMFFFMMFMWbW`HW``dY`Z^FOY^b`dd^WFFS`W^IWFOHFFWIOINYbWYbdb^YY +SCORES: ?????B?BB!-5@BC9CFFB!+C!C!E?@B=!,!5!FE,!77!CE)!!:CD=@DEFHDDBCFFEE8:=@,BD=,3;BEEEE?;BCCECCCE?B;?B3:AA88?:**:CAAA88:::::??8*)AC).8?)*:???:0?CEAAE8**4;8;AA:??:8:??8?EE:AC?;42.)4?*::8).'''..'.8C8A)8AAE:A;?'0:?CAEE?8''4A8?*8'0)''8*0*/:C8:CEC?:: --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:13072:2276 2:N:0:14 SEQ: GTTTGCTCCCCACGCTTTCGTTCCTCAGCGTCAGTATAGGCCCAGTAAGCTGCCTTCGCCTTTGATGTTCCTCCTGATATCTACGCATTTCACCGCTACACCAGGAATTCCGCTTACCTCTACCTCACTCAAGACTGACAGTATTGAAACCGTTCCCCCGGTTAAGCCGCGGTCTTTTAATTCCAACTGATCAGT SEQ_LEN: 195 -SCORES: [[[]]LTL_____bdddddd``bdN`]bLV_VbdXXX`MX`dddJb\beec_ac_\dJXbT]d`bb\`Tb`_dc]bdccdddccccdXccddcccccbbdcd_cXXcccXXZXXPcIR_XIQIO_ZWWIOIIX____ZIWVIZ_WZGNZUXFLNNNUGWFQLSUZUGUFFFMGFNUGGNNMMUUUUGUU[[Z[d[ +SCORES: !!!!!-5-@@@@@CEEEEEEAACE/A!C-7@7CE999A.9AEEE+C=CFFD@BD@=E+9C5!EACC=A5CA@ED!CEDDEEEDDDDE9DDEEDDDDDCCEDE@D99DDD99;991D*3@9*2*0@;88*0**9@@@@;*87*;@8;(/;69'-///6(8'2-46;6(6'''.('/6((//..6666(66!!;!E! --- diff --git a/bp_test/in/mask_seq.in b/bp_test/in/mask_seq.in index 1fdab88..ddb405f 100644 --- a/bp_test/in/mask_seq.in +++ b/bp_test/in/mask_seq.in @@ -1,5 +1,5 @@ SEQ_NAME: HWI-EAS157_20FFGAAXX:2:1:888:434 SEQ: TTGGTCGCTCGCTCCGCGACCTCAGATCAGACGTGGGCGAT SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI --- diff --git a/bp_test/in/mean_scores.in b/bp_test/in/mean_scores.in index b68bba0..692240b 100644 --- a/bp_test/in/mean_scores.in +++ b/bp_test/in/mean_scores.in @@ -1,15 +1,15 @@ SEQ_NAME: test1 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhhhhhhh +SCORES: IIIIIIIIIIIIIIIIIIII --- SEQ_NAME: test2 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: @@@@@hhhhhhhhhhhhhhh +SCORES: !!!!!IIIIIIIIIIIIIII --- SEQ_NAME: test3 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhh@@@@@ +SCORES: IIIIIIIIIIIIIII!!!!! --- diff --git a/bp_test/in/read_fastq.in.1 b/bp_test/in/read_fastq.in.1 index c070506..3e2f9f2 100644 --- a/bp_test/in/read_fastq.in.1 +++ b/bp_test/in/read_fastq.in.1 @@ -1,8 +1,8 @@ -@sanger -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +@base_33 +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + -!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI -@illumina1.8 -eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ +@base_64 +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + -!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ +;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ diff --git a/bp_test/in/read_fastq.in.1.gz b/bp_test/in/read_fastq.in.1.gz new file mode 100644 index 0000000000000000000000000000000000000000..b4bd9ae34e3e8868b5e9cc292b0831f1a9b0461b GIT binary patch literal 148 zcmV;F0BipriwFpK=QU9P19W+G0CPx6EKZF#Hs(sCDd5uPQdCk_QB_md(A3h_(bdy8 zFf=kYF*P%{u(Yzav9+^zaCCBZadmU|@bvQb@%8f$2n-4i2@MO6h>VJkiH(a-NK8sj zNli=7$jr*l$<50zC@d;2DJ?6nsI024sjcI30DHvDge!>(0O(w*I0^utK;`9L0RRA{ CQA4}{ literal 0 HcmV?d00001 diff --git a/bp_test/in/read_fastq.in.2 b/bp_test/in/read_fastq.in.2 index 99cfaa0..eb1c805 100644 --- a/bp_test/in/read_fastq.in.2 +++ b/bp_test/in/read_fastq.in.2 @@ -1,12 +1,4 @@ -@solexa -bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +@base_64 +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + -;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh -@illumina1.3 -ccccccccccccccccccccccccccccccccccccccccc -+ -@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh -@illumina1.5 -ddddddddddddddddddddddddddddddddddddddd -+ -BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ diff --git a/bp_test/in/read_fastq.in.2.gz b/bp_test/in/read_fastq.in.2.gz deleted file mode 100644 index 77cce5eb73da34c6e6b6a0ed79017c6a37d51d4f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 115 zcmV-(0F3`1iwFp1f`m^119W+G0COnL&q=LFKSt-6AOU$kY$A_ VR|;_eXaTXt0|0CwVniwd003EgFZKWc diff --git a/bp_test/in/trim_seq.in b/bp_test/in/trim_seq.in index 6fb0b4e..c929627 100644 --- a/bp_test/in/trim_seq.in +++ b/bp_test/in/trim_seq.in @@ -1,5 +1,5 @@ SEQ_NAME: test SEQ: gatcgatcgtacgagcagcatctgacgtatcgatcgttgattagttgctagctatgcagtctacgacgagcatgctagctag SEQ_LEN: 82 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghhgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDChhh +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$III --- diff --git a/bp_test/in/write_fastq.in b/bp_test/in/write_fastq.in index 4944eb4..704ffb0 100644 --- a/bp_test/in/write_fastq.in +++ b/bp_test/in/write_fastq.in @@ -1,15 +1,5 @@ -SEQ_NAME: sanger +SEQ_NAME: base_33 SEQ: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh ---- -SEQ_NAME: solexa -SEQ: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -SEQ_LEN: 46 -SCORES: ;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh ---- -SEQ_NAME: illumina1.3 -SEQ: ccccccccccccccccccccccccccccccccccccccccc -SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI --- diff --git a/bp_test/in/write_fastq_files.in b/bp_test/in/write_fastq_files.in index af87078..a0b34ee 100644 --- a/bp_test/in/write_fastq_files.in +++ b/bp_test/in/write_fastq_files.in @@ -1,19 +1,19 @@ -SEQ: TTCGGCATCGGCGGCGACGTTGGCGGCGGGGCCGGGCGGGTCGANNNCAT -SEQ_LEN: 50 -SCORES: ffeaffd`ce`eecccKLT`bT^]bYHV^BBBBBBBBBBBBBBBBBBBBB +SCORES: CEEECC;EFFH=EGBE=CE +SEQ: TAGGGAATCTTGCACAATGGGGGAAACCCTGATGCAGCGA +SEQ_LEN: 40 +SEQ_NAME: test2 --- -SEQ_NAME: ILLUMINA-52179E -SEQ: CTGATGCATGAAGATAGTCGGATGCACAATATACACGGCTAACGCNNAGG -SEQ_LEN: 50 -SCORES: ffffcfffffded^eddddddbdcdeedcefecfefdffecabccBB`b` +SCORES: 55?????B?BB<-5@BC9CFFB>+C>C>E?@B=>,>5>FE +SEQ: TGGGGAATTTTGCGCAATGGGCGAAAGCCTGACGCAGCAA +SEQ_LEN: 40 +SEQ_NAME: test2 --- diff --git a/bp_test/out/assemble_pairs.out.1 b/bp_test/out/assemble_pairs.out.1 index 1e92ed0..a4c5688 100644 --- a/bp_test/out/assemble_pairs.out.1 +++ b/bp_test/out/assemble_pairs.out.1 @@ -1,25 +1,25 @@ SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:14862:1868:14 SEQ: TGGGGAATATTGGACAATGGGGGCAACCCTGATCCAGCAATACCGCGTGTGTGAAGAAGGCCTGAGGGTTGTAAAGCACTTTCAATTGTGAAGAAAAGTTAACGGTTAATAACCGTTAGCCTTGACGTTAACTTTAGAAGAAGCACCGGCTAACTCCGTGCCAGCAGCCGCGGTAATACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCGTAAAGCGTGCGTAGGCGGTTTATTAAGTCAGATGTGAAAGCCCCGGGCTTAACCTGGGAACTGCATTTGAAACTGGTCAACTAGAGTATGGTAGAGGAAAGTGGAATTTCTGGTGTAGCGGTGAAATGCGTAGATATCAGAAGGAACATCAATGGCGAAGGCAGCTTTCTGGACCAATACTGACGCTGAGGTACGAAAGCGTGGGTAGCAAACAGG SEQ_LEN: 429 -SCORES: [^^^^^^accccccccfffffffgghhhdghggeffgeggfgeggcgdgdgge`eefeegeggeegggdeddggggggggggggeeegeggggggggggggfacdffffffffffffffffdfdfffffbdffffdbbdbdddbfff[`cfbfffdffdfffffdfbdW]Q]cb[dddffb^[cfbbbdbYb^bbdffffXXHPIPI]MMWNNHDHOIYYVFHOMHPSFHQMSW`X\@]^[Y`IX\_XX``ZSFWcW^YYY`^PIH\KK\\db\\KK`beb``dab\`debdadcacddcdc\dcc\^aeaecea]cee_eeegggggggggfffccggggegcghgggghhhhhggefbeeggd]ddcef^ghgfeffeeeee^bcbd^XedgcggfdZeZhgeegeeeddeccccca[L[aa^^^^^ +SCORES: "??????BDDDDDDDDGGGGGGGHHIIIEHIHHFGGHFHHGHFHHDHEHEHHFAFFGFFHFHHFFHHHEFEEHHHHHHHHHHHHFFFHFHHHHHHHHHHHHGBDEGGGGGGGGGGGGGGGGEGEGGGGGCEGGGGECCECEEECGGG"ADGCGGGEGGEGGGGGEGCE8"2"DC"EEEGGC?"DGCCCEC:C?CCEGGGG99)1*1*>..8//)%)0*::7')0.)14')2.48A9=!>?<:A*9=@99AA;4'8D8?:::A?1*)=,,==EC==,,ACFCAAEBC=AEFCEBEDBDEEDED=EDD=?BFBFDFB"DFF@FFFHHHHHHHHHGGGDDHHHHFHDHIHHHHIIIIIHHFGCFFHHE"EEDFG?HIHGFGGFFFFF?CDCE?9FEHDHHGE;F;IHFFHFFFEEFDDDDDB"-"BB????? --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:13906:2139:14 SEQ: TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCTTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGGTGGTGAAATCCCAGAGCTTAACTCTGGAACTGCCATCAAAACTTTTTAGCTAGAGTATGATAGAGGAAAGCAGAATTTCTAGTGTAGAGGTGAAATTCGTAGATATTAGAAAGAATACCGATTGCGAAGGCAGCTTTCTGGATCATTACTGACGCTGAGGAACGAAAGCATGGGTAGCGAAGA SEQ_LEN: 402 -SCORES: [^^^X^aaacaccacceeeeeeggghegegghggeggggdccdfgggbdgd^degefgegeghghhhgbdbdgggheghhhgfgeggggggddeeeeeddeeedeeedddddeeeeeeebdeaddcdeeeeeededeeddeeeecccc`^dddee]Y_YI^VMHMSHPIIZ\WYa`^[I]PWI]^]W_a`Y\Y]WXH\`aa_WXPIYaZY]`_@MOX\WUOFMHVXI]a]I]I]^IY][SI@MMZ\_`][X`\`ddbbddddca\eededddcdeeeaeeeee^Mgecacc^eegegeeegeeeggffffbae`gghgegggfbffhhhgggfdT]geacd_d_cfgggeeeghggeefecbO^d^egdgdghhggeghgegeeeeeeccaca`cc^aa^^[ +SCORES: "???9?BBBDBDDBDDFFFFFFHHHIFHFHHIHHFHHHHEDDEGHHHCEHE?EFHFGHFHFHIHIIIHCECEHHHIFHIIIHGHFHHHHHHEEFFFFFEEFFFEFFFEEEEEFFFFFFFCEFBEEDEFFFFFFEFEFFEEFFFFDDDDA?EEEFF>:@:*?7.).4)1**?=8:BA?<*>18*>?>8@BA:=:>89)=ABB@891*:B?:>A@!.09=860'.)79*>B>*>*>?*:><4*!..;C@A><9A=AEECCEEEEDB=FFEFEEEDEFFFBFFFFF?.HFDBDD?FFHFHFFFHFFFHHGGGGCBFAHHIHFHHHGCGGIIIHHHGE5"HFBDE@E@DGHHHFFFHIHHFFGFDC0?E?FHEHEHIIHHFHIHFHFFFFFFDDBDBADD?BB??" --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:14865:2158:14 SEQ: TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCTTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGGTGGTGAAATCCCAGAGCTTAACTCTGGAACTGCCATCAAAACTTTTTAGCTAGAGTATGATAGAGGAAAGCAGAATTTCTAGTGTAGAGGTGAAATTCGTAGATATTAGAAAGAATACCGATTGCGAAGGCAGCTTTCTGGATCATTACTGACACTGAGGAACGAAAGCATGGGTAGCGAAG SEQ_LEN: 401 -SCORES: ^^^^^aaaaaccaccaeeeeeedbgegegegfggefc^]begggggg]cddeeeeceege_eggghegddggghhggghghgggcdggggeddeee^eddddeddeeddY]bddedeeeadddddcdedYY`dY^`dbdede^`]ZcWWZbddd_YYION__]_WY_VO[SLHX_`]X_^YOOWIY^Y__`aY`\XI\^W]^]VIONIY_`^XI\X^^YVIUVHXIVNY]IYXWIIPIIPP[\X_]`_Y\bbZddddddcddccZ\cea^eeceeea^b\eeee^ggecc_Mcbeggegggfeggeggfdbaeeede^bgefd`^^ggghgggeb]d_ccdccegggcgffead^b\ee^bb^\e^bge`XbOfageegeZgeee^eeaaaaa^aa^a^^[ +SCORES: ?????BBBBBDDBDDBFFFFFFECHFHFHFHGHHFGD?"CFHHHHHH"DEEFFFFDFFHF@FHHHIFHEEHHHIIHHHIHIHHHDEHHHHFEEFFF?FEEEEFEEFFEE:"CEEFEFFFBEEEEEDEFE::AE:?AECEFEF?A";D88;CEEE@::*0/@@>@8:@70<4-)9@A>9@?:008*:?:@@AB:A=9*=?8>?>7*0/*:@A?9*=9??:7*67)9*7/:>*:98**1**11<=9@>A@:=CC;EEEEEEDEEDD;=DFB?FFDFFFB?C=FFFF?HHFDD@.DCFHHFHHHGFHHFHHGECBFFFEF?CHFGEA??HHHIHHHFC"E@DDEDDFHHHDHGGFBE?C=FF?CC?=F?CHFA9C0GBHFFHF;HFFF?FFBBBBB?BB?B??" --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:17246:2253:14 SEQ: AGGGAATCTTGCACAATGGGGGAAACCCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCCTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGATGGTGAAATCCCAAGGCTCAACCTTGGAACTGCCATCAAAACTTTTTAGCTAGAGTATGATAGAGGAAAGTGGAATTTCTAGTGTAGAGGTGAAATTCGTAGATATTAGAAAGAACATCAAAAGCGAAGGCAACTTTCTGGATCATTACTGACACTGAGGAACGAAAGCATGGGTAGCGAAGAGG SEQ_LEN: 403 -SCORES: [^^^aL[L^[aaaaaeeeZ]bdddbbZdeeg\dfad\bdegc_bcbd]J]Tb\ea`d`cgedggggggdbbf\bc\bbe\cb\cc`bddTYcddddbadbdbR^RZ^aY_bdddbddb^bb^^^^d^b```d^`bdddddddd^^^^`ZHYY`^_a]O_]@RUMFHEHOPH_]YXaa]XX[VIVXXYI\I]IXFNUFVVOVOIIOP`V]`IISILX_a^IYINON]XX\IIOIHIKVWMHNWXINX\XKSMdeddddccdeacceeeeeeggggeebbM^geebegececceefaaggggefcggffaghgghhgggcfgggedbgghhgegfd`Jggeb_dghhggfedfggefcgfccbO^ffefbXO`Ocaeehhgegeeeeeaaaaacaa^^aa^^^^^ +SCORES: "???B-"-?"BBBBBFFF;"CEEECC;EFFH=EGBE=CEFHD@CDCE"+"5C=FBAEADHFEHHHHHHECCG=CD=CCF=DC=DDACEE5:DEEEECBECEC3?3;?B:@CEEECEEC?CC????E?CAAAE?ACEEEEEEEE????A;)::A?@B>0@>!36.')&)01)@>:9BB>99<7*799:*=*>*9'/6'77070**01A7>A**4*-9@B?*:*/0/>99=**0*)*,78.)/89*/9=9,4.EFEEEEDDEFBDDFFFFFFHHHHFFCC.?HFFCFHFDFDDFFGBBHHHHFGDHHGGBHIHHIIHHHDGHHHFECHHIIHFHGEA+HHFC@EHIIHHGFEGHHFGDHGDDC0?GGFGC90A0DBFFIIHFHFFFFFBBBBBDBB??BB????? --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:13072:2276:14 SEQ: GGGAATTTTGCGCAATGGGCGAAAGCCTGACGCAGCAACGCCGCGGGATCGAAGAAGCTCTGCGGAGTGTAAAGATCTGTCATAAGGGAAGAATAACGAGTATTCTAACAAAATATTCGTCTGACGGTACCTTATAAGAAAGCCACGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAGGGGGGCAAGCGTTATCCGGAATCATTGGGCGTAAAGGGGTCGTATGAGGACTGATCAGTTGGAATTAAAAGACCGCGGCTTAACCGGGGGAACGGTTTCAATACTGTCAGTCTTGAGTGAGGTAGAGGTAAGCGGAATTCCTGGTGTAGCGGTGAAATGCGTAGATATCAGGAGGAACATCAAAGGCGAAGGCAGCTTACTGGGCCTATACTGACGCTGAGGAACGAAAGCGTGGGGAGCAAAC SEQ_LEN: 425 -SCORES: ^^^^^a^aa[LT_abXbeea]Jb]b]d^_a\]K]T]edK]VV]bdH[[Ybc\_cdegccabeeddWY\_Kac\KRZadddd^Zabbdbbbd^aZ^aRY``WW^YIIYb```WWYYYYY^^WIH`bHMW^HIY^^^YO^bd``dWIISZWZ``Y^^YWY^^W^ddY`b^ZSQMHS^IYYWHMFFFMMFMWbW`HW``dY`Z^FOY^b`dd^WFFS`W^IWFOHFFWIOINYZWWYZZTTGUUUUMMNNGGUNFGMFFFUGUZUSLQFWGUNNNLFXUZNGZW_ZIVWIZ____XIIOIWWZ_OIQIX_RIcPXXZXXcccXXc_dcdbbcccccddccXdccccdddccdb]cd_`bT`\bb`d]TbXJd\_ca_ceeb\bJddd`XM`XXXdbV_VLb]`Ndb``ddddddb_____LTL]][[[ +SCORES: ?????B?BB"-5@BC9CFFB"+C"C"E?@B=","5"FE,"77"CE)"":CD=@DEFHDDBCFFEE8:=@,BD=,3;BEEEE?;BCCECCCE?B;?B3:AA88?:**:CAAA88:::::??8*)AC).8?)*:???:0?CEAAE8**4;8;AA:??:8:??8?EE:AC?;42.)4?*::8).'''..'.8C8A)8AAE:A;?'0:?CAEE?8''4A8?*8'0)''8*0*/:C8::EC55(6666..//((6/'(.'''6(6;64-2'8(6///-'96;/(;8@;*78*;@@@@9**0*88;@0*2*9@3*D199;99DDD99D@EDECCDDDDDEEDD9EDDDDEEEDDEC"DE@AC5A=CCAE"5C9+E=@DB@DFFC=C+EEEA9.A999EC7@7-C"A/ECAAEEEEEEC@@@@@-5-""""" --- diff --git a/bp_test/out/assemble_pairs.out.2 b/bp_test/out/assemble_pairs.out.2 index ee642cb..927fdea 100644 --- a/bp_test/out/assemble_pairs.out.2 +++ b/bp_test/out/assemble_pairs.out.2 @@ -1,15 +1,15 @@ SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:13906:2139:14 SEQ: TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCTTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGGTGGTGAAATCCCAGAGCTTAACTCTGGAACTGCCATCAAAACTTTTTAGCTAGAGTATGATAGAGGAAAGCAGAATTTCTAGTGTAGAGGTGAAATTCGTAGATATTAGAAAGAATACCGATTGCGAAGGCAGCTTTCTGGATCATTACTGACGCTGAGGAACGAAAGCATGGGTAGCGAAGA SEQ_LEN: 402 -SCORES: [^^^X^aaacaccacceeeeeeggghegegghggeggggdccdfgggbdgd^degefgegeghghhhgbdbdgggheghhhgfgeggggggddeeeeeddeeedeeedddddeeeeeeebdeaddcdeeeeeededeeddeeeecccc`^dddee]Y_YI^VMHMSHPIIZ\WYa`^[I]PWI]^]W_a`Y\Y]WXH\`aa_WXPIYaZY]`_@MOX\WUOFMHVXI]a]I]I]^IY][SI@MMZ\_`][X`\`ddbbddddca\eededddcdeeeaeeeee^Mgecacc^eegegeeegeeeggffffbae`gghgegggfbffhhhgggfdT]geacd_d_cfgggeeeghggeefecbO^d^egdgdghhggeghgegeeeeeeccaca`cc^aa^^[ +SCORES: "???9?BBBDBDDBDDFFFFFFHHHIFHFHHIHHFHHHHEDDEGHHHCEHE?EFHFGHFHFHIHIIIHCECEHHHIFHIIIHGHFHHHHHHEEFFFFFEEFFFEFFFEEEEEFFFFFFFCEFBEEDEFFFFFFEFEFFEEFFFFDDDDA?EEEFF>:@:*?7.).4)1**?=8:BA?<*>18*>?>8@BA:=:>89)=ABB@891*:B?:>A@!.09=860'.)79*>B>*>*>?*:><4*!..;C@A><9A=AEECCEEEEDB=FFEFEEEDEFFFBFFFFF?.HFDBDD?FFHFHFFFHFFFHHGGGGCBFAHHIHFHHHGCGGIIIHHHGE5"HFBDE@E@DGHHHFFFHIHHFFGFDC0?E?FHEHEHIIHHFHIHFHFFFFFFDDBDBADD?BB??" --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:14865:2158:14 SEQ: TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCTTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGGTGGTGAAATCCCAGAGCTTAACTCTGGAACTGCCATCAAAACTTTTTAGCTAGAGTATGATAGAGGAAAGCAGAATTTCTAGTGTAGAGGTGAAATTCGTAGATATTAGAAAGAATACCGATTGCGAAGGCAGCTTTCTGGATCATTACTGACACTGAGGAACGAAAGCATGGGTAGCGAAG SEQ_LEN: 401 -SCORES: ^^^^^aaaaaccaccaeeeeeedbgegegegfggefc^]begggggg]cddeeeeceege_eggghegddggghhggghghgggcdggggeddeee^eddddeddeeddY]bddedeeeadddddcdedYY`dY^`dbdede^`]ZcWWZbddd_YYION__]_WY_VO[SLHX_`]X_^YOOWIY^Y__`aY`\XI\^W]^]VIONIY_`^XI\X^^YVIUVHXIVNY]IYXWIIPIIPP[\X_]`_Y\bbZddddddcddccZ\cea^eeceeea^b\eeee^ggecc_Mcbeggegggfeggeggfdbaeeede^bgefd`^^ggghgggeb]d_ccdccegggcgffead^b\ee^bb^\e^bge`XbOfageegeZgeee^eeaaaaa^aa^a^^[ +SCORES: ?????BBBBBDDBDDBFFFFFFECHFHFHFHGHHFGD?"CFHHHHHH"DEEFFFFDFFHF@FHHHIFHEEHHHIIHHHIHIHHHDEHHHHFEEFFF?FEEEEFEEFFEE:"CEEFEFFFBEEEEEDEFE::AE:?AECEFEF?A";D88;CEEE@::*0/@@>@8:@70<4-)9@A>9@?:008*:?:@@AB:A=9*=?8>?>7*0/*:@A?9*=9??:7*67)9*7/:>*:98**1**11<=9@>A@:=CC;EEEEEEDEEDD;=DFB?FFDFFFB?C=FFFF?HHFDD@.DCFHHFHHHGFHHFHHGECBFFFEF?CHFGEA??HHHIHHHFC"E@DDEDDFHHHDHGGFBE?C=FF?CC?=F?CHFA9C0GBHFFHF;HFFF?FFBBBBB?BB?B??" --- SEQ_NAME: M01168:16:000000000-A1R9L:1:1101:17246:2253:14 SEQ: AGGGAATCTTGCACAATGGGGGAAACCCTGATGCAGCGATGCCGCGTGAGTGAAGAAGGCCCTTGGGTTGTAAAGCTCTTTCGTCGGGGAAGAAAATGACTGTACCCGAATAAGAAGGTCCGGCTAACTTCGTGCCAGCAGCCGCGGTAATACGAAGGGACCTAGCGTAGTTCGGAATTACTGGGCTTAAAGAGTTCGTAGGTGGTTAAAAAAGTTGATGGTGAAATCCCAAGGCTCAACCTTGGAACTGCCATCAAAACTTTTTAGCTAGAGTATGATAGAGGAAAGTGGAATTTCTAGTGTAGAGGTGAAATTCGTAGATATTAGAAAGAACATCAAAAGCGAAGGCAACTTTCTGGATCATTACTGACACTGAGGAACGAAAGCATGGGTAGCGAAGAGG SEQ_LEN: 403 -SCORES: [^^^aL[L^[aaaaaeeeZ]bdddbbZdeeg\dfad\bdegc_bcbd]J]Tb\ea`d`cgedggggggdbbf\bc\bbe\cb\cc`bddTYcddddbadbdbR^RZ^aY_bdddbddb^bb^^^^d^b```d^`bdddddddd^^^^`ZHYY`^_a]O_]@RUMFHEHOPH_]YXaa]XX[VIVXXYI\I]IXFNUFVVOVOIIOP`V]`IISILX_a^IYINON]XX\IIOIHIKVWMHNWXINX\XKSMdeddddccdeacceeeeeeggggeebbM^geebegececceefaaggggefcggffaghgghhgggcfgggedbgghhgegfd`Jggeb_dghhggfedfggefcgfccbO^ffefbXO`Ocaeehhgegeeeeeaaaaacaa^^aa^^^^^ +SCORES: "???B-"-?"BBBBBFFF;"CEEECC;EFFH=EGBE=CEFHD@CDCE"+"5C=FBAEADHFEHHHHHHECCG=CD=CCF=DC=DDACEE5:DEEEECBECEC3?3;?B:@CEEECEEC?CC????E?CAAAE?ACEEEEEEEE????A;)::A?@B>0@>!36.')&)01)@>:9BB>99<7*799:*=*>*9'/6'77070**01A7>A**4*-9@B?*:*/0/>99=**0*)*,78.)/89*/9=9,4.EFEEEEDDEFBDDFFFFFFHHHHFFCC.?HFFCFHFDFDDFFGBBHHHHFGDHHGGBHIHHIIHHHDGHHHFECHHIIHFHGEA+HHFC@EHIIHHGFEGHHFGDHGDDC0?GGFGC90A0DBFFIIHFHFFFFFBBBBBDBB??BB????? --- diff --git a/bp_test/out/mask_seq.out.1 b/bp_test/out/mask_seq.out.1 index b508a2a..fc8b6fd 100644 --- a/bp_test/out/mask_seq.out.1 +++ b/bp_test/out/mask_seq.out.1 @@ -1,5 +1,5 @@ SEQ_NAME: HWI-EAS157_20FFGAAXX:2:1:888:434 SEQ: ttggtcgctcgctccgcgacCTCAGATCAGACGTGGGCGAT SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI --- diff --git a/bp_test/out/mask_seq.out.2 b/bp_test/out/mask_seq.out.2 index 1fdab88..ddb405f 100644 --- a/bp_test/out/mask_seq.out.2 +++ b/bp_test/out/mask_seq.out.2 @@ -1,5 +1,5 @@ SEQ_NAME: HWI-EAS157_20FFGAAXX:2:1:888:434 SEQ: TTGGTCGCTCGCTCCGCGACCTCAGATCAGACGTGGGCGAT SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI --- diff --git a/bp_test/out/mask_seq.out.3 b/bp_test/out/mask_seq.out.3 index 7d38b47..e44cc52 100644 --- a/bp_test/out/mask_seq.out.3 +++ b/bp_test/out/mask_seq.out.3 @@ -1,5 +1,5 @@ SEQ_NAME: HWI-EAS157_20FFGAAXX:2:1:888:434 SEQ: NNNNNNNNNNNNNNNNNNNNCTCAGATCAGACGTGGGCGAT SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI --- diff --git a/bp_test/out/mean_scores.out.1 b/bp_test/out/mean_scores.out.1 index affde14..ce1d8c1 100644 --- a/bp_test/out/mean_scores.out.1 +++ b/bp_test/out/mean_scores.out.1 @@ -1,18 +1,18 @@ SEQ_NAME: test1 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhhhhhhh +SCORES: IIIIIIIIIIIIIIIIIIII SCORES_MEAN: 40.0 --- SEQ_NAME: test2 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: @@@@@hhhhhhhhhhhhhhh +SCORES: !!!!!IIIIIIIIIIIIIII SCORES_MEAN: 30.0 --- SEQ_NAME: test3 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhh@@@@@ +SCORES: IIIIIIIIIIIIIII!!!!! SCORES_MEAN: 30.0 --- diff --git a/bp_test/out/mean_scores.out.2 b/bp_test/out/mean_scores.out.2 index bd5ab60..18bd153 100644 --- a/bp_test/out/mean_scores.out.2 +++ b/bp_test/out/mean_scores.out.2 @@ -1,18 +1,18 @@ SEQ_NAME: test1 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhhhhhhh +SCORES: IIIIIIIIIIIIIIIIIIII SCORES_MEAN_LOCAL: 40.0 --- SEQ_NAME: test2 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: @@@@@hhhhhhhhhhhhhhh +SCORES: !!!!!IIIIIIIIIIIIIII SCORES_MEAN_LOCAL: 0.0 --- SEQ_NAME: test3 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhh@@@@@ +SCORES: IIIIIIIIIIIIIII!!!!! SCORES_MEAN_LOCAL: 0.0 --- diff --git a/bp_test/out/mean_scores.out.3 b/bp_test/out/mean_scores.out.3 index 57fb50b..d162b72 100644 --- a/bp_test/out/mean_scores.out.3 +++ b/bp_test/out/mean_scores.out.3 @@ -1,18 +1,18 @@ SEQ_NAME: test1 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhhhhhhh +SCORES: IIIIIIIIIIIIIIIIIIII SCORES_MEAN_LOCAL: 40.0 --- SEQ_NAME: test2 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: @@@@@hhhhhhhhhhhhhhh +SCORES: !!!!!IIIIIIIIIIIIIII SCORES_MEAN_LOCAL: 20.0 --- SEQ_NAME: test3 SEQ: AAAAAAAAAAAAAAAAAAAA SEQ_LEN: 20 -SCORES: hhhhhhhhhhhhhhh@@@@@ +SCORES: IIIIIIIIIIIIIII!!!!! SCORES_MEAN_LOCAL: 20.0 --- diff --git a/bp_test/out/read_fastq.out.1 b/bp_test/out/read_fastq.out.1 index 0d70eb8..204f785 100644 --- a/bp_test/out/read_fastq.out.1 +++ b/bp_test/out/read_fastq.out.1 @@ -1,10 +1,10 @@ -SEQ_NAME: sanger -SEQ: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SEQ_NAME: base_33 +SEQ: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +SEQ_LEN: 94 +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII --- -SEQ_NAME: illumina1.8 -SEQ: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee -SEQ_LEN: 42 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi +SEQ_NAME: base_64 +SEQ: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +SEQ_LEN: 68 +SCORES: ;<=>?@ABCDEFGHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII --- diff --git a/bp_test/out/read_fastq.out.2 b/bp_test/out/read_fastq.out.2 index a8451fb..7f21147 100644 --- a/bp_test/out/read_fastq.out.2 +++ b/bp_test/out/read_fastq.out.2 @@ -1,15 +1,5 @@ -SEQ_NAME: solexa -SEQ: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -SEQ_LEN: 46 -SCORES: ;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh ---- -SEQ_NAME: illumina1.3 -SEQ: ccccccccccccccccccccccccccccccccccccccccc -SEQ_LEN: 41 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh ---- -SEQ_NAME: illumina1.5 -SEQ: ddddddddddddddddddddddddddddddddddddddd -SEQ_LEN: 39 -SCORES: BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SEQ_NAME: base_64 +SEQ: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +SEQ_LEN: 68 +SCORES: !!!!!!"#$%&'()*+,-./0123456789:;!=!?@ABCDEFGHIIIIIIIIIIIIIIIIIIIIIII --- diff --git a/bp_test/out/read_fastq.out.3 b/bp_test/out/read_fastq.out.3 index 923c528..8ea95bc 100644 --- a/bp_test/out/read_fastq.out.3 +++ b/bp_test/out/read_fastq.out.3 @@ -1,5 +1,5 @@ -SEQ_NAME: solexa -SEQ: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -SEQ_LEN: 46 -SCORES: ;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +SEQ_NAME: base_33 +SEQ: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +SEQ_LEN: 94 +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII --- diff --git a/bp_test/out/scores_to_dec.out.1 b/bp_test/out/scores_to_dec.out.1 index ddd77d4..11d5510 100644 --- a/bp_test/out/scores_to_dec.out.1 +++ b/bp_test/out/scores_to_dec.out.1 @@ -1,2 +1,2 @@ -SCORES: -31;-30;-29;-28;-27;-26;-25;-24;-23;-22;-21;-20;-19;-18;-17;-16;-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;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36;37;38;39;40;41;42;43;44;45;46;47;48;49;50;51;52;53;54;55;56;57;58;59;60;61;62 +SCORES: 0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58; 59; 60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77; 78; 79; 80; 81; 82; 83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93 --- diff --git a/bp_test/out/trim_seq.out.1 b/bp_test/out/trim_seq.out.1 index 7dcd2d9..de1bff4 100644 --- a/bp_test/out/trim_seq.out.1 +++ b/bp_test/out/trim_seq.out.1 @@ -1,5 +1,5 @@ SEQ_NAME: test SEQ: tctgacgtatcgatcgttgattagttgctagctatgcagtctacgacgagcatgctagctag SEQ_LEN: 62 -SCORES: TUVWXYZ[\]^_`abcdefghhgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDChhh +SCORES: 56789:;<=>?@ABCDEFGHIIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$III --- diff --git a/bp_test/out/trim_seq.out.2 b/bp_test/out/trim_seq.out.2 index 8a5de87..588dea5 100644 --- a/bp_test/out/trim_seq.out.2 +++ b/bp_test/out/trim_seq.out.2 @@ -1,5 +1,5 @@ SEQ_NAME: test SEQ: cgtatcgatcgttgattagttgctagctatgcagtctacgacgagcatgctagctag SEQ_LEN: 57 -SCORES: YZ[\]^_`abcdefghhgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDChhh +SCORES: :;<=>?@ABCDEFGHIIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$III --- diff --git a/bp_test/out/trim_seq.out.3 b/bp_test/out/trim_seq.out.3 index 7dcd2d9..de1bff4 100644 --- a/bp_test/out/trim_seq.out.3 +++ b/bp_test/out/trim_seq.out.3 @@ -1,5 +1,5 @@ SEQ_NAME: test SEQ: tctgacgtatcgatcgttgattagttgctagctatgcagtctacgacgagcatgctagctag SEQ_LEN: 62 -SCORES: TUVWXYZ[\]^_`abcdefghhgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDChhh +SCORES: 56789:;<=>?@ABCDEFGHIIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$III --- diff --git a/bp_test/out/trim_seq.out.4 b/bp_test/out/trim_seq.out.4 index 7dcd2d9..de1bff4 100644 --- a/bp_test/out/trim_seq.out.4 +++ b/bp_test/out/trim_seq.out.4 @@ -1,5 +1,5 @@ SEQ_NAME: test SEQ: tctgacgtatcgatcgttgattagttgctagctatgcagtctacgacgagcatgctagctag SEQ_LEN: 62 -SCORES: TUVWXYZ[\]^_`abcdefghhgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDChhh +SCORES: 56789:;<=>?@ABCDEFGHIIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$III --- diff --git a/bp_test/out/trim_seq.out.5 b/bp_test/out/trim_seq.out.5 index 6fb0b4e..c929627 100644 --- a/bp_test/out/trim_seq.out.5 +++ b/bp_test/out/trim_seq.out.5 @@ -1,5 +1,5 @@ SEQ_NAME: test SEQ: gatcgatcgtacgagcagcatctgacgtatcgatcgttgattagttgctagctatgcagtctacgacgagcatgctagctag SEQ_LEN: 82 -SCORES: @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghhgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDChhh +SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$III --- diff --git a/bp_test/out/trim_seq.out.6 b/bp_test/out/trim_seq.out.6 index 246e027..15af051 100644 --- a/bp_test/out/trim_seq.out.6 +++ b/bp_test/out/trim_seq.out.6 @@ -1,5 +1,5 @@ SEQ_NAME: test SEQ: tctgacgtatcgatcgttgattagttgctagctatgcagtct SEQ_LEN: 42 -SCORES: TUVWXYZ[\]^_`abcdefghhgfedcba`_^]\[ZYXWVUT +SCORES: 56789:;<=>?@ABCDEFGHIIHGFEDCBA@?>=<;:98765 --- diff --git a/bp_test/out/write_fastq.out.1 b/bp_test/out/write_fastq.out.1 index cd45b63..b4d2c75 100644 --- a/bp_test/out/write_fastq.out.1 +++ b/bp_test/out/write_fastq.out.1 @@ -1,12 +1,4 @@ -@sanger +@base_33 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + -@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh -@solexa -bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -+ -;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh -@illumina1.3 -ccccccccccccccccccccccccccccccccccccccccc -+ -@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh +!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI diff --git a/bp_test/out/write_fastq.out.2 b/bp_test/out/write_fastq.out.2 index 3772a06..31f2b84 100644 --- a/bp_test/out/write_fastq.out.2 +++ b/bp_test/out/write_fastq.out.2 @@ -1,12 +1,4 @@ -@sanger +@base_33 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + -!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI -@solexa -bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -+ - !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI -@illumina1.3 -ccccccccccccccccccccccccccccccccccccccccc -+ -!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI +@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh diff --git a/bp_test/out/write_fastq_files.out.1/ILLUMINA-52179E.fastq b/bp_test/out/write_fastq_files.out.1/ILLUMINA-52179E.fastq deleted file mode 100644 index 6b11b1f..0000000 --- a/bp_test/out/write_fastq_files.out.1/ILLUMINA-52179E.fastq +++ /dev/null @@ -1,4 +0,0 @@ -@ILLUMINA-52179E -CTGATGCATGAAGATAGTCGGATGCACAATATACACGGCTAACGCNNAGG -+ -ffffcfffffded^eddddddbdcdeedcefecfefdffecabccBB`b` diff --git a/bp_test/out/write_fastq_files.out.1/ILLUMINA.fastq b/bp_test/out/write_fastq_files.out.1/ILLUMINA.fastq deleted file mode 100644 index ed900a7..0000000 --- a/bp_test/out/write_fastq_files.out.1/ILLUMINA.fastq +++ /dev/null @@ -1,8 +0,0 @@ -@ILLUMINA -CATGGCGTATGCCAGACGGCCAGAACGATGGCCGCCGGGCTTCANNNAAG -+ -eeeecac^dddddddeffe`f`fdece\aefeeffcccc\`a``BBBBBB -@ILLUMINA -CGGTACTGATCGAGTGTCAGGCTGTTGATCGCCGCGGGCGGGGGTNNGAC -+ -db`dadddddeeeeedeeeeccdddfffffcdaddbac`d_BBBBBBBBB diff --git a/bp_test/out/write_fastq_files.out.1/test.fastq b/bp_test/out/write_fastq_files.out.1/test.fastq new file mode 100644 index 0000000..56cbf76 --- /dev/null +++ b/bp_test/out/write_fastq_files.out.1/test.fastq @@ -0,0 +1,4 @@ +@test +TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGA ++ +CEEECC;EFFH=EGBE=CE +@test2 +TGGGGAATTTTGCGCAATGGGCGAAAGCCTGACGCAGCAA ++ +55?????B?BB<-5@BC9CFFB>+C>C>E?@B=>,>5>FE diff --git a/bp_test/out/write_fastq_files.out.2/test.fastq b/bp_test/out/write_fastq_files.out.2/test.fastq new file mode 100644 index 0000000..e55226e --- /dev/null +++ b/bp_test/out/write_fastq_files.out.2/test.fastq @@ -0,0 +1,4 @@ +@test +TAGGGAATCTTGCACAATGGAGGAAACTCTGATGCAGCGA ++ +[^^^X^aaacaccacceeeeeeggghegegghggeggggd diff --git a/bp_test/out/write_fastq_files.out.2/test2.fastq b/bp_test/out/write_fastq_files.out.2/test2.fastq new file mode 100644 index 0000000..c15626c --- /dev/null +++ b/bp_test/out/write_fastq_files.out.2/test2.fastq @@ -0,0 +1,8 @@ +@test2 +TAGGGAATCTTGCACAATGGGGGAAACCCTGATGCAGCGA ++ +T[^^^aL[L^[aaaaaeeeZ]bdddbbZdeeg\dfad\bd +@test2 +TGGGGAATTTTGCGCAATGGGCGAAAGCCTGACGCAGCAA ++ +TT^^^^^a^aa[LT_abXbeea]Jb]b]d^_a\]K]T]ed diff --git a/bp_test/test/test_read_fastq b/bp_test/test/test_read_fastq index 6c59764..cf7d324 100755 --- a/bp_test/test/test_read_fastq +++ b/bp_test/test/test_read_fastq @@ -6,14 +6,22 @@ run "$bp -i $in.1 -O $tmp" assert_no_diff $tmp $out.1 clean +run "$bp -i $in.1 -e base_33 -O $tmp" +assert_no_diff $tmp $out.1 +clean + run "$bp -i $in.2 -O $tmp" assert_no_diff $tmp $out.2 clean -run "$bp -i $in.2.gz -O $tmp" +run "$bp -i $in.2 -e base_64 -O $tmp" assert_no_diff $tmp $out.2 clean -run "$bp -i $in.2 -n 1 -O $tmp" +run "$bp -i $in.1.gz -O $tmp" +assert_no_diff $tmp $out.1 +clean + +run "$bp -i $in.1 -n 1 -O $tmp" assert_no_diff $tmp $out.3 clean diff --git a/bp_test/test/test_write_fastq b/bp_test/test/test_write_fastq index 3940140..f3880a2 100755 --- a/bp_test/test/test_write_fastq +++ b/bp_test/test/test_write_fastq @@ -6,11 +6,15 @@ run "$bp -I $in -o $tmp -x" assert_no_diff $tmp $out.1 clean -run "$bp -I $in -e sanger -o $tmp -x" +run "$bp -I $in -e base_33 -o $tmp -x" +assert_no_diff $tmp $out.1 +clean + +run "$bp -I $in -e base_64 -o $tmp -x" assert_no_diff $tmp $out.2 clean -run "$bp -I $in -Z -e sanger -o $tmp.gz -x" +run "$bp -I $in -Z -o $tmp.gz -x" gunzip $tmp.gz -assert_no_diff $tmp $out.2 +assert_no_diff $tmp $out.1 clean diff --git a/bp_test/test/test_write_fastq_files b/bp_test/test/test_write_fastq_files index 2168c26..89442b6 100755 --- a/bp_test/test/test_write_fastq_files +++ b/bp_test/test/test_write_fastq_files @@ -9,3 +9,19 @@ assert_no_diff_dir $tmp_dir $out.1 clean rm -rf $tmp_dir + +mkdir $tmp_dir + +run "$bp -I $in -e base_33 -d $tmp_dir -k SEQ_NAME -x" +assert_no_diff_dir $tmp_dir $out.1 +clean + +rm -rf $tmp_dir + +mkdir $tmp_dir + +run "$bp -I $in -e base_64 -d $tmp_dir -k SEQ_NAME -x" +assert_no_diff_dir $tmp_dir $out.2 +clean + +rm -rf $tmp_dir diff --git a/code_ruby/lib/maasha/seq.rb b/code_ruby/lib/maasha/seq.rb index 4a0af47..c8cc9f1 100644 --- a/code_ruby/lib/maasha/seq.rb +++ b/code_ruby/lib/maasha/seq.rb @@ -73,7 +73,7 @@ class SeqError < StandardError; end class Seq # Quality scores bases - SCORE_BASE = 64 + SCORE_BASE = 33 SCORE_MIN = 0 SCORE_MAX = 40 @@ -550,61 +550,51 @@ class Seq def qual_base33? self.qual.match(/[!-:]/) ? true : false end - - # Method that determines if a quality score string can be - # absolutely identified as base 64. + + # Method that determines if a quality score string may be base 64. def qual_base64? self.qual.match(/[K-h]/) ? true : false end - # Method to determine if a quality score is valid. + # Method to determine if a quality score is valid accepting only 0-40 range. def qual_valid?(encoding) raise SeqError, "Missing qual" if self.qual.nil? - case encoding.downcase - when "sanger" then return true if self.qual.match(/^[!-~]*$/) - when "454" then return true if self.qual.match(/^[@-~]*$/) - when "solexa" then return true if self.qual.match(/^[;-~]*$/) - when "illumina13" then return true if self.qual.match(/^[@-~]*$/) - when "illumina15" then return true if self.qual.match(/^[@-~]*$/) - when "illumina18" then return true if self.qual.match(/^[!-~]*$/) + case encoding + when :base_33 then return true if self.qual.match(/^[!-I]*$/) + when :base_64 then return true if self.qual.match(/^[@-h]*$/) else raise SeqError, "unknown quality score encoding: #{encoding}" end false end - # Method to convert quality scores inbetween formats. - # Sanger base 33, range 0-40 - # 454 base 64, range 0-40 - # Solexa base 64, range -5-40 - # Illumina13 base 64, range 0-40 - # Illumina15 base 64, range 0-40 - # Illumina18 base 33, range 0-41 - def convert_scores!(from, to) - unless from == to - na_qual = NArray.to_na(self.qual, "byte") + # Method to coerce quality scores to be within the 0-40 range. + def qual_coerce!(encoding) + raise SeqError, "Missing qual" if self.qual.nil? - case from.downcase - when "sanger" then na_qual -= 33 - when "454" then na_qual -= 64 - when "solexa" then na_qual -= 64 - when "illumina13" then na_qual -= 64 - when "illumina15" then na_qual -= 64 - when "illumina18" then na_qual -= 33 - else raise SeqError, "unknown quality score encoding: #{from}" - end + case encoding + when :base_33 then self.qual.tr!("[J-~]", "I") + when :base_64 then self.qual.tr!("[i-~]", "h") + else raise SeqError, "unknown quality score encoding: #{encoding}" + end - case to.downcase - when "sanger" then na_qual += 33 - when "454" then na_qual += 64 - when "solexa" then na_qual += 64 - when "illumina13" then na_qual += 64 - when "illumina15" then na_qual += 64 - when "illumina18" then na_qual += 33 - else raise SeqError, "unknown quality score encoding: #{to}" - end + self + end + # Method to convert quality scores. + def qual_convert!(from, to) + raise SeqError, "unknown quality score encoding: #{from}" unless from == :base_33 or from == :base_64 + raise SeqError, "unknown quality score encoding: #{to}" unless to == :base_33 or to == :base_64 + + if from == :base_33 and to == :base_64 + na_qual = NArray.to_na(self.qual, "byte") + na_qual += 64 - 33 + self.qual = na_qual.to_s + elsif from == :base_64 and to == :base_33 + self.qual.tr!("[;-?]", "@") # Handle negative Solexa values from -5 to -1 (set these to 0). + na_qual = NArray.to_na(self.qual, "byte") + na_qual -= 64 - 33 self.qual = na_qual.to_s end @@ -617,6 +607,7 @@ class Seq na_qual = NArray.to_na(self.qual, "byte") na_qual -= SCORE_BASE + na_qual.mean end diff --git a/code_ruby/test/helper.rb b/code_ruby/test/helper.rb new file mode 100644 index 0000000..bcac141 --- /dev/null +++ b/code_ruby/test/helper.rb @@ -0,0 +1,5 @@ +class Test::Unit::TestCase + def self.test(desc, &impl) + define_method("test #{desc}", &impl) + end +end diff --git a/code_ruby/test/maasha/align/test_match.rb b/code_ruby/test/maasha/align/test_match.rb index 40e84f2..d239add 100755 --- a/code_ruby/test/maasha/align/test_match.rb +++ b/code_ruby/test/maasha/align/test_match.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') # Copyright (C) 2013 Martin A. Hansen. @@ -26,48 +26,48 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/align/match' -require 'pp' class MatchTest < Test::Unit::TestCase def setup @match = Match.new(1, 1, 3) end - def test_Match_q_end_returns_correctly + test "#q_end returns correctly" do assert_equal(3, @match.q_end) end - def test_Match_s_end_returns_correctly + test "#s_end returns correctly" do assert_equal(3, @match.s_end) end - def test_Match_to_s_returns_correctly + test "#to_s returns correctly" do assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.to_s) assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0 tcg", @match.to_s("atcg")) end - def test_Match_expand_to_left_end_returns_correctly + test "#expand to left end returns correctly" do assert_equal("q: 0 3 s: 0 3 l: 4 s: 0.0", @match.expand("atcg", "atcg", 0, 0, 3, 3).to_s) end - def test_Match_expand_to_left_mismatch_returns_correctly + test "#expand to left mismatch returns correctly" do assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("gtcg", "atcg", 0, 0, 3, 3).to_s) end - def test_Match_expand_to_left_space_beg_returns_correctly + test "#expand to left space beg returns correctly" do assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("atcg", "atcg", 1, 1, 3, 3).to_s) end - def test_Match_expand_to_right_end_returns_correctly + test "#expand to right end returns correctly" do assert_equal("q: 0 4 s: 0 4 l: 5 s: 0.0", @match.expand("atcga", "atcga", 0, 0, 4, 4).to_s) end - def test_Match_expand_to_right_mismatch_returns_correctly + test "#expand to right mismatch returns correctly" do assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("gtcga", "atcgg", 0, 0, 4, 4).to_s) end - def test_Match_expand_to_right_space_end_returns_correctly + test "#expand to right space end returns correctly" do assert_equal("q: 1 3 s: 1 3 l: 3 s: 0.0", @match.expand("atcga", "atcga", 1, 1, 3, 3).to_s) end end diff --git a/code_ruby/test/maasha/align/test_matches.rb b/code_ruby/test/maasha/align/test_matches.rb index 115e85f..8603055 100755 --- a/code_ruby/test/maasha/align/test_matches.rb +++ b/code_ruby/test/maasha/align/test_matches.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') # Copyright (C) 2012 Martin A. Hansen. @@ -26,33 +26,33 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/align/matches' -require 'pp' class MatchesTest < Test::Unit::TestCase - def test_Matches_find_with_no_match_returns_correctly + test "Matches.find with no match returns correctly" do assert_equal("[]", Matches.find("atcg", "atcg", 0, 0, 3, 3, 8).to_s) end - def test_Matches_find_with_one_match_returns_correctly + test "Matches.find with one match returns correctly" do assert_equal("[q: 2 3 s: 0 1 l: 2 s: 0.0]", Matches.find("01cg", "cg23", 0, 0, 3, 3, 2).to_s) assert_equal("[q: 0 1 s: 2 3 l: 2 s: 0.0]", Matches.find("cg23", "01cg", 0, 0, 3, 3, 2).to_s) end - def test_Matches_find_with_two_matches_returns_correctly + test "Matches.find with two matches returns correctly" do assert_equal("[q: 0 1 s: 0 1 l: 2 s: 0.0, q: 3 4 s: 3 4 l: 2 s: 0.0]", Matches.find("atXcg", "atYcg", 0, 0, 4, 4, 2).to_s) assert_equal("[q: 0 1 s: 0 1 l: 2 s: 0.0, q: 3 4 s: 3 4 l: 2 s: 0.0]", Matches.find("atYcg", "atXcg", 0, 0, 4, 4, 2).to_s) end - def test_Matches_find_dont_expand_match_outside_space + test "Matches.find dont expand match outside space" do assert_equal("[q: 1 2 s: 1 2 l: 2 s: 0.0]", Matches.find("atcg", "atcg", 1, 1, 2, 2, 2).to_s) end - def test_Matches_find_right_expands_correctly + test "Matches.find right expands correctly" do assert_equal("[q: 0 3 s: 0 3 l: 4 s: 0.0]", Matches.find("atcg", "atcg", 0, 0, 3, 3, 3).to_s) end -# def test_Matches_find_left_expands_correctly +# test "Matches.find left expands correctly" do # flunk # assert_equal("[q: 1 2 s: 1 2 l: 2 s: 0.0]", Matches.find("ccccc", "cccc", 0, 0, 3, 3, 2).to_s) # end diff --git a/code_ruby/test/maasha/align/test_mem.rb b/code_ruby/test/maasha/align/test_mem.rb index 04c6b8f..8fd0191 100755 --- a/code_ruby/test/maasha/align/test_mem.rb +++ b/code_ruby/test/maasha/align/test_mem.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') # Copyright (C) 2013 Martin A. Hansen. @@ -26,11 +26,12 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/align/mem' require 'pp' class MemTest < Test::Unit::TestCase - def test_Matches_find_with_no_match_returns_correctly + test "Matches.find with no match returns correctly" do assert_equal("[]", Matches.find("atcg", "atcg", 0, 0, 3, 3, 8).to_s) end end diff --git a/code_ruby/test/maasha/seq/test_backtrack.rb b/code_ruby/test/maasha/seq/test_backtrack.rb index 645258e..f244aab 100644 --- a/code_ruby/test/maasha/seq/test_backtrack.rb +++ b/code_ruby/test/maasha/seq/test_backtrack.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') # Copyright (C) 2007-2011 Martin A. Hansen. @@ -26,6 +26,7 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/seq' class BackTrackTest < Test::Unit::TestCase @@ -36,125 +37,125 @@ class BackTrackTest < Test::Unit::TestCase @seq.extend(BackTrack) end - def test_BackTrack_patscan_with_bad_pattern_raises + test "#patscan with bad pattern raises" do ["", "X", "1"].each { |pattern| assert_raise(BackTrackError) { @seq.patscan(pattern) } } end - def test_BackTrack_patscan_with_OK_pattern_dont_raise + test "#patscan with OK pattern dont raise" do ["N", "atcg"].each { |pattern| assert_nothing_raised { @seq.patscan(pattern) } } end - def test_BackTrack_patscan_with_bad_start_raises + test "#patscan with bad start raises" do [-1, 20].each { |start| assert_raise(BackTrackError) { @seq.patscan("N", start) } } end - def test_BackTrack_patscan_with_OK_start_dont_raise + test "#patscan with OK start dont raise" do [0, 19].each { |start| assert_nothing_raised { @seq.patscan("N", start) } } end - def test_BackTrack_patscan_with_bad_stop_raises + test "#patscan with bad stop raises" do [-1, 20].each { |stop| assert_raise(BackTrackError) { @seq.patscan("N", [0, stop]) } } end - def test_BackTrack_patscan_with_OK_stop_dont_raise + test "#patscan with OK stop dont raise" do [0, 19].each { |stop| assert_nothing_raised { @seq.patscan("N", [0, stop]) } } end - def test_BackTrack_patscan_with_stop_returns_correctly + test "#patscan with stop returns correctly" do assert_nil(@seq.patmatch("G", [0, 2])) assert_equal("3:1:g", @seq.patmatch("G", [0, 3]).to_s) end - def test_BackTrack_patscan_with_bad_mis_raises + test "#patscan with bad mis raises" do [-1, 6].each { |mis| assert_raise(BackTrackError) { @seq.patscan("N", 0, mis) } } end - def test_BackTrack_patscan_with_OK_mis_dont_raise + test "#patscan with OK mis dont raise" do [0, 5].each { |mis| assert_nothing_raised { @seq.patscan("N", 0, mis) } } end - def test_BackTrack_patscan_with_bad_ins_raises + test "#patscan with bad ins raises" do [-1, 6].each { |ins| assert_raise(BackTrackError) { @seq.patscan("N", 0, 0, ins) } } end - def test_BackTrack_patscan_with_OK_ins_dont_raise + test "#patscan with OK ins dont raise" do [0, 5].each { |ins| assert_nothing_raised { @seq.patscan("N", 0, 0, ins) } } end - def test_BackTrack_patscan_with_bad_del_raises + test "#patscan with bad del raises" do [-1, 6].each { |del| assert_raise(BackTrackError) { @seq.patscan("N", 0, 0, 0, del) } } end - def test_BackTrack_patscan_with_OK_del_dont_raise + test "#patscan with OK del dont raise" do [0, 5].each { |del| assert_nothing_raised { @seq.patscan("N", 0, 0, 0, del) } } end - def test_BackTrack_patscan_perfect_left_is_ok + test "#patscan perfect left is ok" do assert_equal("0:7:tacgatg", @seq.patscan("TACGATG").first.to_s) end - def test_BackTrack_patscan_perfect_right_is_ok + test "#patscan perfect right is ok" do assert_equal("13:7:tgcacgg", @seq.patscan("TGCACGG").first.to_s) end - def test_BackTrack_patscan_ambiguity_is_ok + test "#patscan ambiguity is ok" do assert_equal("13:7:tgcacgg", @seq.patscan("TGCACNN").first.to_s) end - def test_BackTrack_patscan_start_is_ok + test "#patscan start is ok" do assert_equal("10:1:g", @seq.patscan("N", 10).first.to_s) assert_equal("19:1:g", @seq.patscan("N", 10).last.to_s) end - def test_BackTrack_patscan_mis_left_is_ok + test "#patscan mis left is ok" do assert_equal("0:7:tacgatg", @seq.patscan("Aacgatg", 0, 1).first.to_s) end - def test_BackTrack_patscan_mis_right_is_ok + test "#patscan mis right is ok" do assert_equal("13:7:tgcacgg", @seq.patscan("tgcacgA", 0, 1).first.to_s) end - def test_BackTrack_patscan_ins_left_is_ok + test "#patscan ins left is ok" do assert_equal("0:7:tacgatg", @seq.patscan("Atacgatg", 0, 0, 1).first.to_s) end - def test_BackTrack_patscan_ins_right_is_ok + test "#patscan ins right is ok" do assert_equal("13:7:tgcacgg", @seq.patscan("tgcacggA", 0, 0, 1).first.to_s) end - def test_BackTrack_patscan_del_left_is_ok + test "#patscan del left is ok" do assert_equal("0:7:tacgatg", @seq.patscan("acgatg", 0, 0, 0, 1).first.to_s) end - def test_BackTrack_patscan_del_right_is_ok + test "#patscan del right is ok" do assert_equal("12:8:atgcacgg", @seq.patscan("tgcacgg", 0, 0, 0, 1).first.to_s) end - def test_BackTrack_patscan_ambiguity_mis_ins_del_all_ok + test "#patscan ambiguity mis ins del all ok" do assert_equal("0:20:tacgatgctagcatgcacgg", @seq.patscan("tacatgcNagGatgcCacgg", 0, 1, 1, 1).first.to_s) end end diff --git a/code_ruby/test/maasha/seq/test_digest.rb b/code_ruby/test/maasha/seq/test_digest.rb index 979e081..ca59042 100755 --- a/code_ruby/test/maasha/seq/test_digest.rb +++ b/code_ruby/test/maasha/seq/test_digest.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') # Copyright (C) 2007-2011 Martin A. Hansen. @@ -27,25 +27,25 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'maasha/seq' require 'test/unit' -require 'pp' +require 'test/helper' class TestDigest < Test::Unit::TestCase - def test_Digest_each_digest_raises_on_bad_pattern_residue + test "#each_digest raises on bad pattern residue" do entry = Seq.new assert_raise(DigestError) { entry.each_digest("X", 4) } end - def test_Digest_each_digest_dont_raise_on_ok_pattern_residue + test "#each_digest dont raise on ok pattern residue" do entry = Seq.new("test", "atcg") assert_nothing_raised { entry.each_digest("AGCUTRYWSMKHDVBNagcutrywsmkhdvbn", 4) } end - def test_Digest_each_digest_with_no_match_returns_correctly + test "#each_digest with no match returns correctly" do entry = Seq.new("test", "aaaaaaaaaaa") assert_equal(entry.seq, entry.each_digest("CGCG", 1).first.seq) end - def test_Digest_each_digest_with_matches_returns_correctly + test "#each_digest with matches returns correctly" do entry = Seq.new("test", "TTTTaaaaTTTTbbbbTTTT") seqs = entry.each_digest("TTNT", 1) assert_equal("T", seqs[0].seq) diff --git a/code_ruby/test/maasha/seq/test_dynamic.rb b/code_ruby/test/maasha/seq/test_dynamic.rb index b87bacf..417b1b2 100755 --- a/code_ruby/test/maasha/seq/test_dynamic.rb +++ b/code_ruby/test/maasha/seq/test_dynamic.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') # Copyright (C) 2007-2010 Martin A. Hansen. @@ -27,7 +27,7 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'maasha/seq' require 'test/unit' -require 'pp' +require 'test/helper' class TestDynamic < Test::Unit::TestCase def setup @@ -35,11 +35,11 @@ class TestDynamic < Test::Unit::TestCase @p.extend(Dynamic) end - def test_Dynamic_no_match_returns_nil + test "#patmatch with no match returns nil" do assert_nil(@p.patmatch("gggg")) end - def test_Dynamic_patmatch_perfect_returns_correctly + test "#patmatch with perfect match returns correctly" do m = @p.patmatch("atcg") assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -49,7 +49,7 @@ class TestDynamic < Test::Unit::TestCase assert_equal(4, m.length) end - def test_Dynamic_patmatch_perfect_with_ambiguity_codes_returns_correctly + test "#patmatch with perfect match with ambiguity codes returns correctly" do m = @p.patmatch("nnnn") assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -59,11 +59,11 @@ class TestDynamic < Test::Unit::TestCase assert_equal(4, m.length) end - def test_Dynamic_patmatch_with_one_mismatch_and_edit_dist_zero_returns_nil + test "#patmatch with one mismatch and edit dist zero returns nil" do assert_nil(@p.patmatch("aCcg")) end - def test_Dynamic_patmatch_with_one_mismatch_and_edit_dist_one_returns_correctly + test "#patmatch with one mismatch and edit dist one returns correctly" do m = @p.patmatch("aCcg", 0, 1) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -73,15 +73,15 @@ class TestDynamic < Test::Unit::TestCase assert_equal(4, m.length) end - def test_Dynamic_patmatch_with_two_mismatch_and_edit_dist_one_returns_nil + test "#patmatch with two mismatch and edit dist one returns nil" do assert_nil(@p.patmatch("aGcA", 0, 1)) end - def test_Dynamic_patmatch_with_one_insertion_and_edit_dist_zero_returns_nil + test "#patmatch with one insertion and edit dist zero returns nil" do assert_nil(@p.patmatch("atGcg")) end - def test_Dynamic_patmatch_with_one_insertion_and_edit_dist_one_returns_correctly + test "#patmatch with one insertion and edit dist one returns correctly" do m = @p.patmatch("atGcg", 0, 1) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -91,11 +91,11 @@ class TestDynamic < Test::Unit::TestCase assert_equal(4, m.length) end - def test_Dynamic_patmatch_with_two_insertions_and_edit_dist_one_returns_nil + test "#patmatch with two insertions and edit dist one returns nil" do assert_nil(@p.patmatch("atGcTg", 0, 1)) end - def test_Dynamic_patmatch_with_two_insertions_and_edit_dist_two_returns_correctly + test "#patmatch with two insertions and edit dist two returns correctly" do m = @p.patmatch("atGcTg", 0, 2) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -105,11 +105,11 @@ class TestDynamic < Test::Unit::TestCase assert_equal(4, m.length) end - def test_Dynamic_patmatch_with_one_deletion_and_edit_distance_zero_returns_nil + test "#patmatch with one deletion and edit distance zero returns nil" do assert_nil(@p.patmatch("acg")) end - def test_Dynamic_patmatch_with_one_deletion_and_edit_distance_one_returns_correctly + test "#patmatch with one deletion and edit distance one returns correctly" do m = @p.patmatch("acg", 0, 1) assert_equal(0, m.beg) assert_equal("atcg", m.match) @@ -119,13 +119,13 @@ class TestDynamic < Test::Unit::TestCase assert_equal(4, m.length) end - def test_Dynamic_patscan_locates_three_patterns_ok + test "#patscan locates three patterns ok" do p = Seq.new("test", "ataacgagctagctagctagctgactac") p.extend(Dynamic) assert_equal(3, p.patscan("tag").count) end - def test_Dynamic_patscan_with_pos_locates_two_patterns_ok + test "#patscan with pos locates two patterns ok" do p = Seq.new("test", "ataacgagctagctagctagctgactac") p.extend(Dynamic) assert_equal(2, p.patscan("tag", 10).count) diff --git a/code_ruby/test/maasha/seq/test_trim.rb b/code_ruby/test/maasha/seq/test_trim.rb index 9c3f7d0..20a6dae 100755 --- a/code_ruby/test/maasha/seq/test_trim.rb +++ b/code_ruby/test/maasha/seq/test_trim.rb @@ -1,7 +1,9 @@ #!/usr/bin/env ruby +$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..') require 'maasha/seq' require 'test/unit' +require 'test/helper' require 'pp' class TestTrim < Test::Unit::TestCase @@ -9,7 +11,7 @@ class TestTrim < Test::Unit::TestCase @entry = Seq.new end - def test_Trim_quality_trim_with_missing_seq_raises + test "Seq.quality_trim with missing seq raises" do @entry.qual = "hhhh" assert_raise(TrimError) { @entry.quality_trim_right(20) } assert_raise(TrimError) { @entry.quality_trim_right!(20) } @@ -19,7 +21,7 @@ class TestTrim < Test::Unit::TestCase assert_raise(TrimError) { @entry.quality_trim!(20) } end - def test_Trim_quality_trim_with_missing_qual_raises + test "Seq.quality_trim with missing qual raises" do @entry.seq = "ATCG" assert_raise(TrimError) { @entry.quality_trim_right(20) } assert_raise(TrimError) { @entry.quality_trim_right!(20) } @@ -29,7 +31,7 @@ class TestTrim < Test::Unit::TestCase assert_raise(TrimError) { @entry.quality_trim!(20) } end - def test_Trim_quality_trim_with_bad_min_raises + test "Seq.quality_trim with bad min raises" do @entry.seq = "ATCG" @entry.qual = "hhhh" @@ -43,7 +45,7 @@ class TestTrim < Test::Unit::TestCase end end - def test_Trim_quality_trim_with_ok_min_dont_raise + test "Seq.quality_trim with ok min dont raise" do @entry.seq = "ATCG" @entry.qual = "hhhh" @@ -57,25 +59,25 @@ class TestTrim < Test::Unit::TestCase end end - def test_Trim_quality_trim_right_returns_correctly + test "Seq.quality_trim_right returns correctly" do @entry.seq = "AAAAATCG" - @entry.qual = "hhhhhgfe" + @entry.qual = "IIIIIHGF" new_entry = @entry.quality_trim_right(38) assert_equal("AAAAATC", new_entry.seq) - assert_equal("hhhhhgf", new_entry.qual) + assert_equal("IIIIIHG", new_entry.qual) assert_equal("AAAAATCG", @entry.seq) - assert_equal("hhhhhgfe", @entry.qual) + assert_equal("IIIIIHGF", @entry.qual) end - def test_Trim_quality_trim_right_bang_returns_correctly + test "Seq.quality_trim_right! returns correctly" do @entry.seq = "AAAAATCG" - @entry.qual = "hhhhhgfe" + @entry.qual = "IIIIIHGF" @entry.quality_trim_right!(38) assert_equal("AAAAATC", @entry.seq) - assert_equal("hhhhhgf", @entry.qual) + assert_equal("IIIIIHG", @entry.qual) end - def test_Trim_quality_trim_right_with_all_low_qual_returns_correctly + test "Seq.quality_trim_right! with all low qual returns correctly" do @entry.seq = "GCTAAAAA" @entry.qual = "@@@@@@@@" @entry.quality_trim_right!(38) @@ -83,25 +85,25 @@ class TestTrim < Test::Unit::TestCase assert_equal("", @entry.qual) end - def test_Trim_quality_trim_left_returns_correctly + test "Seq.quality_trim_left returns correctly" do @entry.seq = "GCTAAAAA" - @entry.qual = "efghhhhh" + @entry.qual = "FGHIIIII" new_entry = @entry.quality_trim_left(38) assert_equal("CTAAAAA", new_entry.seq) - assert_equal("fghhhhh", new_entry.qual) + assert_equal("GHIIIII", new_entry.qual) assert_equal("GCTAAAAA", @entry.seq) - assert_equal("efghhhhh", @entry.qual) + assert_equal("FGHIIIII", @entry.qual) end - def test_Trim_quality_trim_left_bang_returns_correctly + test "Seq.quality_trim_left! returns correctly" do @entry.seq = "GCTAAAAA" - @entry.qual = "efghhhhh" + @entry.qual = "FGHIIIII" @entry.quality_trim_left!(38) assert_equal("CTAAAAA", @entry.seq) - assert_equal("fghhhhh", @entry.qual) + assert_equal("GHIIIII", @entry.qual) end - def test_Trim_quality_trim_left_with_all_low_qual_returns_correctly + test "Seq.quality_trim_left! with all low qual returns correctly" do @entry.seq = "GCTAAAAA" @entry.qual = "@@@@@@@@" @entry.quality_trim_left!(38) @@ -109,33 +111,33 @@ class TestTrim < Test::Unit::TestCase assert_equal("", @entry.qual) end - def test_Trim_quality_trim_returns_correctly + test "Seq.quality_trim returns correctly" do @entry.seq = "GCTAAAAAGTG" - @entry.qual = "efghhhhhgfe" + @entry.qual = "FGHIIIIIHGF" new_entry = @entry.quality_trim(38) assert_equal("CTAAAAAGT", new_entry.seq) - assert_equal("fghhhhhgf", new_entry.qual) + assert_equal("GHIIIIIHG", new_entry.qual) assert_equal("GCTAAAAAGTG", @entry.seq) - assert_equal("efghhhhhgfe", @entry.qual) + assert_equal("FGHIIIIIHGF", @entry.qual) end - def test_Trim_quality_trim_bang_returns_correctly + test "Seq.quality_trim! returns correctly" do @entry.seq = "GCTAAAAAGTG" - @entry.qual = "efghhhhhgfe" + @entry.qual = "FGHIIIIIHGF" @entry.quality_trim!(38) assert_equal("CTAAAAAGT", @entry.seq) - assert_equal("fghhhhhgf", @entry.qual) + assert_equal("GHIIIIIHG", @entry.qual) end - def test_Trim_quality_trim_with_min_len_bang_returns_correctly + test "Seq.quality_trim! with min len bang returns correctly" do @entry.seq = "GCTCAAACGTG" - @entry.qual = "hdefghgfedh" + @entry.qual = "IEFGHIHGFEI" @entry.quality_trim!(37, 2) assert_equal("TCAAACG", @entry.seq) - assert_equal("efghgfe", @entry.qual) + assert_equal("FGHIHGF", @entry.qual) end - def test_Trim_quality_trim_with_all_low_qual_returns_correctly + test "Seq.quality_trim! with all low qual returns correctly" do @entry.seq = "GCTCAAACGTG" @entry.qual = "@@@@@@@@@@@" @entry.quality_trim!(37, 2) diff --git a/code_ruby/test/maasha/test_base36.rb b/code_ruby/test/maasha/test_base36.rb index 683d267..edee95d 100755 --- a/code_ruby/test/maasha/test_base36.rb +++ b/code_ruby/test/maasha/test_base36.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2011 Martin A. Hansen. @@ -26,23 +26,23 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/base36' -require 'pp' class Base36Test < Test::Unit::TestCase - def test_Base36_encode_with_non_fixnum_value_raises + test "Base36#encode with non fixnum value raises" do assert_raise(Base36Error) { Base36.encode("foo") } end - def test_Base36_encode_returns_correctly + test "Base36#encode returns correctly" do assert_equal("AWVHI", Base36.encode(1053908)) end - def test_Base36_decode_with_empty_value_raises + test "Base36#decoder with empty value raises" do assert_raise(Base36Error) { Base36.decode("") } end - def test_Base36_decode_returns_correctly + test "Base36#decode returns correctly" do assert_equal(1053908, Base36.decode("AWVHI")) end end diff --git a/code_ruby/test/maasha/test_biopieces.rb b/code_ruby/test/maasha/test_biopieces.rb index 2dd2430..892cbd5 100755 --- a/code_ruby/test/maasha/test_biopieces.rb +++ b/code_ruby/test/maasha/test_biopieces.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2007-2011 Martin A. Hansen. @@ -25,9 +26,9 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/biopieces' require 'stringio' -require 'pp' Biopieces::TEST = true OptionHandler::TEST = true @@ -39,13 +40,13 @@ SCRIPT_PATH = "write_fasta" class BiopiecesTest < Test::Unit::TestCase # >>>>>>>>>>>>>>>>>>>> Testing Options.new <<<<<<<<<<<<<<<<<<<< - def test_Biopieces_options_parse_with_all_cast_keys_dont_raise + test "Biopieces.options_parse with all cast keys dont raise" do argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_nothing_raised(CastError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_illegal_long_cast_values_raises + test "Biopieces.options_parse with illegal long cast values raises" do [nil, true, false, 1, 0, "a"].each do |long| argv = [] casts = [{:long=>long, :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -53,7 +54,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_legal_long_cast_values_dont_raise + test "Biopieces.options_parse with legal long cast values dont raise" do ["foo", "!!", "0123"].each do |long| argv = [] casts = [{:long=>long, :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -61,7 +62,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_illegal_short_cast_values_raises + test "Biopieces.options_parse with illegal short cast values raises" do [nil, true, false, "foo"].each do |short| argv = [] casts = [{:long=>"foo", :short=>short, :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -69,7 +70,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_legal_short_cast_values_dont_raise + test "Biopieces.options_parse with legal short cast values dont raise" do ["!", "1", "a"].each do |short| argv = [] casts = [{:long=>"foo", :short=>short, :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -77,7 +78,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_illegal_type_cast_values_raises + test "Biopieces.options_parse with illegal type cast values raises" do [nil, true, false, "foo", 12, 0].each do |type| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>type, :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -85,7 +86,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_legal_type_cast_values_dont_raise + test "Biopieces.options_parse with legal type cast values dont raise" do TYPES.each do |type| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>type, :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -93,7 +94,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_illegal_mandatory_cast_values_raises + test "Biopieces.options_parse with illegal mandatory cast values raises" do ["yes", 12, 0, nil].each do |mandatory| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>mandatory, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -101,7 +102,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_legal_mandatory_cast_values_dont_raise + test "Biopieces.options_parse with legal mandatory cast values dont raise" do [true, false].each do |mandatory| argv = [ "--foo", "1" ] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>mandatory, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -109,7 +110,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_illegal_default_cast_values_raises + test "Biopieces.options_parse with illegal default cast values raises" do [true, false, [], {}].each do |default| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>default, :allowed=>nil, :disallowed=>nil}] @@ -117,7 +118,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_legal_default_cast_values_dont_raise + test "Biopieces.options_parse with legal default cast values dont raise" do [nil, 0, 1, -1].each do |default| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>default, :allowed=>nil, :disallowed=>nil}] @@ -125,7 +126,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_illegal_allowed_cast_values_raises + test "Biopieces.options_parse with illegal allowed cast values raises" do [true, false, {}, [], 0, 0.1].each do |allowed| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>allowed, :disallowed=>nil}] @@ -133,7 +134,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_legal_allowed_cast_values_dont_raise + test "Biopieces.options_parse with legal allowed cast values dont raise" do ["foo,bar,0",nil].each do |allowed| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>allowed, :disallowed=>nil}] @@ -141,7 +142,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_illegal_disallowed_cast_values_raises + test "Biopieces.options_parse with illegal disallowed cast values raises" do [true, false, {}, [], 0, 0.1].each do |disallowed| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>disallowed}] @@ -149,7 +150,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_legal_disallowed_cast_values_dont_raise + test "Biopieces.options_parse with legal disallowed cast values dont raise" do ["foo,bar,0",nil].each do |disallowed| argv = [] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>disallowed}] @@ -157,7 +158,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_duplicate_long_cast_values_raises + test "Biopieces.options_parse with duplicate long cast values raises" do argv = [] casts = [] casts << {:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} @@ -165,7 +166,7 @@ class BiopiecesTest < Test::Unit::TestCase assert_raise(CastError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_duplicate_short_cast_values_raises + test "Biopieces.options_parse with duplicate short cast values raises" do argv = [] casts = [] casts << {:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} @@ -173,7 +174,7 @@ class BiopiecesTest < Test::Unit::TestCase assert_raise(CastError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_without_duplicate_long_and_short_cast_values_dont_raise + test "Biopieces.options_parse without duplicate long and short cast values dont raise" do argv = [] casts = [] casts << {:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil} @@ -183,63 +184,63 @@ class BiopiecesTest < Test::Unit::TestCase # >>>>>>>>>>>>>>>>>>>> Testing Options.parse <<<<<<<<<<<<<<<<<<<< - def test_Biopieces_options_parse_with_empty_argv_and_missing_wiki_file_raises + test "Biopieces.options_parse with empty argv and missing wiki file raises" do argv = [] casts = [] assert_raise(RuntimeError) { Biopieces.options_parse(argv,casts, "foo") } end - def test_Biopieces_options_parse_with_empty_argv_and_existing_wiki_file_dont_raise + test "Biopieces.options_parse with empty argv and existing wiki file dont raise" do argv = [] casts = [] assert_nothing_raised { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_help_in_argv_and_existing_wiki_output_long_usage + test "Biopieces.options_parse with help in argv and existing wiki output long usage" do argv = ["--help"] assert_nothing_raised { Biopieces.options_parse(argv,[],SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_stream_in_argv_returns_correct_options + test "Biopieces.options_parse with stream in argv returns correct options" do argv = ["--stream_in", DUMMY_FILE] options = Biopieces.options_parse(argv,[],SCRIPT_PATH) assert_equal(DUMMY_FILE, options[:stream_in]) end - def test_Biopieces_options_parse_with_I_argv_returns_correct_options + test "Biopieces.options_parse with I argv returns correct options" do argv = ["-I", DUMMY_FILE] casts = [] options = Biopieces.options_parse(argv, casts, SCRIPT_PATH) assert_equal(DUMMY_FILE, options[:stream_in]) end - def test_Biopieces_options_parse_use_cast_default_value_if_no_argument_given + test "Biopieces.options_parse use cast default value if no argument given" do argv = ["-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>"bar", :allowed=>nil, :disallowed=>nil}] options = Biopieces.options_parse(argv, casts, SCRIPT_PATH) assert_equal(options[:foo], "bar") end - def test_Biopieces_options_parse_dont_use_default_value_if_argument_given + test "Biopieces.options_parse dont use default value if argument given" do argv = ["--foo", "bleh", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>"bar", :allowed=>nil, :disallowed=>nil}] options = Biopieces.options_parse(argv, casts, SCRIPT_PATH) assert_equal(options[:foo], "bleh") end - def test_Biopieces_options_parse_with_mandatory_cast_and_no_argument_raises + test "Biopieces.options_parse with mandatory cast and no argument raises" do argv = ["-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_raise(ArgumentError) { Biopieces.options_parse(argv,casts,SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_mandatory_cast_and_argument_dont_raise + test "Biopieces.options_parse with mandatory cast and argument dont raise" do argv = ["--foo", "bar", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>true, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_nothing_raised(ArgumentError) { Biopieces.options_parse(argv,casts,SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_type_cast_int_dont_raise + test "Biopieces.options_parse with type cast int dont raise" do [0,-1,1,327649123746293746374276347824].each do |val| argv = ["--foo", "#{val}", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"int", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -247,7 +248,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_type_cast_uint_dont_raise + test "Biopieces.options_parse with type cast uint dont raise" do [0,1,327649123746293746374276347824].each do |val| argv = ["--foo", "#{val}", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"uint", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -255,31 +256,31 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_file_cast_and_file_dont_exists_raises + test "Biopieces.options_parse with file cast and file dont exists raises" do argv = ["--foo", "bleh", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"file!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_raise(ArgumentError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_file_cast_and_existing_file_dont_raise + test "Biopieces.options_parse with file cast and existing file dont raise" do argv = ["--foo", DUMMY_FILE, "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"file!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_nothing_raised(ArgumentError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_files_cast_and_a_file_dont_exists_raises + test "Biopieces.options_parse with files cast and a file dont exists raises" do argv = ["--foo", DUMMY_FILE + ",bleh", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"files!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_raise(ArgumentError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_files_cast_and_files_exists_dont_raise + test "Biopieces.options_parse with files cast and files exists dont raise" do argv = ["--foo", DUMMY_FILE + "," + DUMMY_FILE, "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"files!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_nothing_raised(ArgumentError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_glob_argument_expands_correctly + test "Biopieces.options_parse with glob argument expands correctly" do path = File.join(ENV['BP_DIR'], "bp_test") argv = ["--foo", "#{path}/te*,#{path}/lib/*.sh", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"files!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] @@ -287,19 +288,19 @@ class BiopiecesTest < Test::Unit::TestCase assert_equal(["#{path}/test_all", "#{path}/lib/test.sh"], options[:foo]) end - def test_Biopieces_options_parse_with_dir_cast_and_dir_dont_exists_raises + test "Biopieces.options_parse with dir cast and dir dont exists raises" do argv = ["--foo", "bleh", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"dir!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_raise(ArgumentError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_dir_cast_and_dir_exists_dont_raise + test "Biopieces.options_parse with dir cast and dir exists dont raise" do argv = ["--foo", "/", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"dir!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}] assert_nothing_raised(ArgumentError) { Biopieces.options_parse(argv, casts, SCRIPT_PATH) } end - def test_Biopieces_options_parse_with_allowed_cast_and_not_allowed_value_raises + test "Biopieces.options_parse with allowed cast and not allowed value raises" do ["bleh", "2", "3.3"].each do |val| argv = ["--foo", "#{val}", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>"0,-1,0.0,1,bar", :disallowed=>nil}] @@ -307,7 +308,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_allowed_cast_and_allowed_values_dont_raise + test "Biopieces.options_parse with allowed cast and allowed values dont raise" do ["0", "-1", "0.0", "1", "bar"].each do |val| argv = ["--foo", "#{val}", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>"0,-1,0.0,1,bar", :disallowed=>nil}] @@ -315,7 +316,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_disallowed_cast_and_disallowed_value_raises + test "Biopieces.options_parse with disallowed cast and disallowed value raises" do ["0", "-1", "0.0", "1", "bar"].each do |val| argv = ["--foo", "#{val}", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>"0,-1,0.0,1,bar"}] @@ -323,7 +324,7 @@ class BiopiecesTest < Test::Unit::TestCase end end - def test_Biopieces_options_parse_with_disallowed_cast_and_allowed_values_dont_raise + test "Biopieces.options_parse with disallowed cast and allowed values dont raise" do ["bleh", "2", "3.3"].each do |val| argv = ["--foo", "#{val}", "-I", DUMMY_FILE] casts = [{:long=>"foo", :short=>"f", :type=>"string", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>"0,-1,0.0,1,bar"}] diff --git a/code_ruby/test/maasha/test_bitarray.rb b/code_ruby/test/maasha/test_bitarray.rb index b1fcaa0..e19e2d4 100755 --- a/code_ruby/test/maasha/test_bitarray.rb +++ b/code_ruby/test/maasha/test_bitarray.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') -# Copyright (C) 2007-2010 Martin A. Hansen. +# Copyright (C) 2007-2013 Martin A. Hansen. # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -28,48 +28,48 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'maasha/bitarray' require 'test/unit' -require 'pp' +require 'test/helper' class TestBitArray < Test::Unit::TestCase def setup @ba = BitArray.new(10) end - def test_BitArray_initialize_raises_on_bad_sizes + test "BitArray.new raises on bad sizes" do [ -1, 0, 1.1, "a" ].each do |size| assert_raise(BitArrayError) { BitArray.new(size) } end end - def test_BitArray_initialize_dont_raise_on_ok_sizes + test "BitArray.new dont raise on ok sizes" do [ 1, 10, 1000 ].each do |size| assert_nothing_raised { BitArray.new(size) } end end - def test_BitArray_size_returns_correctly + test "#size returns correctly" do assert_equal(10, @ba.size) end - def test_BitArray_to_s_returns_correctly + test "#to_s returns correctly" do assert_equal("0000000000", @ba.to_s) end - def test_BitArray_fill_returns_correctly + test "#fill returns correctly" do assert_equal("1111111111", @ba.fill!.to_s) end - def test_BitArray_clear_returns_correctly + test "#clear returns correctly" do assert_equal("0000000000", @ba.fill!.clear!.to_s) end - def test_BitArray_bit_set_with_bad_pos_raises + test "#bit_set with bad pos raises" do [-1, 10, 1.1].each do |pos| assert_raise(BitArrayError) { @ba.bit_set(pos) } end end - def test_BitArray_bit_unset + test "#bit_unset" do @ba.fill! str = "1111111111" @@ -81,43 +81,43 @@ class TestBitArray < Test::Unit::TestCase end end - def test_BitArray_bit_unset_with_bad_pos_raises + test "#bit_unset with bad pos raises" do [-1, 10, 1.1].each do |pos| assert_raise(BitArrayError) { @ba.bit_unset(pos) } end end - def test_BitArray_bit_set_questionmark_with_bad_pos_raises + test "#bit_set? with bad pos raises" do [-1, 10, 1.1].each do |pos| assert_raise(BitArrayError) { @ba.bit_set?(pos) } end end - def test_BitArray_bit_set_questionmark + test "#bit_set? returns correctly" do (0.upto 9).each do |pos| @ba.bit_set(pos) assert_equal(true, @ba.bit_set?(pos)) end end - def test_BitArray_bits_on_returns_correctly + test "#bits_on returns correctly" do @ba.bit_set(4) @ba.bit_set(0) @ba.bit_set(1) assert_equal(3, @ba.bits_on) end - def test_BitArray_bits_off_returns_correctly + test "#bits_off returns correctly" do @ba.bit_set(4) assert_equal(9, @ba.bits_off) end - def test_BitArray_AND_with_uneven_sizes_raises + test "#& with uneven sizes raises" do ba = BitArray.new(11) assert_raise(BitArrayError) { @ba & ba } end - def test_BitArray_AND_returns_correctly + test "#& returns correctly" do ba = BitArray.new(10) @ba.bit_set(4) @ba.bit_set(5) @@ -126,12 +126,12 @@ class TestBitArray < Test::Unit::TestCase assert_equal("0000010000", (@ba & ba).to_s) end - def test_BitArray_OR_with_uneven_sizes_raises + test "#| with uneven sizes raises" do ba = BitArray.new(11) assert_raise(BitArrayError) { @ba | ba } end - def test_BitArray_OR_returns_correctly + test "#| returns correctly" do ba = BitArray.new(10) @ba.bit_set(4) @ba.bit_set(5) @@ -140,12 +140,12 @@ class TestBitArray < Test::Unit::TestCase assert_equal("0000111000", (@ba | ba).to_s) end - def test_BitArray_XOR_with_uneven_sizes_raises + test "#^ with uneven sizes raises" do ba = BitArray.new(11) assert_raise(BitArrayError) { @ba ^ ba } end - def test_BitArray_XOR_returns_correctly + test "#^ returns correctly" do ba = BitArray.new(10) @ba.bit_set(4) @ba.bit_set(5) @@ -154,20 +154,20 @@ class TestBitArray < Test::Unit::TestCase assert_equal("0000101000", (@ba ^ ba).to_s) end - def test_BitArray_FLIP_returns_correctly + test "#~ returns correctly" do @ba.bit_set(0) @ba.bit_set(9) assert_equal("0111111110", (~@ba).to_s) end - def test_interval_set_with_bad_interval_raises + test "#interval_set with bad interval raises" do assert_raise(BitArrayError) { @ba.interval_set(-1, 4) } assert_raise(BitArrayError) { @ba.interval_set(1, 10) } assert_raise(BitArrayError) { @ba.interval_set(4, 2) } end - def test_interval_set_returns_correctly + test "#interval_set returns correctly" do @ba.interval_set(0, 0) assert_equal("1000000000", @ba.to_s) @ba.interval_set(9, 9) @@ -178,13 +178,13 @@ class TestBitArray < Test::Unit::TestCase assert_equal("1111111111", @ba.to_s) end - def test_interval_unset_with_bad_interval_raises + test "#interval_unset with bad interval raises" do assert_raise(BitArrayError) { @ba.interval_unset(-1, 4) } assert_raise(BitArrayError) { @ba.interval_unset(1, 10) } assert_raise(BitArrayError) { @ba.interval_unset(4, 2) } end - def test_interval_unset_returns_correctly + test "#interval_unset returns correctly" do ~@ba @ba.interval_unset(0, 0) @@ -197,7 +197,7 @@ class TestBitArray < Test::Unit::TestCase assert_equal("0000000000", @ba.to_s) end - def test_each_interval_returns_correctly + test "#each_interval returns correctly" do @ba.fill! @ba.bit_unset(4) diff --git a/code_ruby/test/maasha/test_bits.rb b/code_ruby/test/maasha/test_bits.rb index 9e2d369..37f0de1 100755 --- a/code_ruby/test/maasha/test_bits.rb +++ b/code_ruby/test/maasha/test_bits.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2007-2010 Martin A. Hansen. @@ -28,14 +28,14 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'maasha/bits' require 'test/unit' -require 'pp' +require 'test/helper' class TestBits < Test::Unit::TestCase - def test_Bits_hamming_distance_with_uneven_lengths_raises + test "#hamming_distance with uneven lengths raises" do assert_raise(StringError) { "ATCG".hamming_distance("A") } end - def test_Bits_hamming_distance_returns_correctly + test "#hamming_distance returns correctly" do assert_equal(0, "ATCG".hamming_distance("ATCG")) assert_equal(1, "ATCX".hamming_distance("ATCG")) assert_equal(2, "ATXX".hamming_distance("ATCG")) @@ -44,15 +44,15 @@ class TestBits < Test::Unit::TestCase assert_equal(4, "XXXX".hamming_distance("ATCG")) end - def test_Bits_AND_returns_correctly + test "#& returns correctly" do assert_equal("ABCD", "abcd" & "____") end - def test_Bits_OR_returns_correctly + test "#| returns correctly" do assert_equal("abcd", "ab " | " cd") end - def test_Bits_XOR_returns_correctly + test "#^ returns correctly" do assert_equal("ABCD", "ab " ^ " cd") end end diff --git a/code_ruby/test/maasha/test_boulder.rb b/code_ruby/test/maasha/test_boulder.rb index a0afe99..935efe8 100755 --- a/code_ruby/test/maasha/test_boulder.rb +++ b/code_ruby/test/maasha/test_boulder.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2007-2010 Martin A. Hansen. @@ -27,31 +27,31 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'maasha/boulder' require 'test/unit' +require 'test/helper' require 'stringio' -require 'pp' class TestBoulder < Test::Unit::TestCase - def test_Boulder_each_raises_on_missing_seperator + test "#each raises on missing seperator" do boulder = Boulder.new(StringIO.new("TEST_BAD=testbad\n")) assert_raise(BoulderError) { boulder.each } end - def test_Boulder_each_raises_on_missing_key_val_seperator + test "#each raises on missing key val seperator" do boulder = Boulder.new(StringIO.new("TEST_BAD\n=\n")) assert_raise(BoulderError) { boulder.each } end - def test_Boulder_each_raises_on_missing_value + test "#each raises on missing value" do boulder = Boulder.new(StringIO.new("TEST_BAD=\n=\n")) assert_raise(BoulderError) { boulder.each } end - def test_Boulder_each_raises_on_missing_key + test "#each raises on missing key" do boulder = Boulder.new(StringIO.new("=testbad\n=\n")) assert_raise(BoulderError) { boulder.each } end - def test_Boulder_each_with_one_key_val_pair_returns_correctly + test "#each with one key val pair returns correctly" do boulder = Boulder.new(StringIO.new("TEST0=thisistest0\n=\n")) boulder.each do |record| @@ -59,7 +59,7 @@ class TestBoulder < Test::Unit::TestCase end end - def test_Boulder_each_with_two_key_val_pairs_return_correctly + test "#each with two key val pairs return correctly" do boulder = Boulder.new(StringIO.new("TEST0=thisistest0\nTEST1=thisistest1\n=\n")) boulder.each do |record| @@ -67,7 +67,7 @@ class TestBoulder < Test::Unit::TestCase end end - def test_Boulder_to_boulder_returns_correctly + test "#to boulder returns correctly" do boulder = Boulder.new() assert_equal("TEST0=thisistest0\n=\n", boulder.to_boulder({:TEST0=>'thisistest0'})) diff --git a/code_ruby/test/maasha/test_cigar.rb b/code_ruby/test/maasha/test_cigar.rb index 78df1b7..04a81a7 100755 --- a/code_ruby/test/maasha/test_cigar.rb +++ b/code_ruby/test/maasha/test_cigar.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2011 Martin A. Hansen. @@ -25,28 +26,28 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/cigar' -require 'pp' class CigarTest < Test::Unit::TestCase - def test_Cigar_new_with_bad_cigar_raises + test "Cigar.new with bad cigar raises" do assert_raise(CigarError) { Cigar.new("@") } assert_raise(CigarError) { Cigar.new("1M1H1M") } assert_raise(CigarError) { Cigar.new("1M1S1M") } end - def test_Cigar_new_with_ok_cigar_dont_raise + test "Cigar.new with ok cigar dont raise" do assert_nothing_raised { Cigar.new("1M") } assert_nothing_raised { Cigar.new("1H1M1H") } assert_nothing_raised { Cigar.new("1S1M1S") } assert_nothing_raised { Cigar.new("1H1S1M1S1H") } end - def test_Cigar_to_s_returns_correctly + test "#to_s returns correctly" do assert_equal("1M", Cigar.new("1M").to_s) end - def test_Cigar_each_returns_correctly + test "#each returns correctly" do cigar = Cigar.new("10M") cigar.each { |len, op| @@ -55,27 +56,27 @@ class CigarTest < Test::Unit::TestCase } end - def test_Cigar_length_returns_correctly + test "#length returns correctly" do assert_equal(6, Cigar.new("1M2S3H").length) end - def test_Cigar_matches_returns_correctly + test "#matches returns correctly" do assert_equal(1, Cigar.new("1M2S3H").matches) end - def test_Cigar_insertions_returns_correctly + test "#insertions returns correctly" do assert_equal(1, Cigar.new("10M1I").insertions) end - def test_Cigar_deletions_returns_correctly + test "#deletions returns correctly" do assert_equal(2, Cigar.new("10M2D").deletions) end - def test_Cigar_clip_hard_returns_correctly + test "#clip_hard returns correctly" do assert_equal(3, Cigar.new("10M3H").clip_hard) end - def test_Cigar_clip_soft_returns_correctly + test "#clip_soft returns correctly" do assert_equal(4, Cigar.new("10M4S").clip_soft) end end diff --git a/code_ruby/test/maasha/test_fasta.rb b/code_ruby/test/maasha/test_fasta.rb index e52440d..3924f54 100755 --- a/code_ruby/test/maasha/test_fasta.rb +++ b/code_ruby/test/maasha/test_fasta.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2007-2010 Martin A. Hansen. @@ -26,59 +26,59 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/fasta' require 'stringio' -require 'pp' class FastaTest < Test::Unit::TestCase - def test_Fasta_get_entry_obtains_the_correct_seq_name + test "#get_entry obtains the correct seq_name" do fasta = Fasta.new(StringIO.new(">test\nATCG\n")) assert_equal("test", fasta.get_entry.seq_name) end - def test_Fasta_get_entry_obtains_the_correct_seq_without_trailing_newlines + test "#get_entry obtains the correct seq without trailing newlines" do fasta = Fasta.new(StringIO.new(">test\nATCG")) assert_equal("ATCG", fasta.get_entry.seq) end - def test_Fasta_get_entry_obtains_the_correct_seq_with_trailing_newlines + test "#get_entry obtains the correct seq with trailing newlines" do fasta = Fasta.new(StringIO.new(">test\nATCG\n\n\n")) assert_equal("ATCG", fasta.get_entry.seq) end - def test_Fasta_get_entry_rstrips_whitespace_from_seq_name + test "#get_entry rstrips whitespace from seq_name" do fasta = Fasta.new(StringIO.new(">test\n\r\t ATCG\n")) assert_equal("test", fasta.get_entry.seq_name) end - def test_Fasta_get_entry_strips_whitespace_from_seq + test "#get_entry strips whitespace from seq" do fasta = Fasta.new(StringIO.new(">test\n\r\t AT\n\r\t CG\n\r\t ")) assert_equal("ATCG", fasta.get_entry.seq) end - def test_Fasta_get_entry_with_two_entries_obtain_correct + test "#get_entry with two entries obtain correct" do fasta = Fasta.new(StringIO.new(">test1\n\r\t AT\n\r\t CG\n\r\t \n>test2\n\r\t atcg\n")) assert_equal("ATCG", fasta.get_entry.seq) assert_equal("atcg", fasta.get_entry.seq) end - def test_Fasta_get_entry_without_seq_name_raises + test "#get_entry without seq_name raises" do fasta = Fasta.new(StringIO.new("ATCG\n")) assert_raise(FastaError) { fasta.get_entry } end - def test_Fasta_get_entry_without_seq_raises + test "#get_entry without seq raises" do fasta = Fasta.new(StringIO.new(">test\n\n")) assert_raise(FastaError) { fasta.get_entry } end - def test_Fasta_get_entry_with_leading_newline_raises + test "#get_entry with leading newline raises" do fasta = Fasta.new(StringIO.new("\n>test\nATCG\n")) assert_raise(FastaError) { fasta.get_entry } end # FIXME -# def test_Fasta_get_entry raises on missing > in seq_name +# test "#get_entry raises on missing > in seq_name" do # fasta = Fasta.new(StringIO.new("test\nATCG\n")) # assert_raise( FastaError ) { fasta.get_entry } # end diff --git a/code_ruby/test/maasha/test_fastq.rb b/code_ruby/test/maasha/test_fastq.rb index 8432207..b853481 100755 --- a/code_ruby/test/maasha/test_fastq.rb +++ b/code_ruby/test/maasha/test_fastq.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') -# Copyright (C) 2007-2010 Martin A. Hansen. +# Copyright (C) 2007-2013 Martin A. Hansen. # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -26,9 +26,9 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/fastq' require 'stringio' -require 'pp' class FastqTest < Test::Unit::TestCase def setup @@ -36,17 +36,12 @@ class FastqTest < Test::Unit::TestCase @fastq = Fastq.new(@io) end - def test_Fastq_get_entry_obtains_the_correct_seq_name + test "#get_entry obtains the correct seq_name" do assert_equal("test1", @fastq.get_entry.seq_name) end - def test_Fastq_get_entry_with_two_entries_obtain_correct + test "#get_entry with two entries obtain correct sequences" do assert_equal("ATCG", @fastq.get_entry.seq) assert_equal("atcg", @fastq.get_entry.seq) end - - def test_Fastq_each_loop_ends_correctly - @fastq.each do |entry| - end - end end diff --git a/code_ruby/test/maasha/test_locator.rb b/code_ruby/test/maasha/test_locator.rb index 45047f2..052f779 100755 --- a/code_ruby/test/maasha/test_locator.rb +++ b/code_ruby/test/maasha/test_locator.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2007-2011 Martin A. Hansen. @@ -28,38 +28,36 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'maasha/seq' require 'maasha/locator' require 'test/unit' -require 'pp' +require 'test/helper' class TestLocator < Test::Unit::TestCase def setup @seq = Seq.new(nil, "tcatgatcaagatctaacagcagaagtacacttctattta", "dna") end - def test_Locator_with_single_position_returns_correctly + test "#new with single position returns correctly" do loc = Locator.new("10", @seq) assert_equal("a", loc.subseq.seq) end - def test_Locator_with_single_interval_returns_correctly + test "#new with single interval returns correctly" do loc = Locator.new("5..10", @seq) assert_equal("gatcaa", loc.subseq.seq) end - def test_Locator_with_multiple_intervals_return_correctly + test "#new with multiple intervals return correctly" do loc = Locator.new("5..10,15..20", @seq) assert_equal("gatcaataacag", loc.subseq.seq) end - def test_Locator_with_join_multiple_intervals_return_correctly + test "#new with join multiple intervals return correctly" do loc = Locator.new("join(5..10,15..20)", @seq) assert_equal("gatcaataacag", loc.subseq.seq) end - def test_Locator_with_complement_and_single_interval_return_correctly + test "#new with complement and single interval return correctly" do loc = Locator.new("complement(5..10)", @seq) assert_equal("ttgatc", loc.subseq.seq) end end - -__END__ diff --git a/code_ruby/test/maasha/test_math_aux.rb b/code_ruby/test/maasha/test_math_aux.rb index 29a0fac..8ee576f 100755 --- a/code_ruby/test/maasha/test_math_aux.rb +++ b/code_ruby/test/maasha/test_math_aux.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -$:.unshift File.join(File.dirname(__FILE__),'..','lib') +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2011 Martin A. Hansen. @@ -26,15 +26,15 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib') # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/math_aux' -require 'pp' class MathTest < Test::Unit::TestCase - def test_dist_point2point_returns_correctly + test "Math.dist_point2point returns correctly" do assert_equal(1.5, Math.dist_point2point(1.0, 1.0, 1.0, 2.5)) end - def test_dist_point2line_returns_correctly + test "Math.dist_point2line returns correctly" do assert_equal(1.5, Math.dist_point2line( 3, 3, 0, 4.5, 5, 4.5)) end end diff --git a/code_ruby/test/maasha/test_sam.rb b/code_ruby/test/maasha/test_sam.rb index 06fcf25..e236330 100755 --- a/code_ruby/test/maasha/test_sam.rb +++ b/code_ruby/test/maasha/test_sam.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +$:.unshift File.join(File.dirname(__FILE__), '..', '..') # Copyright (C) 2011 Martin A. Hansen. @@ -25,8 +26,8 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'test/unit' +require 'test/helper' require 'maasha/sam' -require 'pp' require 'stringio' SAM_DATA = @@ -46,124 +47,124 @@ class SamTest < Test::Unit::TestCase @sam = Sam.new(StringIO.new(SAM_DATA)) end - def test_Sam_new_with_missing_version_number_raises + test "#new with missing version number raises" do assert_raise(SamError) { Sam.new(StringIO.new("@HD")) } end - def test_Sam_new_with_bad_version_number_raises + test "#new with bad version number raises" do assert_raise(SamError) { Sam.new(StringIO.new("@HD\tXN:1.3")) } end - def test_Sam_new_with_ok_version_number_returns_correctly + test "#new with ok version number returns correctly" do sam = Sam.new(StringIO.new("@HD\tVN:1.3")) assert_equal(1.3, sam.header[:HD][:VN]) end - def test_Sam_new_with_bad_sort_order_raises + test "#new with bad sort order raises" do assert_raise(SamError) { Sam.new(StringIO.new("@HD\tVN:1.3\tSO:fish")) } end - def test_Sam_new_with_ok_sort_order_returns_correctly + test "#new with ok sort order returns correctly" do %w{unknown unsorted queryname coordinate}.each do |order| sam = Sam.new(StringIO.new("@HD\tVN:1.3\tSO:#{order}")) assert_equal(order, sam.header[:HD][:SO]) end end - def test_Sam_new_with_missing_sequence_name_raises + test "#new with missing sequence name raises" do assert_raise(SamError) { Sam.new(StringIO.new("@SQ")) } end - def test_Sam_new_with_bad_sequence_name_raises + test "#new with bad sequence name raises" do assert_raise(SamError) { Sam.new(StringIO.new("@SQ\tSN:")) } end - def test_Sam_new_with_ok_sequence_name_returns_correctly + test "#new with ok sequence name returns correctly" do sam = Sam.new(StringIO.new("@SQ\tSN:ref\tLN:45")) assert_equal({:LN=>45}, sam.header[:SQ][:SN][:ref]) end - def test_Sam_new_with_duplicate_sequence_name_raises + test "#new with duplicate sequence name raises" do assert_raise(SamError) { Sam.new(StringIO.new("@SQ\tSN:ref\n@SQ\tSN:ref")) } end - def test_Sam_new_with_missing_sequence_length_raises + test "#new with missing sequence length raises" do assert_raise(SamError) { Sam.new(StringIO.new("@SQ\tSN:ref")) } end - def test_Sam_new_with_bad_sequence_length_raises + test "#new with bad sequence length raises" do assert_raise(SamError) { Sam.new(StringIO.new("@SQ\tSN:scaffold17_1_MH0083\tLN:x")) } end - def test_Sam_new_with_ok_sequence_length_returns_correctly + test "#new with ok sequence length returns correctly" do sam = Sam.new(StringIO.new("@SQ\tSN:scaffold17_1_MH0083\tLN:995")) assert_equal(995, sam.header[:SQ][:SN][:scaffold17_1_MH0083][:LN]) end - def test_Sam_new_with_full_SQ_dont_raise + test "#new with full SQ dont raise" do sam = Sam.new(StringIO.new("@SQ\tSN:ref\tLN:45\tAS:ident\tM5:87e6b2aedf51b1f9c89becfab9267f41\tSP:E.coli\tUR:http://www.biopieces.org")) assert_nothing_raised { sam.header } end - def test_Sam_new_with_bad_read_group_identifier_raises + test "#new with bad read group identifier raises" do assert_raise(SamError) { Sam.new(StringIO.new("@RG\tID:")) } end - def test_Sam_new_with_missing_read_group_identifier_raises + test "#new with missing read group identifier raises" do assert_raise(SamError) { Sam.new(StringIO.new("@RG")) } end - def test_Sam_new_with_duplicate_read_group_identifier_raises + test "#new with duplicate read group identifier raises" do assert_raise(SamError) { Sam.new(StringIO.new("@RG\tID:123\n@RG\tID:123")) } end - def test_Sam_new_with_ok_read_group_identifier_dont_raise + test "#new with ok read group identifier dont raise" do sam = Sam.new(StringIO.new("@RG\tID:123\n@RG\tID:124")) assert_nothing_raised { sam.header } end - def test_Sam_new_with_bad_flow_order_raises + test "#new with bad flow order raises" do assert_raise(SamError) { Sam.new(StringIO.new("@RG\tID:123\tFO:3")) } end - def test_Sam_new_with_ok_flow_order_dont_raise + test "#new with ok flow order dont raise" do sam = Sam.new(StringIO.new("@RG\tID:123\tFO:*")) assert_nothing_raised { sam.header } sam = Sam.new(StringIO.new("@RG\tID:123\tFO:ACMGRSVTWYHKDBN")) assert_nothing_raised { sam.header } end - def test_Sam_new_with_bad_platform_raises + test "#new with bad platform raises" do assert_raise(SamError) { Sam.new(StringIO.new("@RG\tID:123\tPL:maersk")) } end - def test_Sam_new_with_ok_platform_dont_raise + test "#new with ok platform dont raise" do sam = Sam.new(StringIO.new("@RG\tID:123\tPL:ILLUMINA")) assert_nothing_raised { sam.header } end - def test_Sam_new_with_bad_program_identifier_raises + test "#new with bad program identifier raises" do assert_raise(SamError) { Sam.new(StringIO.new("@PG\tID:")) } end - def test_Sam_new_with_missing_program_identifier_raises + test "#new with missing program identifier raises" do assert_raise(SamError) { Sam.new(StringIO.new("@PG")) } end - def test_Sam_new_with_duplicate_program_identifier_raises + test "#new with duplicate program identifier raises" do assert_raise(SamError) { Sam.new(StringIO.new("@PG\tID:123\n@PG\tID:123")) } end - def test_Sam_new_with_bad_comment_raises + test "#new with bad comment raises" do assert_raise(SamError) { Sam.new(StringIO.new("@CO\t")) } end - def test_Sam_new_with_ok_comment_dont_raise + test "#new with ok comment dont raise" do sam = Sam.new(StringIO.new("@CO\tfubar")) assert_nothing_raised { sam.header } end - def test_Sam_each_with_bad_field_count_raises + test "#each with bad field count raises" do fields = [] (0 ... 11).each do |i| @@ -173,22 +174,22 @@ class SamTest < Test::Unit::TestCase end end - def test_Sam_each_with_ok_field_count_dont_raise + test "#each with ok field count dont raise" do sam = Sam.new(StringIO.new(SAM_DATA)) assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_qname_raises + test "#each with bad qname raises" do sam = Sam.new(StringIO.new(" \t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\n")) assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_qname_dont_raise + test "#each with ok qname dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\n")) assert_nothing_raised(SamError) { sam.each } end - def test_Sam_each_with_bad_flag_raises + test "#each with bad flag raises" do sam = Sam.new(StringIO.new("*\t-1\t*\t*\t*\t*\t*\t*\t*\t*\t*\n")) assert_raise(SamError) { sam.each } @@ -196,7 +197,7 @@ class SamTest < Test::Unit::TestCase assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_flag_dont_raise + test "#each with ok flag dont raise" do sam = Sam.new(StringIO.new("*\t0\t*\t*\t*\t*\t*\t*\t*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -204,17 +205,17 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_rname_raises + test "#each with bad rname raises" do sam = Sam.new(StringIO.new("*\t*\t \t*\t*\t*\t*\t*\t*\t*\t*\n")) assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_rname_dont_raise + test "#each with ok rname dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\n")) assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_pos_raises + test "#each with bad pos raises" do sam = Sam.new(StringIO.new("*\t*\t*\t-1\t*\t*\t*\t*\t*\t*\t*\n")) assert_raise(SamError) { sam.each } @@ -222,7 +223,7 @@ class SamTest < Test::Unit::TestCase assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_pos_dont_raise + test "#each with ok pos dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t0\t*\t*\t*\t*\t*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -230,7 +231,7 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_mapq_raises + test "#each with bad mapq raises" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t-1\t*\t*\t*\t*\t*\t*\n")) assert_raise(SamError) { sam.each } @@ -238,7 +239,7 @@ class SamTest < Test::Unit::TestCase assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_mapq_dont_raise + test "#each with ok mapq dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t0\t*\t*\t*\t*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -246,12 +247,12 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_rnext_raises + test "#each with bad rnext raises" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t \t*\t*\t*\t*\n")) assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_rnext_dont_raise + test "#each with ok rnext dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -262,7 +263,7 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_pnext_raises + test "#each with bad pnext raises" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t-1\t*\t*\t*\n")) assert_raise(SamError) { sam.each } @@ -270,7 +271,7 @@ class SamTest < Test::Unit::TestCase assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_pnext_dont_raise + test "#each with ok pnext dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t0\t*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -278,7 +279,7 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_tlen_raises + test "#each with bad tlen raises" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t-536870912\t*\t*\n")) assert_raise(SamError) { sam.each } @@ -286,7 +287,7 @@ class SamTest < Test::Unit::TestCase assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_tlen_dont_raise + test "#each with ok tlen dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t-536870911\t*\t*\n")) assert_nothing_raised { sam.each } @@ -294,12 +295,12 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_seq_raises + test "#each with bad seq raises" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t\*\t \t*\n")) assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_seq_dont_raise + test "#each with ok seq dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t\*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -307,22 +308,22 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_bad_qual_raises + test "#each with bad qual raises" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t\*\t*\t \n")) assert_raise(SamError) { sam.each } end - def test_Sam_each_with_ok_qual_dont_raise + test "#each with ok qual dont raise" do sam = Sam.new(StringIO.new("*\t*\t*\t*\t*\t*\t*\t*\t\*\t*\t@\n")) assert_nothing_raised { sam.each } end - def test_Sam_each_with_rname_missing_from_header_raises + test "#each with rname missing from header raises" do sam = Sam.new(StringIO.new("@SQ\tSN:ref\tLN:45\n*\t*\tMIS\t*\t*\t*\t*\t*\t\*\t*\t*\n")) assert_raise(SamError) { sam.each } end - def test_Sam_each_with_rname_present_in_header_dont_raise + test "#each with rname present in header dont raise" do sam = Sam.new(StringIO.new("@SQ\tSN:ref\tLN:45\n*\t*\tref\t*\t*\t*\t*\t*\t\*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -330,12 +331,12 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_each_with_rnext_missing_from_header_raises + test "#each with rnext missing from header raises" do sam = Sam.new(StringIO.new("@SQ\tSN:ref\tLN:45\n*\t*\t*\t*\t*\t*\tMIS\t*\t\*\t*\t*\n")) assert_raise(SamError) { sam.each } end - def test_Sam_each_with_rnext_present_in_header_dont_raise + test "#each with rnext present in header dont raise" do sam = Sam.new(StringIO.new("@SQ\tSN:ref\tLN:45\n*\t*\t*\t*\t*\t*\t*\t*\t\*\t*\t*\n")) assert_nothing_raised { sam.each } @@ -346,7 +347,7 @@ class SamTest < Test::Unit::TestCase assert_nothing_raised { sam.each } end - def test_Sam_to_bp_returns_correctly + test "#to_bp returns correctly" do string = "ID00036734\t0\tgi48994873\t366089\t37\t37M1I62M\t*\t0\t0\tGTTCCGCTATCGGCTGAATTTGATTGCGAGTGAGATATTTTATGCCAGCCAGCCAGACGCAGACGCGCCGAGACAGAACTTAATGGGCCCGCTAACAGCG\t*\tXT:A:U\tNM:i:1\tX0:i:1\tX1:i:0\tXM:i:0\tXO:i:1\tXG:i:1\tMD:Z:99\n" sam = Sam.new(StringIO.new(string)) @@ -364,7 +365,7 @@ class SamTest < Test::Unit::TestCase end end - def test_Sam_to_bp_alignment_descriptor_without_mismatch_or_indel_returns_correctly + test "#to_bp alignment descriptor without mismatch or indel returns correctly" do string = "q_id\t0\ts_id\t1000\t40\t10M\t*\t0\t0\tGTTCCGCTAT\t*\tXT:A:U\tNM:i:0\tX0:i:1\tX1:i:0\tXM:i:0\tXO:i:1\tXG:i:1\tMD:Z:10\n" sam = Sam.new(StringIO.new(string)) @@ -374,7 +375,7 @@ class SamTest < Test::Unit::TestCase end end - def test_Sam_to_bp_alignment_descriptor_with_mismatches_returns_correctly + test "#to_bp alignment descriptor with mismatches returns correctly" do string = "q_id\t0\ts_id\t1000\t40\t10M\t*\t0\t0\tgTTCCGCTAt\t*\tXT:A:U\tNM:i:2\tX0:i:1\tX1:i:0\tXM:i:0\tXO:i:1\tXG:i:1\tMD:Z:0C8A\n" sam = Sam.new(StringIO.new(string)) @@ -384,7 +385,7 @@ class SamTest < Test::Unit::TestCase end end - def test_Sam_to_bp_alignment_descriptor_with_insertions_returns_correctly + test "#to_bp alignment descriptor with insertions returns correctly" do string = "q_id\t0\ts_id\t1000\t40\t1I10M1I\t*\t0\t0\taGTTCCGCTATc\t*\tXT:A:U\tNM:i:2\tX0:i:1\tX1:i:0\tXM:i:0\tXO:i:1\tXG:i:1\tMD:Z:12\n" sam = Sam.new(StringIO.new(string)) @@ -394,7 +395,7 @@ class SamTest < Test::Unit::TestCase end end - def test_Sam_to_bp_alignment_descriptor_with_deletions_returns_correctly + test "#to_bp alignment descriptor with deletions returns correctly" do string = "q_id\t0\ts_id\t1000\t40\t2D10M\t*\t0\t0\tGTTCCGCTAT\t*\tXT:A:U\tNM:i:2\tX0:i:1\tX1:i:0\tXM:i:0\tXO:i:1\tXG:i:1\tMD:Z:^AC10\n" sam = Sam.new(StringIO.new(string)) diff --git a/code_ruby/test/maasha/test_seq.rb b/code_ruby/test/maasha/test_seq.rb index 8bc6852..8ec6f97 100755 --- a/code_ruby/test/maasha/test_seq.rb +++ b/code_ruby/test/maasha/test_seq.rb @@ -1,22 +1,40 @@ #!/usr/bin/env ruby +$:.unshift File.join(File.dirname(__FILE__), '..', '..') + +# Copyright (C) 2011 Martin A. Hansen. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# http://www.gnu.org/copyleft/gpl.html + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +# This software is part of the Biopieces framework (www.biopieces.org). + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'maasha/seq' require 'test/unit' -require 'pp' +require 'test/helper' class TestSeq < Test::Unit::TestCase def setup @entry = Seq.new end - # # autoremoves whitespace, newlines, and carriage returns - # def test_Seq_strip - # dna = Seq.new - # dna.seq = "A\tT\r\tC\nG " - # assert_equal(dna.seq, "ATCG") - # end - - def test_Seq_new_bp_returns_correctly + test "Seq.new_bp returns correctly" do record = {:SEQ_NAME => "test", :SEQ => "ATCG", :SEQ_TYPE => "dna", :SCORES => "hhhh"} seq = Seq.new_bp(record) assert_equal("test", seq.seq_name) @@ -25,223 +43,223 @@ class TestSeq < Test::Unit::TestCase assert_equal("hhhh", seq.qual) end - def test_Seq_is_dna_with_no_sequence_type_returns_false + test "#is_dna? with no sequence type returns false" do assert(@entry.is_dna? == false) end - def test_Seq_is_dna_with_dna_sequence_type_returns_true + test "#is_dna? with dna sequence type returns true" do @entry.type = 'dna' assert(@entry.is_dna? == true) end - def test_Seq_is_rna_with_no_sequence_type_returns_false + test "#is_rna? with no sequence type returns false" do assert(@entry.is_rna? == false) end - def test_Seq_is_rna_with_rna_sequence_type_returns_true + test "#is_rna? with rna sequence type returns true" do @entry.type = 'rna' assert(@entry.is_rna? == true) end - def test_Seq_is_protein_with_no_sequence_type_returns_false + test "#is_protein? with no sequence type returns false" do assert(@entry.is_protein? == false) end - def test_Seq_is_protein_with_protein_sequence_type_returns_true + test "#is_protein? with protein sequence type returns true" do @entry.type = 'protein' assert_equal(true, @entry.is_protein?) end - def test_Seq_type_guess_without_sequence_raises + test "#type_guess without sequence raises" do assert_raise(SeqError) { @entry.type_guess } end - def test_Seq_type_guess_with_protein_returns_protein + test "#type_guess with protein returns protein" do @entry.seq = 'atcatcrFgatcg' assert_equal('protein', @entry.type_guess) end - def test_Seq_type_guess_with_rna_returns_rna + test "#type_guess with rna returns rna" do @entry.seq = 'atcatcrUgatcg' assert_equal('rna', @entry.type_guess) end - def test_Seq_type_guess_with_dna_returns_dna + test "#type_guess with dna returns dna" do @entry.seq = 'atcatcgatcg' assert_equal('dna', @entry.type_guess) end - def test_Seq_type_guess_EM_without_sequence_raises + test "#type_guess! without sequence raises" do assert_raise(SeqError) { @entry.type_guess! } end - def test_Seq_type_guess_EM_with_protein_returns_protein + test "#type_guess! with protein returns protein" do @entry.seq = 'atcatcrFgatcg' @entry.type_guess! assert_equal('protein', @entry.type) end - def test_Seq_type_guess_EM_with_rna_returns_rna + test "#type_guess! with rna returns rna" do @entry.seq = 'atcatcrUgatcg' @entry.type_guess! assert_equal('rna', @entry.type) end - def test_Seq_type_guess_EM_with_dna_returns_dna + test "#type_guess! with dna returns dna" do @entry.seq = 'atcatcgatcg' @entry.type_guess! assert_equal('dna', @entry.type) end - def test_Seq_length_is_correct + test "#length returns corretly" do @entry.seq = 'ATCG' assert_equal(4, @entry.length) end - def test_Seq_indels_is_correct + test "#indels returns correctly" do @entry.seq = 'ATCG.-~_' assert_equal(4, @entry.indels) end - def test_Seq_to_rna_raises_if_no_sequence + test "#to_rna with no sequence raises" do @entry.type = 'dna' assert_raise(SeqError) { @entry.to_rna } end - def test_Seq_to_rna_raises_on_bad_type + test "#to_rna with bad type raises" do @entry.seq = 'ATCG' @entry.type = 'rna' assert_raise(SeqError) { @entry.to_rna } end - def test_Seq_to_rna_transcribes_correctly + test "#to_rna transcribes correctly" do @entry.seq = 'ATCGatcg' @entry.type = 'dna' assert_equal("AUCGaucg", @entry.to_rna) end - def test_Seq_to_rna_changes_entry_type_to_rna + test "#to_rna changes entry type to rna" do @entry.seq = 'ATCGatcg' @entry.type = 'dna' @entry.to_rna assert_equal("rna", @entry.type) end - def test_Seq_to_dna_raises_if_no_sequence + test "#to_dna with no sequence raises" do @entry.type = 'rna' assert_raise(SeqError) { @entry.to_dna } end - def test_Seq_to_dna_raises_on_bad_type + test "#to_dna with bad type raises" do @entry.seq = 'AUCG' @entry.type = 'dna' assert_raise(SeqError) { @entry.to_dna } end - def test_Seq_to_dna_transcribes_correctly + test "#to_dna transcribes correctly" do @entry.seq = 'AUCGaucg' @entry.type = 'rna' assert_equal("ATCGatcg", @entry.to_dna) end - def test_Seq_to_dna_changes_entry_type_to_dna + test "#to_dna changes entry type to dna" do @entry.seq = 'AUCGaucg' @entry.type = 'rna' @entry.to_dna assert_equal("dna", @entry.type) end - def test_Seq_to_bp_returns_correct_record + test "#to_bp returns correct record" do @entry.seq_name = 'test' @entry.seq = 'ATCG' assert_equal({:SEQ_NAME=>"test", :SEQ=>"ATCG", :SEQ_LEN=>4}, @entry.to_bp) end - def test_Seq_to_bp_raises_on_missing_seq_name + test "#to_bp with missing seq_name raises" do @entry.seq = 'ATCG' assert_raise(SeqError) { @entry.to_bp } end - def test_Seq_to_bp_raises_on_missing_sequence + test "#to_bp with missing sequence raises" do @entry.seq_name = 'test' assert_raise(SeqError) { @entry.to_bp } end - def test_Seq_to_fasta_raises_on_missing_seq_name + test "#to_fasta with missing seq_name raises" do @entry.seq = 'ATCG' assert_raise(SeqError) { @entry.to_fasta } end - def test_Seq_to_fasta_raises_on_empty_seq_name + test "#to_fasta with empty seq_name raises" do @entry.seq_name = '' @entry.seq = 'ATCG' assert_raise(SeqError) { @entry.to_fasta } end - def test_Seq_to_fasta_raises_on_missing_seq + test "#to_fasta with missing seq raises" do @entry.seq_name = 'test' assert_raise(SeqError) { @entry.to_fasta } end - def test_Seq_to_fasta_raises_on_empty_seq + test "#to_fasta with empty seq raises" do @entry.seq_name = 'test' @entry.seq = '' assert_raise(SeqError) { @entry.to_fasta } end - def test_Seq_to_fasta_returns_correct_entry + test "#to_fasta returns correct entry" do @entry.seq_name = 'test' @entry.seq = 'ATCG' assert_equal(">test\nATCG\n", @entry.to_fasta) end - def test_Seq_to_fasta_wraps_correctly + test "#to_fasta wraps correctly" do entry = Seq.new("test", "ATCG") assert_equal(">test\nAT\nCG\n", entry.to_fasta(2)) end - def test_Seq_to_fastq_returns_correct_entry + test "#to_fastq returns correct entry" do @entry.seq_name = 'test' @entry.seq = 'ATCG' @entry.qual = 'hhhh' assert_equal("@test\nATCG\n+\nhhhh\n", @entry.to_fastq) end - def test_Seq_to_key_with_bad_residue_raises + test "#to_key with bad residue raises" do entry = Seq.new("test", "AUCG") assert_raise(SeqError) { entry.to_key } end - def test_Seq_to_key_returns_correctly + test "#to_key returns correctly" do entry = Seq.new("test", "ATCG") assert_equal(54, entry.to_key) end - def test_Seq_reverse_returns_correctly + test "#reverse returns correctly" do @entry.seq = "ATCG" new_entry = @entry.reverse assert_equal("GCTA", new_entry.seq) assert_equal("ATCG", @entry.seq) end - def test_Seq_reverse_bang_returns_correctly + test "#reverse! returns correctly" do @entry.seq = "ATCG" @entry.reverse! assert_equal("GCTA", @entry.seq) end - def test_Seq_complement_raises_if_no_sequence + test "#complement with no sequence raises" do @entry.type = 'dna' assert_raise(SeqError) { @entry.complement } end - def test_Seq_complement_raises_on_bad_type + test "#complement with bad type raises" do @entry.seq = 'ATCG' @entry.type = 'protein' assert_raise(SeqError) { @entry.complement } end - def test_Seq_complement_for_DNA_is_correct + test "#complement for DNA is correct" do @entry.seq = 'ATCGatcg' @entry.type = 'dna' comp = @entry.complement @@ -249,7 +267,7 @@ class TestSeq < Test::Unit::TestCase assert_equal("ATCGatcg", @entry.seq) end - def test_Seq_complement_for_RNA_is_correct + test "#complement for RNA is correct" do @entry.seq = 'AUCGaucg' @entry.type = 'rna' comp = @entry.complement @@ -257,52 +275,52 @@ class TestSeq < Test::Unit::TestCase assert_equal("AUCGaucg", @entry.seq) end - def test_Seq_complement_bang_raises_if_no_sequence + test "#complement! with no sequence raises" do @entry.type = 'dna' assert_raise(SeqError) { @entry.complement! } end - def test_Seq_complement_bang_raises_on_bad_type + test "#complement! with bad type raises" do @entry.seq = 'ATCG' @entry.type = 'protein' assert_raise(SeqError) { @entry.complement! } end - def test_Seq_complement_bang_for_DNA_is_correct + test "#complement! for DNA is correct" do @entry.seq = 'ATCGatcg' @entry.type = 'dna' assert_equal("TAGCtagc", @entry.complement!.seq) end - def test_Seq_complement_bang_for_RNA_is_correct + test "#complement! for RNA is correct" do @entry.seq = 'AUCGaucg' @entry.type = 'rna' assert_equal("UAGCuagc", @entry.complement!.seq) end - def test_Seq_hamming_distance_returns_correctly + test "#hamming distance returns correctly" do seq1 = Seq.new("test1", "ATCG") seq2 = Seq.new("test2", "atgg") assert_equal(1, seq1.hamming_distance(seq2)) end - def test_Seq_generate_with_length_lt_1_raises + test "#generate with length < 1 raises" do assert_raise(SeqError) { @entry.generate(-10, "dna") } assert_raise(SeqError) { @entry.generate(0, "dna") } end - def test_Seq_generate_with_bad_type_raises + test "#generate with bad type raises" do assert_raise(SeqError) { @entry.generate(10, "foo") } end - def test_Seq_generate_with_ok_type_dont_raise + test "#generate with ok type dont raise" do %w[dna DNA rna RNA protein Protein].each do |type| assert_nothing_raised { @entry.generate(10, type) } end end - def test_Seq_shuffle_returns_correctly + test "#shuffle returns correctly" do orig = "actgactgactgatcgatcgatcgatcgtactg" @entry.seq = "actgactgactgatcgatcgatcgatcgtactg" entry_shuf = @entry.shuffle @@ -310,58 +328,58 @@ class TestSeq < Test::Unit::TestCase assert_not_equal(@entry.seq, entry_shuf.seq) end - def test_Seq_shuffle_bang_returns_correctly + test "#shuffle! returns correctly" do @entry.seq = "actgactgactgatcgatcgatcgatcgtactg" assert_not_equal(@entry.seq, @entry.shuffle!.seq) end - def test_Seq_subseq_with_start_lt_0_raises + test "#subseq with start < 0 raises" do @entry.seq = "ATCG" assert_raise(SeqError) { @entry.subseq(-1, 1) } end - def test_Seq_subseq_with_start_plus_length_gt_seq_raises + test "#subseq with start plus length gt seq raises" do @entry.seq = "ATCG" assert_raise(SeqError) { @entry.subseq(0, 5) } end - def test_Seq_subseq_returns_correct_sequence + test "#subseq returns correct sequence" do @entry.seq = "ATCG" assert_equal("AT", @entry.subseq(0, 2).seq) assert_equal("CG", @entry.subseq(2, 2).seq) end - def test_Seq_subseq_without_len_returns_correct_sequence + test "#subseq without length returns correct sequence" do @entry.seq = "ATCG" assert_equal("ATCG", @entry.subseq(0).seq) assert_equal("CG", @entry.subseq(2).seq) end - def test_Seq_subseq_returns_correct_qual + test "#subseq returns correct qual" do @entry.seq = "ATCG" @entry.qual = "abcd" assert_equal("ab", @entry.subseq(0, 2).qual) assert_equal("cd", @entry.subseq(2, 2).qual) end - def test_Seq_subseq_without_len_returns_correct_qual + test "#subseq without length returns correct qual" do @entry.seq = "ATCG" @entry.qual = "abcd" assert_equal("abcd", @entry.subseq(0).qual) assert_equal("cd", @entry.subseq(2).qual) end - def test_Seq_subseq_bang_with_start_lt_0_raises + test "#subseq! with start < 0 raises" do @entry.seq = "ATCG" assert_raise(SeqError) { @entry.subseq!(-1, 1) } end - def test_Seq_subseq_bang_with_start_plus_length_gt_seq_raises + test "#subseq! with start plus length > seq.length raises" do @entry.seq = "ATCG" assert_raise(SeqError) { @entry.subseq!(0, 5) } end - def test_Seq_subseq_bang_returns_correct_sequence + test "#subseq! returns correct sequence" do @entry.seq = "ATCG" @entry.subseq!(0, 2) assert_equal("AT", @entry.seq) @@ -370,7 +388,7 @@ class TestSeq < Test::Unit::TestCase assert_equal("CG", @entry.seq) end - def test_Seq_subseq_bang_without_len_returns_correct_sequence + test "#subseq! without length returns correct sequence" do @entry.seq = "ATCG" @entry.subseq!(0) assert_equal("ATCG", @entry.seq) @@ -379,7 +397,7 @@ class TestSeq < Test::Unit::TestCase assert_equal("CG", @entry.seq) end - def test_Seq_subseq_bang_with_pos_and_len_returns_correct_qual + test "#subseq! with pos and length returns correct qual" do @entry.seq = "ATCG" @entry.qual = "abcd" @entry.subseq!(0, 2) @@ -390,7 +408,7 @@ class TestSeq < Test::Unit::TestCase assert_equal("cd", @entry.qual) end - def test_Seq_subseq_bang_with_pos_returns_correct_qual + test "#subseq! with pos returns correct qual" do @entry.seq = "ATCG" @entry.qual = "abcd" @entry.subseq!(0) @@ -401,25 +419,25 @@ class TestSeq < Test::Unit::TestCase assert_equal("cd", @entry.qual) end - def test_Seq_subseq_rand_returns_correct_sequence + test "#subseq_rand returns correct sequence" do @entry.seq = "ATCG" assert_equal("ATCG", @entry.subseq_rand(4).seq) end - def test_Seq_indels_remove_without_qual_returns_correctly + test "#indels_remove without qual returns correctly" do @entry.seq = "A-T.CG~CG" @entry.qual = nil assert_equal("ATCGCG", @entry.indels_remove.seq) end - def test_Seq_indels_remove_with_qual_returns_correctly + test "#indels_remove with qual returns correctly" do @entry.seq = "A-T.CG~CG" @entry.qual = "a@b@cd@fg" assert_equal("ATCGCG", @entry.indels_remove.seq) assert_equal("abcdfg", @entry.indels_remove.qual) end - def test_Seq_composition_returns_correctly + test "#composition returns correctly" do @entry.seq = "AAAATTTCCG" assert_equal(4, @entry.composition["A"]) assert_equal(3, @entry.composition["T"]) @@ -428,56 +446,56 @@ class TestSeq < Test::Unit::TestCase assert_equal(0, @entry.composition["X"]) end - def test_Seq_homopol_max_returns_0_with_empty_sequence + test "#homopol_max returns 0 with empty sequence" do @entry.seq = "" assert_equal(0, @entry.homopol_max) end - def test_Seq_homopol_max_returns_0_with_nil_sequence + test "#homopol_max returns 0 with nil sequence" do @entry.seq = nil assert_equal(0, @entry.homopol_max) end - def test_Seq_homopol_max_returns_0_when_not_found + test "#homopol_max returns 0 when not found" do @entry.seq = "AtTcCcGggGnnNnn" assert_equal(0, @entry.homopol_max(6)) end - def test_Seq_homopol_max_returns_correctly + test "#homopol_max returns correctly" do @entry.seq = "AtTcCcGggGnnNnn" assert_equal(5, @entry.homopol_max(3)) end - def test_Seq_hard_mask_returns_correctly + test "#hard_mask returns correctly" do @entry.seq = "--AAAANn" assert_equal(33.33, @entry.hard_mask) end - def test_Seq_soft_mask_returns_correctly + test "#soft_mask returns correctly" do @entry.seq = "--AAAa" assert_equal(25.00, @entry.soft_mask) end - def test_Seq_mask_seq_hard_bang_with_nil_seq_raises + test "#mask_seq_hard! with nil seq raises" do @entry.seq = nil @entry.qual = "" assert_raise(SeqError) { @entry.mask_seq_hard!(20) } end - def test_Seq_mask_seq_hard_bang_with_nil_qual_raises + test "#mask_seq_hard! with nil qual raises" do @entry.seq = "" @entry.qual = nil assert_raise(SeqError) { @entry.mask_seq_hard!(20) } end - def test_Seq_mask_seq_hard_bang_with_bad_cutoff_raises + test "#mask_seq_hard! with bad cutoff raises" do assert_raise(SeqError) { @entry.mask_seq_hard!(-1) } assert_raise(SeqError) { @entry.mask_seq_hard!(41) } end - def test_Seq_mask_seq_hard_bang_with_OK_cutoff_dont_raise + test "#mask_seq_hard! with OK cutoff dont raise" do @entry.seq = "ATCG" @entry.qual = "RSTU" @@ -485,33 +503,33 @@ class TestSeq < Test::Unit::TestCase assert_nothing_raised { @entry.mask_seq_hard!(40) } end - def test_Seq_mask_seq_hard_bang_returns_correctly + test "#mask_seq_hard! returns correctly" do @entry.seq = "-ATCG" - @entry.qual = "RRSTU" + @entry.qual = "33456" assert_equal("-NNCG", @entry.mask_seq_hard!(20).seq) end - def test_Seq_mask_seq_soft_bang_with_nil_seq_raises + test "#mask_seq_soft! with nil seq raises" do @entry.seq = nil @entry.qual = "" assert_raise(SeqError) { @entry.mask_seq_soft!(20) } end - def test_Seq_mask_seq_soft_bang_with_nil_qual_raises + test "#mask_seq_soft! with nil qual raises" do @entry.seq = "" @entry.qual = nil assert_raise(SeqError) { @entry.mask_seq_soft!(20) } end - def test_Seq_mask_seq_soft_bang_with_bad_cutoff_raises + test "#mask_seq_soft! with bad cutoff raises" do assert_raise(SeqError) { @entry.mask_seq_soft!(-1) } assert_raise(SeqError) { @entry.mask_seq_soft!(41) } end - def test_Seq_mask_seq_soft_bang_with_OK_cutoff_dont_raise + test "#mask_seq_soft! with OK cutoff dont raise" do @entry.seq = "ATCG" @entry.qual = "RSTU" @@ -519,16 +537,16 @@ class TestSeq < Test::Unit::TestCase assert_nothing_raised { @entry.mask_seq_soft!(40) } end - def test_Seq_mask_seq_soft_bang_returns_correctly + test "#mask_seq_soft! returns correctly" do @entry.seq = "-ATCG" - @entry.qual = "RRSTU" + @entry.qual = "33456" assert_equal("-atCG", @entry.mask_seq_soft!(20).seq) end # qual score detection - def test_Seq_qual_base33_returns_correctly + test "#qual_base33? returns correctly" do # self.qual.match(/[!-:]/) @entry.qual = '!"#$%&\'()*+,-./0123456789:' assert_equal(true, @entry.qual_base33? ) @@ -538,7 +556,7 @@ class TestSeq < Test::Unit::TestCase assert_equal(false, @entry.qual_base33? ) end - def test_Seq_qual_base64_returns_correctly + test "#qual_base64? returns correctly" do # self.qual.match(/[K-h]/) @entry.qual = 'KLMNOPQRSTUVWXYZ[\]^_`abcdefgh' assert_equal(true, @entry.qual_base64? ) @@ -548,177 +566,71 @@ class TestSeq < Test::Unit::TestCase assert_equal(false, @entry.qual_base64? ) end - def test_Seq_qual_valid_with_nil_qual_raises - assert_raise(SeqError) { @entry.qual_valid?("illumina1.8") } + test "#qual_valid? with nil qual raises" do + assert_raise(SeqError) { @entry.qual_valid?(:base_33) } + assert_raise(SeqError) { @entry.qual_valid?(:base_64) } end - def test_Seq_qual_valid_with_bad_encoding_raises + test "#qual_valid? with bad encoding raises" do @entry.qual = "abc" assert_raise(SeqError) { @entry.qual_valid?("foobar") } end - def test_Seq_qual_valid_returns_correctly - tests = [["sanger", 0, 93, 33], - ["454", 0, 62, 64], - ["solexa", -5, 62, 64], - ["illumina13", 0, 62, 64], - ["illumina15", 0, 62, 64], - ["illumina18", 0, 93, 33]] - - tests.each do |test| - @entry.qual = (test[1] + test[-1]).chr + (test[2] + test[-1]).chr - assert_equal(true, @entry.qual_valid?(test[0])) - @entry.qual = (test[1] + test[-1] - 1).chr - assert_equal(false, @entry.qual_valid?(test[0])) - @entry.qual = (test[2] + test[-1] + 1).chr - assert_equal(false, @entry.qual_valid?(test[0])) - end - end - - # convert sanger to ... - - def test_Seq_convert_scores_bang_from_sanger_to_sanger_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('sanger', 'sanger').qual) - end - - def test_Seq_convert_scores_bang_from_sanger_to_solexa_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('abcdefgh', @entry.convert_scores!('sanger', 'solexa').qual) - end - - def test_Seq_convert_scores_bang_from_sanger_to_illumina13_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('abcdefgh', @entry.convert_scores!('sanger', 'illumina13').qual) - end - - def test_Seq_convert_scores_bang_from_sanger_to_illumina15_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('abcdefgh', @entry.convert_scores!('sanger', 'illumina15').qual) - end - - def test_Seq_convert_scores_bang_from_sanger_to_illumina18_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('sanger', 'illumina18').qual) + test "#qual_valid? with OK range returns correctly" do + @entry.qual = ((Seq::SCORE_MIN + 33).chr .. (Seq::SCORE_MAX + 33).chr).to_a.join + assert_equal(true, @entry.qual_valid?(:base_33)) + @entry.qual = ((Seq::SCORE_MIN + 64).chr .. (Seq::SCORE_MAX + 64).chr).to_a.join + assert_equal(true, @entry.qual_valid?(:base_64)) end - # convert solexa to ... + test "#qual_valid? with bad range returns correctly" do + @entry.qual = ((Seq::SCORE_MIN + 33 - 1).chr .. (Seq::SCORE_MAX + 33).chr).to_a.join + assert_equal(false, @entry.qual_valid?(:base_33)) + @entry.qual = ((Seq::SCORE_MIN + 33).chr .. (Seq::SCORE_MAX + 33 + 1).chr).to_a.join + assert_equal(false, @entry.qual_valid?(:base_33)) - def test_Seq_convert_scores_bang_from_solexa_to_sanger_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal(%q[#$%&'()*], @entry.convert_scores!('solexa', 'sanger').qual) + @entry.qual = ((Seq::SCORE_MIN + 64 - 1).chr .. (Seq::SCORE_MAX + 64).chr).to_a.join + assert_equal(false, @entry.qual_valid?(:base_64)) + @entry.qual = ((Seq::SCORE_MIN + 64).chr .. (Seq::SCORE_MAX + 64 + 1).chr).to_a.join + assert_equal(false, @entry.qual_valid?(:base_64)) end - def test_Seq_convert_scores_bang_from_solexa_to_solexa_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('solexa', 'solexa').qual) - end - - def test_Seq_convert_scores_bang_from_solexa_to_illumina13_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('solexa', 'illumina13').qual) - end - - def test_Seq_convert_scores_bang_from_solexa_to_illumina15_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('solexa', 'illumina15').qual) - end - - def test_Seq_convert_scores_bang_from_solexa_to_illumina18_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal(%q[#$%&'()*], @entry.convert_scores!('solexa', 'illumina18').qual) - end - - # convert illumina13 to ... - - def test_Seq_convert_scores_bang_from_illumina13_to_sanger_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal(%q[#$%&'()*], @entry.convert_scores!('illumina13', 'sanger').qual) - end - - def test_Seq_convert_scores_bang_from_illumina13_to_solexa_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina13', 'solexa').qual) - end - - def test_Seq_convert_scores_bang_from_illumina13_to_illumina13_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina13', 'illumina13').qual) - end - - def test_Seq_convert_scores_bang_from_illumina13_to_illumina15_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina13', 'illumina15').qual) - end - - def test_Seq_convert_scores_bang_from_illumina13_to_illumina18_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal(%q[#$%&'()*], @entry.convert_scores!('illumina13', 'illumina18').qual) - end - - # convert illumina15 to ... - - def test_Seq_convert_scores_bang_from_illumina15_to_sanger_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal(%q[#$%&'()*], @entry.convert_scores!('illumina15', 'sanger').qual) - end - - def test_Seq_convert_scores_bang_from_illumina15_to_solexa_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina15', 'solexa').qual) - end - - def test_Seq_convert_scores_bang_from_illumina15_to_illumina13_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina15', 'illumina13').qual) - end - - def test_Seq_convert_scores_bang_from_illumina15_to_illumina15_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina15', 'illumina15').qual) - end - - def test_Seq_convert_scores_bang_from_illumina15_to_illumina18_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal(%q[#$%&'()*], @entry.convert_scores!('illumina15', 'illumina18').qual) - end - - # convert illumina18 to ... + # convert sanger to ... - def test_Seq_convert_scores_bang_from_illumina18_to_sanger_returns_OK + test "#qual_convert! from base33 to base33 returns OK" do @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina18', 'sanger').qual) + assert_equal('BCDEFGHI', @entry.qual_convert!(:base_33, :base_33).qual) end - def test_Seq_convert_scores_bang_from_illumina18_to_solexa_returns_OK + test "#qual_convert! from base33 to base64 returns OK" do @entry.qual = 'BCDEFGHI' - assert_equal('abcdefgh', @entry.convert_scores!('illumina18', 'solexa').qual) + assert_equal('abcdefgh', @entry.qual_convert!(:base_33, :base_64).qual) end - def test_Seq_convert_scores_bang_from_illumina18_to_illumina13_returns_OK + test "#qual_convert! from base64 to base64 returns OK" do @entry.qual = 'BCDEFGHI' - assert_equal('abcdefgh', @entry.convert_scores!('illumina18', 'illumina13').qual) + assert_equal('BCDEFGHI', @entry.qual_convert!(:base_64, :base_64).qual) end - def test_Seq_convert_scores_bang_from_illumina18_to_illumina15_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('abcdefgh', @entry.convert_scores!('illumina18', 'illumina15').qual) + test "#qual_convert! from base64 to base33 returns OK" do + @entry.qual = 'abcdefgh' + assert_equal('BCDEFGHI', @entry.qual_convert!(:base_64, :base_33).qual) end - def test_Seq_convert_scores_bang_from_illumina18_to_illumina18_returns_OK - @entry.qual = 'BCDEFGHI' - assert_equal('BCDEFGHI', @entry.convert_scores!('illumina18', 'illumina18').qual) + test "#qual_coerce! returns correctly" do + @entry.qual = ('!' .. '~').to_a.join + assert_equal("!\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII", @entry.qual_coerce!(:base_33).qual) + @entry.qual = ('!' .. '~').to_a.join + assert_equal("!\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZh\\h^_`abcdefghhhhhhhhhhhhhhhhhhhhhhh", @entry.qual_coerce!(:base_64).qual) end - def test_Seq_scores_mean_without_qual_raises + test "#scores_mean without qual raises" do @entry.qual = nil assert_raise(SeqError) { @entry.scores_mean } end - def test_Seq_scores_mean_returns_correctly - @entry.qual = '@@hh' + test "#scores_mean returns correctly" do + @entry.qual = '!!II' assert_equal(20.0, @entry.scores_mean) end end - -__END__ -- 2.39.2