]> git.donarmstrong.com Git - biopieces.git/commitdiff
worked on unit tests for sam.rb
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 23 Aug 2011 14:06:02 +0000 (14:06 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 23 Aug 2011 14:06:02 +0000 (14:06 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1492 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/lib/maasha/sam.rb
code_ruby/test/maasha/test_sam.rb

index df518e65d281068c42dcd60394d2bb80171eab30..3ffc56d361c8c92e474c23a23d0699df0421bcd5 100644 (file)
@@ -288,6 +288,17 @@ class Sam < Filesys
       end
     end
   end
+
+  # Method to check if rnext, when not '*' or '='
+  # and @SQ header lines are present, is located
+  # in the header hash.
+  def check_rnext(rnext)
+    unless @header.empty? or rnext == '*' or rnext == '='
+      unless @header[:SQ][:SN].has_key? rnext.to_sym
+        raise SamError, "rnext not found in header hash: #{rnext}"
+      end
+    end
+  end
 end
 
 
index e056b21012dda1de719e79079cf44dd8d9f2f03b..8642f64c31a92a142df57e61797d5d23848d20dc 100755 (executable)
@@ -340,7 +340,7 @@ class SamTest < Test::Unit::TestCase
     assert_raise(SamError) { sam.each }
   end
 
-  def test_Sam_each_wtih_rname_present_in_header_dont_raise
+  def test_Sam_each_with_rname_present_in_header_dont_raise
     sam = Sam.new(StringIO.new("@SQ\tSN:ref\tLN:45\n*\t*\tref\t*\t*\t*\t*\t*\t\*\t*\t*\n"))
     assert_nothing_raised { sam.each }