From d69b157181bcfdea35734d49402c81b3747aed60 Mon Sep 17 00:00:00 2001
From: martinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Date: Tue, 29 Mar 2011 10:14:12 +0000
Subject: [PATCH] fixed Rakefile

git-svn-id: http://biopieces.googlecode.com/svn/trunk@1308 74ccb610-7750-0410-82ae-013aeee3265d
---
 code_ruby/Maasha/Rakefile               |  2 --
 code_ruby/Maasha/lib/biopieces.rb       |  2 +-
 code_ruby/Maasha/lib/bitarray.rb        |  2 +-
 code_ruby/Maasha/lib/seq.rb             |  6 +++---
 code_ruby/Maasha/test/test_biopieces.rb |  4 ++--
 code_ruby/Maasha/test/test_genbank.rb   | 23 +++++++++++------------
 code_ruby/Maasha/test/test_seq.rb       | 22 +++++++++++++++++++---
 7 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/code_ruby/Maasha/Rakefile b/code_ruby/Maasha/Rakefile
index 97902c2..8f5b25f 100644
--- a/code_ruby/Maasha/Rakefile
+++ b/code_ruby/Maasha/Rakefile
@@ -1,7 +1,5 @@
 require 'rake/testtask'
 
-test_dir = File.expand_path('test')
-
 Rake::TestTask.new("test") do |t|
   t.pattern = "test/test_*.rb"
   t.warning = true
diff --git a/code_ruby/Maasha/lib/biopieces.rb b/code_ruby/Maasha/lib/biopieces.rb
index 2f98fe9..37edd66 100644
--- a/code_ruby/Maasha/lib/biopieces.rb
+++ b/code_ruby/Maasha/lib/biopieces.rb
@@ -134,7 +134,7 @@ class Casts < Array
     ubiquitous
     check
     long_to_sym
-    self.push *@cast_list
+    self.push(*@cast_list)
   end
 
   private
diff --git a/code_ruby/Maasha/lib/bitarray.rb b/code_ruby/Maasha/lib/bitarray.rb
index c6a1ebb..8113621 100644
--- a/code_ruby/Maasha/lib/bitarray.rb
+++ b/code_ruby/Maasha/lib/bitarray.rb
@@ -130,7 +130,7 @@ class BitArray
     string
   end
 
-  alias :to_s :to_string
+  alias :to_string :to_s
 
   private
 
diff --git a/code_ruby/Maasha/lib/seq.rb b/code_ruby/Maasha/lib/seq.rb
index 18a0958..e68888f 100644
--- a/code_ruby/Maasha/lib/seq.rb
+++ b/code_ruby/Maasha/lib/seq.rb
@@ -151,7 +151,7 @@ class Seq
     seq      = self.seq
 
     unless wrap.nil?
-      seq.gsub! /(.{#{wrap}})/ do |match|
+      seq.gsub!(/(.{#{wrap}})/) do |match|
         match << "\n"
       end
 
@@ -384,7 +384,7 @@ class Seq
   # Method to convert the quality scores from a specified base
   # to another base.
   def convert_phred2illumina!
-    self.qual.gsub! /./ do |score|
+    self.qual.gsub!(/./) do |score|
       score_phred  = score.ord - SCORE_PHRED
       raise SeqError, "Bad Phred score: #{score} (#{score_phred})" unless (0 .. 40).include? score_phred
       score_illumina = score_phred + SCORE_ILLUMINA
@@ -395,7 +395,7 @@ class Seq
   # Method to convert the quality scores from Solexa odd/ratio to
   # Illumina format.
   def convert_solexa2illumina!
-    self.qual.gsub! /./ do |score|
+    self.qual.gsub!(/./) do |score|
       score = solexa_char2illumina_char(score)
     end
   end
diff --git a/code_ruby/Maasha/test/test_biopieces.rb b/code_ruby/Maasha/test/test_biopieces.rb
index ec781d1..be702b5 100755
--- a/code_ruby/Maasha/test/test_biopieces.rb
+++ b/code_ruby/Maasha/test/test_biopieces.rb
@@ -26,7 +26,6 @@ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 require 'test/unit'
-require 'mocha'
 require 'biopieces'
 require 'pp'
 
@@ -305,10 +304,11 @@ class BiopiecesTest < Test::Unit::TestCase
 
   # TODO replace the absolute part below the file location with File.dirname(__FILE__)
   def test_Biopieces_parse_with_glob_argument_expands_correctly
+    flunk("This test is weird")
     argv    = ["--foo", "/Users/maasha/unit_test/foo*,/Users/maasha/unit_test/my_dir/*.fna", "-I", DUMMY_FILE]
     casts   = [{:long=>"foo", :short=>"f", :type=>"files!", :mandatory=>false, :default=>nil, :allowed=>nil, :disallowed=>nil}]
     options = @bp.parse(argv, casts, SCRIPT_PATH)
-    assert_equal(options[:foo], ["/Users/maasha/unit_test/foo.fna", "/Users/maasha/unit_test/my_dir/bar.fna"])
+    assert_equal(["/Users/maasha/unit_test/foo.fna", "/Users/maasha/unit_test/my_dir/bar.fna"], options[:foo])
   end
 
   def test_Biopieces_parse_with_dir_cast_and_dir_dont_exists_raises
diff --git a/code_ruby/Maasha/test/test_genbank.rb b/code_ruby/Maasha/test/test_genbank.rb
index b6ceb63..3c46386 100755
--- a/code_ruby/Maasha/test/test_genbank.rb
+++ b/code_ruby/Maasha/test/test_genbank.rb
@@ -33,33 +33,32 @@ require 'pp'
 
 class TestGenbank < Test::Unit::TestCase 
   def setup
-    seq  = Seq.new(nil, "tcatgatcaagatctaacagcagaagtacacttctattta", "dna")
-    @loc = Locator.new("", seq)
+    @seq = Seq.new(nil, "tcatgatcaagatctaacagcagaagtacacttctattta", "dna")
   end
 
   def test_Locator_with_single_position_returns_correctly
-    @loc.locator = "10"
-    assert_equal("a", @loc.subseq.seq)
+    loc = Locator.new("10", @seq)
+    assert_equal("a", loc.subseq.seq)
   end
 
   def test_Locator_with_single_interval_returns_correctly
-    @loc.locator = "5..10"
-    assert_equal("gatca", @loc.subseq.seq)
+    loc = Locator.new("5..10", @seq)
+    assert_equal("gatca", loc.subseq.seq)
   end
 
   def test_Locator_with_multiple_intervals_return_correctly
-    @loc.locator = "5..10,15..20"
-    assert_equal("gatcataaca", @loc.subseq.seq)
+    loc = Locator.new("5..10,15..20", @seq)
+    assert_equal("gatcataaca", loc.subseq.seq)
   end
 
   def test_Locator_with_join_multiple_intervals_return_correctly
-    @loc.locator = "join(5..10,15..20)"
-    assert_equal("gatcataaca", @loc.subseq.seq)
+    loc = Locator.new("join(5..10,15..20)", @seq)
+    assert_equal("gatcataaca", loc.subseq.seq)
   end
 
   def test_Locator_with_complement_and_single_interval_return_correctly
-    @loc.locator = "complement(5..10)"
-    assert_equal("tgatc", @loc.subseq.seq)
+    loc = Locator.new("complement(5..10)", @seq)
+    assert_equal("tgatc", loc.subseq.seq)
   end
 end
 
diff --git a/code_ruby/Maasha/test/test_seq.rb b/code_ruby/Maasha/test/test_seq.rb
index 5caed92..d785c8c 100755
--- a/code_ruby/Maasha/test/test_seq.rb
+++ b/code_ruby/Maasha/test/test_seq.rb
@@ -266,7 +266,7 @@ class TestSeq < Test::Unit::TestCase
     assert_equal("CG", @entry.seq)
   end
 
-  def test_Seq_subseq_bang_returns_correct_qual
+  def test_Seq_subseq_bang_with_pos_and_len_returns_correct_qual
     @entry.seq  = "ATCG"
     @entry.qual = "abcd"
     @entry.subseq!(0, 2)
@@ -277,7 +277,7 @@ class TestSeq < Test::Unit::TestCase
     assert_equal("cd", @entry.qual)
   end
 
-  def test_Seq_subseq_bang_returns_correct_qual
+  def test_Seq_subseq_bang_with_pos_returns_correct_qual
     @entry.seq  = "ATCG"
     @entry.qual = "abcd"
     @entry.subseq!(0)
@@ -333,12 +333,14 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_adaptor_locate_right_with_bad_hamming_dist_raises
+    flunk("adaptor location needs updating")
     @entry.seq = "ATCG"
     assert_raise(SeqError) { @entry.adaptor_locate_right("ATCG", -1) }
     assert_raise(SeqError) { @entry.adaptor_locate_right("ATCG", 101) }
   end
 
   def test_Seq_adaptor_locate_right_with_ok_hamming_dist_dont_raise
+    flunk("adaptor location needs updating")
     @entry.seq = "ATCG"
     assert_nothing_raised { @entry.adaptor_locate_right("ATCG", 0) }
     assert_nothing_raised { @entry.adaptor_locate_right("ATCG", 50.5) }
@@ -346,6 +348,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_adaptor_locate_right_returns_correctly
+    flunk("adaptor location needs updating")
     @entry.seq = "nnnnncgat"
     assert_equal(-1, @entry.adaptor_locate_right("X"))
     assert_equal(8,  @entry.adaptor_locate_right("TX"))
@@ -356,18 +359,21 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_adaptor_locate_right_with_hd_returns_correctly
+    flunk("adaptor location needs updating")
     @entry.seq = "nnnnncgat"
     assert_equal(5, @entry.adaptor_locate_right("XGAT", 25))
     assert_equal(5, @entry.adaptor_locate_right("XXAT", 50))
   end
 
   def test_Seq_adaptor_locate_left_with_bad_hamming_dist_raises
+    flunk("adaptor location needs updating")
     @entry.seq = "ATCG"
     assert_raise(SeqError) { @entry.adaptor_locate_left("ATCG", -1) }
     assert_raise(SeqError) { @entry.adaptor_locate_left("ATCG", 101) }
   end
 
   def test_Seq_adaptor_locate_left_with_ok_hamming_dist_dont_raise
+    flunk("adaptor location needs updating")
     @entry.seq = "ATCG"
     assert_nothing_raised { @entry.adaptor_locate_left("ATCG", 0) }
     assert_nothing_raised { @entry.adaptor_locate_left("ATCG", 50.5) }
@@ -375,6 +381,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_adaptor_locate_left_returns_correctly
+    flunk("adaptor location needs updating")
     @entry.seq = "cgatnnnnn"
     assert_equal(-1, @entry.adaptor_locate_left("X"))
     assert_equal(0,  @entry.adaptor_locate_left("XC"))
@@ -385,24 +392,28 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_adaptor_locate_left_with_hd_returns_correctly
+    flunk("adaptor location needs updating")
     @entry.seq = "cgatnnnnn"
     assert_equal(3, @entry.adaptor_locate_left("XGAT", 25))
     assert_equal(3, @entry.adaptor_locate_left("XXAT", 50))
   end
 
   def test_Seq_adaptor_clip_right_returns_correct_sequence
+    flunk("adaptor location needs updating")
     @entry.seq = "nnnnncgat"
     @entry.adaptor_clip_right("cgat")
     assert_equal( "nnnnn", @entry.seq)
   end
 
   def test_Seq_adaptor_clip_right_with_hd_returns_correct_sequence
+    flunk("adaptor location needs updating")
     @entry.seq = "nnnnncgat"
     @entry.adaptor_clip_right("xgat", 25)
     assert_equal( "nnnnn", @entry.seq)
   end
 
   def test_Seq_adaptor_clip_right_returns_correct_qual
+    flunk("adaptor location needs updating")
     @entry.seq  = "nnnnncgat"
     @entry.qual = "abcdefghi"
     @entry.adaptor_clip_right("cgat")
@@ -410,6 +421,7 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_adaptor_clip_right_with_hd_returns_correct_qual
+    flunk("adaptor location needs updating")
     @entry.seq  = "nnnnncgat"
     @entry.qual = "abcdefghi"
     @entry.adaptor_clip_right("xgat", 25)
@@ -417,25 +429,29 @@ class TestSeq < Test::Unit::TestCase
   end
 
   def test_Seq_adaptor_clip_left_returns_correct_sequence
+    flunk("adaptor location needs updating")
     @entry.seq = "cgatnnnnn"
     @entry.adaptor_clip_left("cgat")
     assert_equal( "nnnnn", @entry.seq)
   end
 
   def test_Seq_adaptor_clip_left_with_hd_returns_correct_sequence
+    flunk("adaptor location needs updating")
     @entry.seq = "cgatnnnnn"
     @entry.adaptor_clip_left("cgax", 25)
     assert_equal( "nnnnn", @entry.seq)
   end
 
   def test_Seq_adaptor_clip_left_returns_correct_qual
+    flunk("adaptor location needs updating")
     @entry.seq  = "cgatnnnnn"
     @entry.qual = "abcdefghi"
     @entry.adaptor_clip_left("cgat")
     assert_equal( "efghi", @entry.qual)
   end
 
-  def test_Seq_adaptor_clip_left_returns_correct_qual
+  def test_Seq_adaptor_clip_left_with_len_returns_correct_qual
+    flunk("adaptor location needs updating")
     @entry.seq  = "cgatnnnnn"
     @entry.qual = "abcdefghi"
     @entry.adaptor_clip_left("cgax", 25)
-- 
2.39.5