From: martinahansen Date: Tue, 12 Oct 2010 15:00:07 +0000 (+0000) Subject: upgraded scores_to_dec X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=dd546f9a801843e846bbd7b63f07610a49ce09d3;p=biopieces.git upgraded scores_to_dec git-svn-id: http://biopieces.googlecode.com/svn/trunk@1114 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/scores_to_dec b/bp_bin/scores_to_dec index 9c94454..ecf2148 100755 --- a/bp_bin/scores_to_dec +++ b/bp_bin/scores_to_dec @@ -31,14 +31,16 @@ require 'biopieces' +ILLUMINA_BASE = 64 + # 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!(base) + def scores2dec! if self.has_key? :SCORES self[:SCORES].gsub! /./ do |score| - score = (score.ord - base).to_s + ";" + score = (score.ord - ILLUMINA_BASE).to_s + ";" end self[:SCORES].chomp! ";" @@ -49,14 +51,13 @@ class Hash end casts = [] -casts << {:long=>'base', :short=>'b', :type=>'uint', :mandatory=>false, :default=>64, :allowed=>"33,59,64", :disallowed=>nil} bp = Biopieces.new options = bp.parse(ARGV, casts) bp.each_record do |record| - bp.puts record.scores2dec!(options[:base]) + bp.puts record.scores2dec! end diff --git a/bp_test/out/scores_to_dec.out.2 b/bp_test/out/scores_to_dec.out.2 deleted file mode 100644 index 00f19b6..0000000 --- a/bp_test/out/scores_to_dec.out.2 +++ /dev/null @@ -1,2 +0,0 @@ -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/scores_to_dec.out.3 b/bp_test/out/scores_to_dec.out.3 deleted file mode 100644 index c192097..0000000 --- a/bp_test/out/scores_to_dec.out.3 +++ /dev/null @@ -1,2 +0,0 @@ -SCORES: -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;63;64;65;66;67 ---- diff --git a/bp_test/test/test_scores_to_dec b/bp_test/test/test_scores_to_dec index d4e7076..61c5709 100755 --- a/bp_test/test/test_scores_to_dec +++ b/bp_test/test/test_scores_to_dec @@ -5,11 +5,3 @@ source "$BP_DIR/bp_test/lib/test.sh" run "$bp -I $in -O $tmp" assert_no_diff $tmp $out.1 clean - -run "$bp -I $in -b 33 -O $tmp" -assert_no_diff $tmp $out.2 -clean - -run "$bp -I $in -b 59 -O $tmp" -assert_no_diff $tmp $out.3 -clean