]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed score base bug in sff.rb
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 Mar 2013 10:44:52 +0000 (10:44 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 12 Mar 2013 10:44:52 +0000 (10:44 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@2132 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/lib/maasha/seq.rb
code_ruby/lib/maasha/seq/trim.rb
code_ruby/lib/maasha/sff.rb

index 91e79295039e7f8e572efa0ceaf231e8e91c1bd4..d8a73d31ba8d660fa08bb6aac9c0c24f91137151 100644 (file)
@@ -416,6 +416,15 @@ class Seq
     self
   end
 
+  # Method to add two Seq objects.
+  def +(entry)
+    new_entry = Seq.new()
+    new_entry.seq  = self.seq  + entry.seq
+    new_entry.type = self.type              if self.type == entry.type
+    new_entry.qual = self.qual + entry.qual if self.qual and entry.qual
+    new_entry
+  end
+
   # Method to concatenate sequence entries.
   def <<(entry)
     raise SeqError, "sequences of different types" unless self.type == entry.type
index 8efabf9c8fe24309fdd8c3c9496e06266b1f9a91..e7e9bb1daf6b019e77e78b8eabf44cad1abc2ea5 100644 (file)
@@ -1,3 +1,4 @@
+# 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
index 7111f643426469cfe9cbebc32608854c0310584b..6b277e39b9c9b0e602c08ec386e56968e64df613 100644 (file)
@@ -210,7 +210,7 @@ class Read
     hash[:CLIP_QUAL_RIGHT]    = self.clip_qual_right    - 1
     hash[:CLIP_ADAPTOR_LEFT]  = self.clip_adapter_left  - 1
     hash[:CLIP_ADAPTOR_RIGHT] = self.clip_adaptor_right - 1
-    hash[:SCORES]             = self.quality_scores.map { |i| (i += 64).chr }.join ""
+    hash[:SCORES]             = self.quality_scores.map { |i| (i += Seq::SCORE_BASE).chr }.join ""
     hash[:X_POS]              = self.x_pos
     hash[:Y_POS]              = self.y_pos
 
@@ -219,7 +219,7 @@ class Read
 
   # Method that converts a Read object's data to a Seq object.
   def to_seq
-    Seq.new(self.name, self.bases, nil, self.quality_scores.map { |i| (i += 64).chr }.join("") )
+    Seq.new(self.name, self.bases, nil, self.quality_scores.map { |i| (i += Seq::SCORE_BASE).chr }.join("") )
   end
 
   # Method that soft masks the sequence (i.e. lowercases sequence) according to