[BioRuby-cvs] bioruby/test/unit/bio/sequence test_na.rb,1.1,1.2

Naohisa Goto ngoto at dev.open-bio.org
Tue Jun 27 05:44:59 UTC 2006


Update of /home/repository/bioruby/bioruby/test/unit/bio/sequence
In directory dev.open-bio.org:/tmp/cvs-serv7649/test/unit/bio/sequence

Modified Files:
	test_na.rb 
Log Message:
Bio::Sequence::NA#gc_content, #at_content, #gc_skew, #at_skew
are newly added.
Bio::Sequence::NA#gc_percent are changed not to raise ZeroDivisionError
and returns 0 when given sequence is empty.


Index: test_na.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/test/unit/bio/sequence/test_na.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test_na.rb	8 Feb 2006 07:08:22 -0000	1.1
--- test_na.rb	27 Jun 2006 05:44:57 -0000	1.2
***************
*** 99,102 ****
--- 99,128 ----
      end
  
+     def test_gc_content
+       assert_in_delta(0.4, @obj.gc_content, Float::EPSILON)
+       @obj[0, 1] = 'g'
+       assert_in_delta(0.45, @obj.gc_content, Float::EPSILON)
+     end
+ 
+     def test_at_content
+       assert_in_delta(0.6, @obj.at_content, Float::EPSILON)
+       @obj[0, 1] = 'g'
+       assert_in_delta(0.55, @obj.at_content, Float::EPSILON)
+     end
+ 
+     def test_gc_skew
+       assert_in_delta(0.0, @obj.gc_skew, Float::EPSILON)
+       @obj[0, 1] = 'g'
+       assert_in_delta(1.0/9.0, @obj.gc_skew, Float::EPSILON)
+       @obj.gsub!(/a/, 'c')
+       assert_in_delta(-3.0/8.0, @obj.gc_skew, Float::EPSILON)
+     end
+ 
+     def test_at_skew
+       assert_in_delta(1.0/3.0, @obj.at_skew, Float::EPSILON)
+       @obj[0, 1] = 'g'
+       assert_in_delta(3.0/11.0, @obj.at_skew, Float::EPSILON)
+     end
+ 
      def test_iliegal_bases
        @obj[0, 1] = 'n'




More information about the bioruby-cvs mailing list