From 411b46d576c5b42da1f3bb9bb61f20de2c104c72 Mon Sep 17 00:00:00 2001
From: martinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Date: Mon, 7 Mar 2011 15:41:24 +0000
Subject: [PATCH] updated remove_illumina_adaptor

git-svn-id: http://biopieces.googlecode.com/svn/trunk@1283 74ccb610-7750-0410-82ae-013aeee3265d
---
 bp_bin/remove_illumina_adaptor | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/bp_bin/remove_illumina_adaptor b/bp_bin/remove_illumina_adaptor
index ad52cc5..cb81799 100755
--- a/bp_bin/remove_illumina_adaptor
+++ b/bp_bin/remove_illumina_adaptor
@@ -33,8 +33,10 @@ require 'biopieces'
 require 'seq'
 
 casts = []
-casts << {:long=>'right', :short=>'r', :type=>'string', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
-casts << {:long=>'left',  :short=>'l', :type=>'string', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'right_adaptor',      :short=>'r', :type=>'string', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'left_adaptor',       :short=>'l', :type=>'string', :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'right_hamming_dist', :short=>'R', :type=>'uint',   :mandatory=>false, :default=>25,  :allowed=>nil, :disallowed=>nil}
+casts << {:long=>'left_hamming_dist',  :short=>'L', :type=>'uint',   :mandatory=>false, :default=>25,  :allowed=>nil, :disallowed=>nil}
 
 bp = Biopieces.new
 
@@ -44,16 +46,16 @@ bp.each_record do |record|
   if record.has_key? :SEQ
     entry = Seq.new(record[:SEQ_NAME], record[:SEQ], record[:TYPE], record[:SCORES])
 
-    if options[:right]
-      pos_right = entry.adaptor_locate_right(options[:right])
+    if options[:right_adaptor]
+      pos_right = entry.adaptor_locate_right(options[:right_adaptor], options[:right_hamming_dist])
       entry.subseq!(0, pos_right) if pos_right >= 0
       record[:CLIP_ADAPTOR_RIGHT] = pos_right
     else
       record[:CLIP_ADAPTOR_RIGHT] = -1
     end
 
-    if options[:left]
-      pos_left = entry.adaptor_locate_left(options[:left])
+    if options[:left_adaptor]
+      pos_left = entry.adaptor_locate_left(options[:left_adaptor], options[:left_hamming_dist])
       entry.subseq!(pos_left + 1) if pos_left >= 0
       record[:CLIP_ADAPTOR_LEFT] = pos_left
     else
-- 
2.39.5