From 81d421eb5384ecfef73498fe3761ae39ba1290ef Mon Sep 17 00:00:00 2001 From: martinahansen Date: Tue, 12 Oct 2010 14:53:36 +0000 Subject: [PATCH] upgraded mask_seq git-svn-id: http://biopieces.googlecode.com/svn/trunk@1112 74ccb610-7750-0410-82ae-013aeee3265d --- bp_bin/mask_seq | 13 +++++++------ bp_test/out/mask_seq.out.2 | 3 --- bp_test/out/mask_seq.out.3 | 3 --- bp_test/test/test_mask_seq | 8 -------- 4 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 bp_test/out/mask_seq.out.2 delete mode 100644 bp_test/out/mask_seq.out.3 diff --git a/bp_bin/mask_seq b/bp_bin/mask_seq index fe70a64..20395c4 100755 --- a/bp_bin/mask_seq +++ b/bp_bin/mask_seq @@ -24,25 +24,27 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -# Soft mask sequences in the stream based on Solexa/Illumina/Phred type quality scores. +# Soft mask sequences in the stream based on quality scores. # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< require 'biopieces' +ILLUMINA_BASE = 64 + # Expading class Hash with possibly evil monkey patch. class Hash # Soft masks sequence residues where the corresponding quality score # is below a given cutoff. - def mask_seq!(cutoff, base) + def mask_seq!(cutoff) if self.has_key? :SEQ and self.has_key? :SCORES seq = self[:SEQ].upcase scores = self[:SCORES] i = 0 scores.each_char do |score| - seq[i] = seq[i].downcase if score.ord - base < cutoff + seq[i] = seq[i].downcase if score.ord - ILLUMINA_BASE < cutoff i += 1 end @@ -54,15 +56,14 @@ class Hash end casts = [] -casts << {:long=>'cutoff', :short=>'c', :type=>'int', :mandatory=>false, :default=>20, :allowed=>nil, :disallowed=>nil} -casts << {:long=>'base', :short=>'b', :type=>'uint', :mandatory=>false, :default=>64, :allowed=>"33,59,64", :disallowed=>nil} +casts << {:long=>'cutoff', :short=>'c', :type=>'int', :mandatory=>false, :default=>20, :allowed=>nil, :disallowed=>nil} bp = Biopieces.new options = bp.parse(ARGV, casts) bp.each_record do |record| - bp.puts record.mask_seq!(options[:cutoff], options[:base]) + bp.puts record.mask_seq!(options[:cutoff]) end diff --git a/bp_test/out/mask_seq.out.2 b/bp_test/out/mask_seq.out.2 deleted file mode 100644 index 3ae8803..0000000 --- a/bp_test/out/mask_seq.out.2 +++ /dev/null @@ -1,3 +0,0 @@ -SEQ: aaaaaaaaaaaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ---- diff --git a/bp_test/out/mask_seq.out.3 b/bp_test/out/mask_seq.out.3 deleted file mode 100644 index 6539730..0000000 --- a/bp_test/out/mask_seq.out.3 +++ /dev/null @@ -1,3 +0,0 @@ -SEQ: aaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ---- diff --git a/bp_test/test/test_mask_seq b/bp_test/test/test_mask_seq index 182584a..8f02fd6 100755 --- a/bp_test/test/test_mask_seq +++ b/bp_test/test/test_mask_seq @@ -5,11 +5,3 @@ source "$BP_DIR/bp_test/lib/test.sh" run "$bp -I $in -c 0 -O $tmp" assert_no_diff $tmp $out.1 clean - -run "$bp -I $in -c 0 -b 59 -O $tmp" -assert_no_diff $tmp $out.2 -clean - -run "$bp -I $in -c 5 -b 33 -O $tmp" -assert_no_diff $tmp $out.3 -clean -- 2.39.2