From 351549b36ba20cf06daf9cf0e14273d84ae1f83e Mon Sep 17 00:00:00 2001 From: martinahansen Date: Tue, 12 Mar 2013 10:44:52 +0000 Subject: [PATCH] fixed score base bug in sff.rb git-svn-id: http://biopieces.googlecode.com/svn/trunk@2132 74ccb610-7750-0410-82ae-013aeee3265d --- code_ruby/lib/maasha/seq.rb | 9 +++++++++ code_ruby/lib/maasha/seq/trim.rb | 1 + code_ruby/lib/maasha/sff.rb | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/code_ruby/lib/maasha/seq.rb b/code_ruby/lib/maasha/seq.rb index 91e7929..d8a73d3 100644 --- a/code_ruby/lib/maasha/seq.rb +++ b/code_ruby/lib/maasha/seq.rb @@ -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 diff --git a/code_ruby/lib/maasha/seq/trim.rb b/code_ruby/lib/maasha/seq/trim.rb index 8efabf9..e7e9bb1 100644 --- a/code_ruby/lib/maasha/seq/trim.rb +++ b/code_ruby/lib/maasha/seq/trim.rb @@ -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 diff --git a/code_ruby/lib/maasha/sff.rb b/code_ruby/lib/maasha/sff.rb index 7111f64..6b277e3 100644 --- a/code_ruby/lib/maasha/sff.rb +++ b/code_ruby/lib/maasha/sff.rb @@ -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 -- 2.39.2