]> git.donarmstrong.com Git - biopieces.git/commitdiff
upgraded mask_seq
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 Oct 2010 14:53:36 +0000 (14:53 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 Oct 2010 14:53:36 +0000 (14:53 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1112 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/mask_seq
bp_test/out/mask_seq.out.2 [deleted file]
bp_test/out/mask_seq.out.3 [deleted file]
bp_test/test/test_mask_seq

index fe70a64a5d554612bbcff68ef8d44cafee280092..20395c46aa3bfd91c1ddf9d8084831796ad04477 100755 (executable)
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 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 (file)
index 3ae8803..0000000
+++ /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 (file)
index 6539730..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-SEQ: aaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-SCORES: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
----
index 182584a2ef2501e8c1c9623c41d1b6bc4bcce523..8f02fd6f17be8b93289db053d9d1722b638726b9 100755 (executable)
@@ -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