]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed Rakefile
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 29 Mar 2011 10:14:12 +0000 (10:14 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 29 Mar 2011 10:14:12 +0000 (10:14 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1308 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/Maasha/Rakefile
code_ruby/Maasha/lib/biopieces.rb
code_ruby/Maasha/lib/bitarray.rb
code_ruby/Maasha/lib/seq.rb
code_ruby/Maasha/test/test_biopieces.rb
code_ruby/Maasha/test/test_genbank.rb
code_ruby/Maasha/test/test_seq.rb

index 97902c232e5a342788042caefbb16a8cb7677a38..8f5b25f3359498b4d8860c7c73e20512116f2698 100644 (file)
@@ -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
index 2f98fe9f9812b815fb4c3dc33001390e64f3a0f0..37edd66db60e32f5101464ab08753d1e34e99fc9 100644 (file)
@@ -134,7 +134,7 @@ class Casts < Array
     ubiquitous
     check
     long_to_sym
-    self.push *@cast_list
+    self.push(*@cast_list)
   end
 
   private
index c6a1ebbd66e5a22349b8ad6ca9d18fe6671b1806..811362155da1c52d2e67fbdddb975a95129f05f9 100644 (file)
@@ -130,7 +130,7 @@ class BitArray
     string
   end
 
-  alias :to_s :to_string
+  alias :to_string :to_s
 
   private
 
index 18a09586bb9cb915d2e8c974efc0bfae87f1d17a..e68888fa06d931e4c31870a43d1e3a5d9ff74d4f 100644 (file)
@@ -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
index ec781d1955a8781a9854e15346d0844e4c018ce4..be702b514b4965b0c08c55d3d6d0e34725ba8617 100755 (executable)
@@ -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
index b6ceb63bee1b76b32fe00ec664b54eafece772dd..3c4638652db8d00ef65abda1e8f13e489509cedb 100755 (executable)
@@ -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
 
index 5caed92db84e5194b2a623c16305579585011250..d785c8cfd2c76f455d99b0cc61e4da5b30289f8e 100755 (executable)
@@ -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)