[BioRuby-cvs] bioruby/test/unit/bio/appl/iprscan test_report.rb, 1.6, 1.7

Mitsuteru C. Nakao nakao at dev.open-bio.org
Wed Jul 18 11:11:59 UTC 2007


Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/iprscan
In directory dev.open-bio.org:/tmp/cvs-serv28494/test/unit/bio/appl/iprscan

Modified Files:
	test_report.rb 
Log Message:
* Changed method names:
  1. reports_in_* -> parse_*
  2. parse_in_* -> parse_*_entry
  3. to_* -> format_*
* Added Report#output(:format_type) method to be the facade pattern of 
  format_* methods.


Index: test_report.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/iprscan/test_report.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** test_report.rb	17 Jul 2007 14:16:50 -0000	1.6
--- test_report.rb	18 Jul 2007 11:11:57 -0000	1.7
***************
*** 44,48 ****
  //
  END
!       @obj = Bio::Iprscan::Report.parse_in_ptxt(test_entry)
      end 
     
--- 44,48 ----
  //
  END
!       @obj = Bio::Iprscan::Report.parse_ptxt_entry(test_entry)
      end 
     
***************
*** 69,73 ****
  
      def test_match_method
!       assert_equal('BlastProDom', @obj.matches.first.method)
      end
  
--- 69,73 ----
  
      def test_match_method
!       assert_equal('BlastProDom', @obj.matches.first.method_name)
      end
  
***************
*** 98,102 ****
      def setup
        test_txt = Bio::TestIprscanData.txt_format.read.split(/\n\nSequence/)[0]
!       @obj = Bio::Iprscan::Report.parse_in_txt(test_txt)
      end 
  
--- 98,102 ----
      def setup
        test_txt = Bio::TestIprscanData.txt_format.read.split(/\n\nSequence/)[0]
!       @obj = Bio::Iprscan::Report.parse_txt_entry(test_txt)
      end 
  
***************
*** 126,130 ****
  
      def test_match_method
!       assert_equal('FPrintScan', @obj.matches.first.method)
      end
  
--- 126,130 ----
  
      def test_match_method
!       assert_equal('FPrintScan', @obj.matches.first.method_name)
      end
  
***************
*** 170,188 ****
      def setup
        test_txt = Bio::TestIprscanData.txt_format.read.split(/\n\nSequence/)[0]
!       @obj = Bio::Iprscan::Report.parse_in_txt(test_txt)
      end 
      
!     def test_list_of_interpro
!       hsh = {"IPR008994"=>[12, 13, 14], 
!              "IPR000110"=>[0, 1, 2], 
!              "IPR003029"=>[3, 4, 5, 6, 7, 8, 9, 10, 11], 
!              "NULL"=>[15]}
!       assert_equal(hsh, @obj.list_of_interpro)
      end
  
!     def test_list_of_interpro_match?
!       @obj.list_of_interpro.each do |ipr_id, indexes|
!         indexes.each do |index|
!           assert_equal(ipr_id, @obj.matches[index].ipr_id)
          end
        end
--- 170,189 ----
      def setup
        test_txt = Bio::TestIprscanData.txt_format.read.split(/\n\nSequence/)[0]
!       @obj = Bio::Iprscan::Report.parse_txt_entry(test_txt)
      end 
      
!     def test_to_hash
!       hsh = {"IPR008994" => [12, 13, 14].map {|x| @obj.matches[x] },
!              "IPR000110" => [0, 1, 2].map {|x| @obj.matches[x] },
!              "IPR003029" => [3, 4, 5, 6, 7, 8, 9, 10, 11].map {|x| @obj.matches[x] },
!              "NULL" => [15].map {|x| @obj.matches[x] }}
!       assert_equal(hsh.keys.sort, @obj.to_hash.keys.sort)
!       assert_equal(hsh, @obj.to_hash)
      end
  
!     def test_to_hash_match?
!       @obj.to_hash.each do |ipr_id, matches|
!         matches.each do |match|
!           assert_equal(ipr_id, match.ipr_id)
          end
        end
***************
*** 196,201 ****
      end 
  
!     def test_reports_in_txt 
!       Bio::Iprscan::Report.reports_in_txt(@test_txt) do |report|
          assert_equal(Bio::Iprscan::Report, report.class)
        end
--- 197,202 ----
      end 
  
!     def test_parse_txt 
!       Bio::Iprscan::Report.parse_txt(@test_txt) do |report|
          assert_equal(Bio::Iprscan::Report, report.class)
        end
***************
*** 216,220 ****
            entry << line
          elsif entry != '' and entry.split("\t").first != line.split("\t").first
!           @obj << Bio::Iprscan::Report.parse_in_raw(entry)
            entry = ''
          else
--- 217,221 ----
            entry << line
          elsif entry != '' and entry.split("\t").first != line.split("\t").first
!           @obj << Bio::Iprscan::Report.parse_raw_entry(entry)
            entry = ''
          else
***************
*** 222,226 ****
          end
        end
!       @obj << Bio::Iprscan::Report.parse_in_raw(entry)
      end
  
--- 223,227 ----
          end
        end
!       @obj << Bio::Iprscan::Report.parse_raw_entry(entry)
      end
  
***************
*** 229,233 ****
                                 "merged.raw"))
        result = []
!       Bio::Iprscan::Report.reports_in_raw(io) {|x| result << x }
        assert_equal(@obj.size, result.size)
        assert_equal(@obj.first.query_id, result.first.query_id)      
--- 230,234 ----
                                 "merged.raw"))
        result = []
!       Bio::Iprscan::Report.parse_raw(io) {|x| result << x }
        assert_equal(@obj.size, result.size)
        assert_equal(@obj.first.query_id, result.first.query_id)      
***************
*** 266,270 ****
      
      def test_match_method
!       assert_equal('HMMPfam', @obj.first.matches.first.method)
      end
      
--- 267,271 ----
      
      def test_match_method
!       assert_equal('HMMPfam', @obj.first.matches.first.method_name)
      end
      
***************
*** 316,325 ****
    class TestIprscanReport < Test::Unit::TestCase
      def setup
!       test_txt = Bio::TestIprscanData.txt_format.read.split(/\n\nSequence/)[0]
!       @obj = Bio::Iprscan::Report.parse_in_txt(test_txt)
      end 
  
      def test_to_raw
! #      puts @obj.to_raw
      end
  
--- 317,335 ----
    class TestIprscanReport < Test::Unit::TestCase
      def setup
!       @test_txt = Bio::TestIprscanData.txt_format.read.split(/\n\nSequence/)[0]
!       @obj = Bio::Iprscan::Report.parse_txt_entry(@test_txt)
!       @test_raw = Bio::TestIprscanData.raw_format.read.split("RS16_ECOLI")[0]
      end 
  
      def test_to_raw
! #      assert_equal(@test_raw.split("\n").sort, 
! #                   @obj.format_raw.split("\n").sort)      
!     end
! 
!     def test_output_raw
! #      assert_equal(@test_raw.split("\n").sort, 
! #                   @obj.output(:raw).split("\n").sort)      
! #      assert_equal(@test_raw.split("\n").sort, 
! #                   @obj.output('raw').split("\n").sort)      
      end
  




More information about the bioruby-cvs mailing list