From ngoto at pub.open-bio.org Fri Dec 2 02:01:40 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Dec 2 01:56:19 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_alignment.rb,1.4,1.5 Message-ID: <200512020701.jB271eVL024738@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv24705/test/unit/bio Modified Files: test_alignment.rb Log Message: * consensus_iupac now returns only standard bases 'a', 'c', 'g', 't', 'm', 'r', 'w', 's', 'y', 'k', 'v', 'h', 'd', 'b', 'n', or nil (in SiteMethods#consensus_iupac) or '?' (or missing_char, in EnumerableExtension#consensus_iupac). Note that consensus_iupac now does not return u and invalid letters not defined in IUPAC standard even if all bases are equal. * added more tests to test_alignment.rb Index: test_alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_alignment.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_alignment.rb 25 Nov 2005 16:53:32 -0000 1.4 --- test_alignment.rb 2 Dec 2005 07:01:38 -0000 1.5 *************** *** 138,142 **** end #class TestAlignmentPropertyMethods ! class TestAlignmentSite < Test::Unit::TestCase --- 138,145 ---- end #class TestAlignmentPropertyMethods ! # This is a unit test of Bio::Alignment::Site class and ! # Bio::Alignment::SiteMethods module. ! # Since Bio::Alignment::Site includes Bio::Alignment::SiteMethods, ! # we can test both at a time. class TestAlignmentSite < Test::Unit::TestCase *************** *** 239,243 **** --- 242,414 ---- end #class TestAlignmentSite + class TestAlignmentSequenceArray < Test::Unit::TestCase + def test_each_seq + expected_results = [ 'atg', 'aag', 'acg' ] + a = Alignment::SequenceArray[ *expected_results ] + a.each_seq do |x| + assert_equal(expected_results.shift, x) + end + assert(expected_results.empty?) + end + + def test_seqclass_default + a = Alignment::SequenceArray.new + assert_equal(String, a.seqclass) + end + + def test_seqclass + a = Alignment::SequenceArray[ Bio::Sequence::NA.new('atg') ] + assert_equal(Bio::Sequence::NA, a.seqclass) + end + + def test_seqclass=() + a = Alignment::SequenceArray.new + assert_equal(String, a.seqclass) + a << Bio::Sequence::NA.new('a') + assert_equal(Bio::Sequence::NA, a.seqclass) + a.seqclass = Bio::Sequence::AA + assert_equal(Bio::Sequence::AA, a.seqclass) + end + + def test_alignment_length + a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] + assert_equal(4, a.alignment_length) + end + + def test_private_alignment_site + a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] + assert_equal(Alignment::Site[ '-', 't', 't', 't', '-' ], + a.instance_eval { _alignment_site(1) }) + end + def test_alignment_site + a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] + assert_equal(Alignment::Site[ '-', 't', 't', 't', '-' ], + a.__send__(:_alignment_site, 1)) + end + + def test_each_site + expected_results = [ + Alignment::Site[ 'a', 'a', 'a', 'a', '-' ], + Alignment::Site[ '-', 't', 't', 't', '-' ], + Alignment::Site[ '-', '-', 'g', 'g', '-' ], + Alignment::Site[ '-', '-', 'c', '-', '-' ] + ] + a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] + a.each_site do |site| + assert_equal(expected_results.shift, site) + end + assert(expected_results.empty?) + end + + def test_each_site_step + expected_results = [ + Alignment::Site[ '-', 't', 't', 't', '-' ], # site 1 + Alignment::Site[ '-', 'a', 'g', 't', '-' ], # site 3 + ] + a = Alignment::SequenceArray[ 'a', 'atgatc', 'atggcc', 'atgtga', '' ] + a.each_site_step(1, 4, 2) do |site| + assert_equal(expected_results.shift, site) + end + assert(expected_results.empty?) + end + + def test_alignment_collect + a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] + assert_equal(Alignment::SequenceArray[ 'a', 'au', 'augc', 'aug', '' ], + a.alignment_collect { |x| x.gsub(/t/, 'u') }) + end + + def test_alignment_window + a = Alignment::SequenceArray[ 'a', 'at', 'atgca', 'atg', '' ] + assert_equal(Alignment::SequenceArray[ '', 't', 'tgc', 'tg', '' ], + a.alignment_window(1, 3)) + end + + def test_each_window + expected_results = [ + Alignment::SequenceArray[ 'atg', 'tcg', '' ], # 0..2 + Alignment::SequenceArray[ 'gca', 'gat', '' ], # 2..4 + Alignment::SequenceArray[ 'atg', 'tgc', '' ], # 4..6 + Alignment::SequenceArray[ 'c', 'a', '' ] # 7..7 + ] + a = Alignment::SequenceArray[ 'atgcatgc', 'tcgatgca', '' ] + r = a.each_window(3, 2) do |x| + assert_equal(expected_results.shift, x) + end + assert_equal(expected_results.shift, r) + assert(expected_results.empty?) + end + + def test_collect_each_site + a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] + assert_equal(["aaaa-", "-ttt-", "--gg-", "--c--" ], + a.collect_each_site { |x| x.join('') }) + end + + def test_consensus_each_site_default + expected_results = [ + Alignment::Site[ 'a', 'a', 'a', 'a', 'a' ], + Alignment::Site[ 'a', 'c', 'g', 't', '-' ] + ] + + a = Alignment::SequenceArray[ 'aa', 'ac', 'ag', 'at', 'a-' ] + result = a.consensus_each_site do |site| + assert_equal(expected_results.shift, site) + 'x' + end + assert_equal('xx', result) + assert(expected_results.empty?) + end + + def test_consensus_each_site_gap_mode_1 + expected_results = [ + Alignment::Site[ 'a', 'a', 'a', 'a', 'a' ] + ] + + a = Alignment::SequenceArray[ 'aa', 'ac', 'ag', 'at', 'a-' ] + result = a.consensus_each_site(:gap_mode => 1) do |site| + assert_equal(expected_results.shift, site) + 'x' + end + assert_equal('x-', result) + assert(expected_results.empty?) + end + + def test_consensus_each_site_gap_mode_minus1 + expected_results = [ + Alignment::Site[ 'a', 'a', 'a', 'a', 'a' ], + Alignment::Site[ 'a', 'c', 'g', 't' ] + ] + + a = Alignment::SequenceArray[ 'aa', 'ac', 'ag', 'at', 'a-' ] + result = a.consensus_each_site(:gap_mode => -1) do |site| + assert_equal(expected_results.shift, site) + 'x' + end + assert_equal('xx', result) + assert(expected_results.empty?) + end + + def test_consensus_string_default + a = Alignment::SequenceArray[ 'ata', 'aac', 'aag', 'aat' ] + assert_equal('a??', a.consensus_string) + end + + def test_consensus_string_half + a = Alignment::SequenceArray[ 'ata', 'aac', 'aag', 'aat' ] + assert_equal('aa?', a.consensus_string(0.5)) + end + + def test_consensus_iupac + a = Alignment::SequenceArray[ + 'acgtaaaccgaaacaz', + 'acgtaaaccgccggcz', + 'acgtcgtgttgtttgz', + 'acgtcgtgttaaactz' ] + assert_equal('acgtmrwsykvhdbn?', a.consensus_iupac) + end + + end #class TestAlignmentSequenceArray From ngoto at pub.open-bio.org Fri Dec 2 02:01:40 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Dec 2 01:56:20 2005 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.12,1.13 Message-ID: <200512020701.jB271eVL024736@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv24705/lib/bio Modified Files: alignment.rb Log Message: * consensus_iupac now returns only standard bases 'a', 'c', 'g', 't', 'm', 'r', 'w', 's', 'y', 'k', 'v', 'h', 'd', 'b', 'n', or nil (in SiteMethods#consensus_iupac) or '?' (or missing_char, in EnumerableExtension#consensus_iupac). Note that consensus_iupac now does not return u and invalid letters not defined in IUPAC standard even if all bases are equal. * added more tests to test_alignment.rb Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** alignment.rb 25 Nov 2005 16:50:39 -0000 1.12 --- alignment.rb 2 Dec 2005 07:01:37 -0000 1.13 *************** *** 228,232 **** a = self.collect { |x| x.downcase }.sort.uniq if a.size == 1 then ! a[0] elsif r = IUPAC_NUC.find { |x| (a - x).size <= 0 } then r[0] --- 228,239 ---- a = self.collect { |x| x.downcase }.sort.uniq if a.size == 1 then ! case a[0] ! when 'a', 'c', 'g', 't' ! a[0] ! when 'u' ! 't' ! else ! IUPAC_NUC.find { |x| a[0] == x[0] } ? a[0] : nil ! end elsif r = IUPAC_NUC.find { |x| (a - x).size <= 0 } then r[0] *************** *** 329,333 **** # For Array or Hash objects, you'd better using # ArrayExtension or HashExtension modules, respectively. ! # They have built-in 'each_seq' method. # module EnumerableExtension --- 336,341 ---- # For Array or Hash objects, you'd better using # ArrayExtension or HashExtension modules, respectively. ! # They would have built-in each_seq method and/or ! # some methods would be redefined. # module EnumerableExtension *************** *** 336,340 **** # Iterates over each sequences. # Yields a sequence. ! # It acts same as Enumerable#each. # # You would redefine the method suitable for the class/object. --- 344,348 ---- # Iterates over each sequences. # Yields a sequence. ! # It acts the same as Enumerable#each. # # You would redefine the method suitable for the class/object. *************** *** 380,383 **** --- 388,395 ---- # If the position is out of range, it returns the site # of which all are gaps. + # + # It is a private method. + # Only difference from public alignment_site method is + # it does not do set_all_property(get_all_property). def _alignment_site(position) site = Site.new *************** *** 433,437 **** end ! # Iterates over each sequence and each results running block # are collected and returns a new alignment as a # Bio::Alignment::SequenceArray object. --- 445,449 ---- end ! # Iterates over each sequence and results running blocks # are collected and returns a new alignment as a # Bio::Alignment::SequenceArray object. From ngoto at pub.open-bio.org Fri Dec 2 07:01:30 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Dec 2 06:56:20 2005 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.13,1.14 Message-ID: <200512021201.jB2C1UVL025772@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv25760/lib/bio Modified Files: alignment.rb Log Message: fixed bugs in EnumerableExtension#alignment_rstrip! and #remove_all_gaps!. Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** alignment.rb 2 Dec 2005 07:01:37 -0000 1.13 --- alignment.rb 2 Dec 2005 12:01:28 -0000 1.14 *************** *** 735,739 **** each_site_step(len - 1, 0, -1) do |a| a.remove_gaps! ! if a.empty then newlen -= 1 else --- 735,739 ---- each_site_step(len - 1, 0, -1) do |a| a.remove_gaps! ! if a.empty? then newlen -= 1 else *************** *** 743,747 **** return nil if newlen >= len each_seq do |s| ! s[len..-1] = '' if s.length > len end self --- 743,747 ---- return nil if newlen >= len each_seq do |s| ! s[newlen..-1] = '' if s.length > newlen end self *************** *** 792,796 **** ret = nil each_seq do |s| ! ret ||= s.gsub!(gap_regexp, '') end ret ? self : nil --- 792,797 ---- ret = nil each_seq do |s| ! x = s.gsub!(gap_regexp, '') ! ret ||= x end ret ? self : nil From ngoto at pub.open-bio.org Fri Dec 2 08:01:51 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Dec 2 07:56:28 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_alignment.rb,1.5,1.6 Message-ID: <200512021301.jB2D1pVL025886@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv25876/test/unit/bio Modified Files: test_alignment.rb Log Message: * TestAlignmentSequenceArray are changed to TestAlignmentEnumerableExtension. * Added more tests Index: test_alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_alignment.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_alignment.rb 2 Dec 2005 07:01:38 -0000 1.5 --- test_alignment.rb 2 Dec 2005 13:01:49 -0000 1.6 *************** *** 242,249 **** end #class TestAlignmentSite ! class TestAlignmentSequenceArray < Test::Unit::TestCase def test_each_seq expected_results = [ 'atg', 'aag', 'acg' ] ! a = Alignment::SequenceArray[ *expected_results ] a.each_seq do |x| assert_equal(expected_results.shift, x) --- 242,254 ---- end #class TestAlignmentSite ! # This is sample class for testing Bio::Alignment::EnumerableExtension. ! class A < Array ! include Alignment::EnumerableExtension ! end ! ! class TestAlignmentEnumerableExtension < Test::Unit::TestCase def test_each_seq expected_results = [ 'atg', 'aag', 'acg' ] ! a = A[ *expected_results ] a.each_seq do |x| assert_equal(expected_results.shift, x) *************** *** 253,267 **** def test_seqclass_default ! a = Alignment::SequenceArray.new assert_equal(String, a.seqclass) end def test_seqclass ! a = Alignment::SequenceArray[ Bio::Sequence::NA.new('atg') ] assert_equal(Bio::Sequence::NA, a.seqclass) end def test_seqclass=() ! a = Alignment::SequenceArray.new assert_equal(String, a.seqclass) a << Bio::Sequence::NA.new('a') --- 258,272 ---- def test_seqclass_default ! a = A.new assert_equal(String, a.seqclass) end def test_seqclass ! a = A[ Bio::Sequence::NA.new('atg') ] assert_equal(Bio::Sequence::NA, a.seqclass) end def test_seqclass=() ! a = A.new assert_equal(String, a.seqclass) a << Bio::Sequence::NA.new('a') *************** *** 272,281 **** def test_alignment_length ! a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(4, a.alignment_length) end def test_private_alignment_site ! a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(Alignment::Site[ '-', 't', 't', 't', '-' ], a.instance_eval { _alignment_site(1) }) --- 277,286 ---- def test_alignment_length ! a = A[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(4, a.alignment_length) end def test_private_alignment_site ! a = A[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(Alignment::Site[ '-', 't', 't', 't', '-' ], a.instance_eval { _alignment_site(1) }) *************** *** 283,287 **** def test_alignment_site ! a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(Alignment::Site[ '-', 't', 't', 't', '-' ], a.__send__(:_alignment_site, 1)) --- 288,292 ---- def test_alignment_site ! a = A[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(Alignment::Site[ '-', 't', 't', 't', '-' ], a.__send__(:_alignment_site, 1)) *************** *** 295,299 **** Alignment::Site[ '-', '-', 'c', '-', '-' ] ] ! a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] a.each_site do |site| assert_equal(expected_results.shift, site) --- 300,304 ---- Alignment::Site[ '-', '-', 'c', '-', '-' ] ] ! a = A[ 'a', 'at', 'atgc', 'atg', '' ] a.each_site do |site| assert_equal(expected_results.shift, site) *************** *** 307,311 **** Alignment::Site[ '-', 'a', 'g', 't', '-' ], # site 3 ] ! a = Alignment::SequenceArray[ 'a', 'atgatc', 'atggcc', 'atgtga', '' ] a.each_site_step(1, 4, 2) do |site| assert_equal(expected_results.shift, site) --- 312,316 ---- Alignment::Site[ '-', 'a', 'g', 't', '-' ], # site 3 ] ! a = A[ 'a', 'atgatc', 'atggcc', 'atgtga', '' ] a.each_site_step(1, 4, 2) do |site| assert_equal(expected_results.shift, site) *************** *** 315,319 **** def test_alignment_collect ! a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(Alignment::SequenceArray[ 'a', 'au', 'augc', 'aug', '' ], a.alignment_collect { |x| x.gsub(/t/, 'u') }) --- 320,324 ---- def test_alignment_collect ! a = A[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(Alignment::SequenceArray[ 'a', 'au', 'augc', 'aug', '' ], a.alignment_collect { |x| x.gsub(/t/, 'u') }) *************** *** 321,325 **** def test_alignment_window ! a = Alignment::SequenceArray[ 'a', 'at', 'atgca', 'atg', '' ] assert_equal(Alignment::SequenceArray[ '', 't', 'tgc', 'tg', '' ], a.alignment_window(1, 3)) --- 326,330 ---- def test_alignment_window ! a = A[ 'a', 'at', 'atgca', 'atg', '' ] assert_equal(Alignment::SequenceArray[ '', 't', 'tgc', 'tg', '' ], a.alignment_window(1, 3)) *************** *** 333,337 **** Alignment::SequenceArray[ 'c', 'a', '' ] # 7..7 ] ! a = Alignment::SequenceArray[ 'atgcatgc', 'tcgatgca', '' ] r = a.each_window(3, 2) do |x| assert_equal(expected_results.shift, x) --- 338,342 ---- Alignment::SequenceArray[ 'c', 'a', '' ] # 7..7 ] ! a = A[ 'atgcatgc', 'tcgatgca', '' ] r = a.each_window(3, 2) do |x| assert_equal(expected_results.shift, x) *************** *** 342,346 **** def test_collect_each_site ! a = Alignment::SequenceArray[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(["aaaa-", "-ttt-", "--gg-", "--c--" ], a.collect_each_site { |x| x.join('') }) --- 347,351 ---- def test_collect_each_site ! a = A[ 'a', 'at', 'atgc', 'atg', '' ] assert_equal(["aaaa-", "-ttt-", "--gg-", "--c--" ], a.collect_each_site { |x| x.join('') }) *************** *** 353,357 **** ] ! a = Alignment::SequenceArray[ 'aa', 'ac', 'ag', 'at', 'a-' ] result = a.consensus_each_site do |site| assert_equal(expected_results.shift, site) --- 358,362 ---- ] ! a = A[ 'aa', 'ac', 'ag', 'at', 'a-' ] result = a.consensus_each_site do |site| assert_equal(expected_results.shift, site) *************** *** 367,371 **** ] ! a = Alignment::SequenceArray[ 'aa', 'ac', 'ag', 'at', 'a-' ] result = a.consensus_each_site(:gap_mode => 1) do |site| assert_equal(expected_results.shift, site) --- 372,376 ---- ] ! a = A[ 'aa', 'ac', 'ag', 'at', 'a-' ] result = a.consensus_each_site(:gap_mode => 1) do |site| assert_equal(expected_results.shift, site) *************** *** 382,386 **** ] ! a = Alignment::SequenceArray[ 'aa', 'ac', 'ag', 'at', 'a-' ] result = a.consensus_each_site(:gap_mode => -1) do |site| assert_equal(expected_results.shift, site) --- 387,391 ---- ] ! a = A[ 'aa', 'ac', 'ag', 'at', 'a-' ] result = a.consensus_each_site(:gap_mode => -1) do |site| assert_equal(expected_results.shift, site) *************** *** 392,416 **** def test_consensus_string_default ! a = Alignment::SequenceArray[ 'ata', 'aac', 'aag', 'aat' ] assert_equal('a??', a.consensus_string) end def test_consensus_string_half ! a = Alignment::SequenceArray[ 'ata', 'aac', 'aag', 'aat' ] assert_equal('aa?', a.consensus_string(0.5)) end def test_consensus_iupac ! a = Alignment::SequenceArray[ 'acgtaaaccgaaacaz', 'acgtaaaccgccggcz', 'acgtcgtgttgtttgz', ! 'acgtcgtgttaaactz' ] assert_equal('acgtmrwsykvhdbn?', a.consensus_iupac) end ! end #class TestAlignmentSequenceArray --- 397,568 ---- def test_consensus_string_default ! a = A[ 'ata', 'aac', 'aag', 'aat' ] assert_equal('a??', a.consensus_string) end def test_consensus_string_half ! a = A[ 'ata', 'aac', 'aag', 'aat' ] assert_equal('aa?', a.consensus_string(0.5)) end def test_consensus_iupac ! a = A[ 'acgtaaaccgaaacaz', 'acgtaaaccgccggcz', 'acgtcgtgttgtttgz', ! 'acgtcgtgttaaactz' ! ] assert_equal('acgtmrwsykvhdbn?', a.consensus_iupac) end ! def test_match_line_amino ! a = A[ ! 'M-SNNNQMMHF-CASSSSSNNFH-AW', ! 'M-TEHDHIIYY-STATTGNDEVF-FW', ! 'M-AQQERLLHW-AVGNPNDEQLY-HW', ! 'M-SKKQKVFYF-CASKADEQHIH-LW', ! 'M-TNNNQMMHY-STASSSQHRMF-QW', ! 'M-AEHDHIIYW-AVGTTGKKKFY-YW' ! #* ::::::::: ........... * ! ] ! assert_equal('* ::::::::: ........... *', a.match_line_amino) ! end ! ! def test_match_line_nuc ! a = A[ 'aaa', 'aa-','aac', 'at-' ] ! assert_equal('* ', a.match_line_nuc) ! end ! ! def test_match_line ! a = A[ ! Sequence::AA.new('MNSA'), ! Sequence::AA.new('MHTL'), ! Sequence::AA.new('MQNV'), ! Sequence::AA.new('MKKW'), ! ] ! assert_equal('*:. ', a.match_line) ! assert_equal('*:. ', a.match_line(:type => :aa)) ! assert_equal('* ', a.match_line(:type => :na)) ! end ! ! def test_convert_match ! a = A[ ! 'aaaa', ! 'accc', ! 'acac', ! 'actc' ! ] ! a.convert_match ! assert_equal(A[ 'aaaa', '.ccc', '.c.c', '.ctc' ], a) ! end ! ! def test_convert_unmatch ! a = A[ 'aaaa', '.ccc', '.c.c', '.ctc' ] ! a.convert_unmatch ! assert_equal(A[ 'aaaa', 'accc', 'acac', 'actc' ], a) ! end ! ! def test_alignment_normalize! ! a = A[ 'a', 'atg', 'atgc', '' ] ! a.alignment_normalize! ! assert_equal(A[ 'a---', 'atg-', 'atgc', '----'], a) ! end ! ! def test_alignment_rstrip! ! a = A[ '--aaa--', '--t-t--', '---g---', '--t' ] ! assert(a.alignment_rstrip!) ! assert_equal(A[ '--aaa', '--t-t', '---g-', '--t' ], a) ! end ! ! def test_alignment_rstrip_nil ! a = A[ 'aa', '-a', 'a-' ] ! assert_nil(a.alignment_rstrip!) ! assert_equal(A[ 'aa', '-a', 'a-' ], a) ! end ! ! def test_alignment_lstrip! ! a = A[ '--aaa--', '--t-t--', '---g---', '--t' ] ! assert(a.alignment_lstrip!) ! assert_equal(A[ 'aaa--', 't-t--', '-g---', 't' ], a) ! end ! ! def test_alignment_lstrip_nil ! a = A[ 'aa', '-a', 'a-' ] ! assert_nil(a.alignment_lstrip!) ! assert_equal(A[ 'aa', '-a', 'a-' ], a) ! end ! ! def test_alignment_strip! ! a = A[ '--aaa--', '--t-t--', '---g---', '--t' ] ! assert(a.alignment_strip!) ! assert_equal(A[ 'aaa', 't-t', '-g-', 't' ], a) ! end ! ! def test_alignment_strip_nil ! a = A[ 'aa', '-a', 'a-' ] ! assert_nil(a.alignment_strip!) ! assert_equal(A[ 'aa', '-a', 'a-' ], a) ! end ! ! def test_remove_all_gaps! ! a = A[ '--aaa--', '--t-t--', '---g---', '--t' ] ! assert(a.remove_all_gaps!) ! assert_equal(A[ 'aaa', 'tt', 'g', 't' ], a) ! end ! ! # test of alignment_slice. ! # Please also refer alignment_window. ! def test_alignment_slice ! a = A[ 'a', 'at', 'atgca', 'atg', '' ] ! assert_equal(Alignment::SequenceArray[ '', 't', 'tgc', 'tg', nil ], ! a.alignment_slice(1, 3)) ! end + def test_alignment_subseq + a = A[ Sequence.new('a'), Sequence.new('at'), Sequence.new('atgca'), + Sequence.new('atg'), Sequence.new('') ] + assert_equal(Alignment::SequenceArray[ Sequence.new(''), + Sequence.new('t'), Sequence.new('tgc'), + Sequence.new('tg'), nil ], + a.alignment_subseq(2,4)) + end + def test_alignment_concat + a = A[ 'aaa', 'c', 'gg', 't' ] + a.alignment_concat(A[ 'ttt', 'gg', 'aa', 'cc', 'aa' ]) + assert_equal(A[ 'aaattt', 'cgg', 'ggaa', 'tcc' ], a) + a.alignment_concat([ 'c', 't' ]) + assert_equal(A[ 'aaatttc', 'cggt', 'ggaa', 'tcc' ], a) + end + end #class TestAlignmentEnumerableExtension + + class TestAlignmentClustalWFormatter < Test::Unit::TestCase + def setup + @obj = Object.new + @obj.extend(Alignment::ClustalWFormatter) + end + + def test_have_same_name_true + assert_equal([ 0, 1 ], @obj.instance_eval { + have_same_name?([ 'ATP ATG', 'ATP ATA', 'BBB' ]) }) + end + + def test_have_same_name_false + assert_equal(false, @obj.instance_eval { + have_same_name?([ 'GTP ATG', 'ATP ATA', 'BBB' ]) }) + end + + def test_avoid_same_name + assert_equal([ 'ATP_ATG', 'ATP_ATA', 'BBB' ], + @obj.instance_eval { + avoid_same_name([ 'ATP ATG', 'ATP ATA', 'BBB' ]) }) + end + def test_avoid_same_name_numbering + assert_equal([ '0_ATP', '1_ATP', '2_BBB' ], + @obj.instance_eval { + avoid_same_name([ 'ATP', 'ATP', 'BBB' ]) }) + end + + end #class TestAlignmentClustalWFormatter From k at pub.open-bio.org Tue Dec 6 07:29:03 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Dec 6 07:23:21 2005 Subject: [BioRuby-cvs] bioruby/doc Tutorial.rd.ja,1.16,1.17 Message-ID: <200512061229.jB6CT3VL019934@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv19930 Modified Files: Tutorial.rd.ja Log Message: * added BioRuby shell documentation Index: Tutorial.rd.ja =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Tutorial.rd.ja,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Tutorial.rd.ja 24 Sep 2005 14:58:21 -0000 1.16 --- Tutorial.rd.ja 6 Dec 2005 12:29:00 -0000 1.17 *************** *** 3,37 **** $Id$ ! Copyright (C) 2001-2003 KATAYAMA Toshiaki ! 英語版翻訳: Naohisa Goto ! 英語版監訳: PjotrPrins ! Wikiでご覧になっている方へ: この文書はBioRubyのCVSレポジトリにて管理 ! しています。Wikiで編集しても、別途CVSにも反映させないと変更内容が失わ ! れてしまいます。連絡方法は(()) をご覧ください。 [...1028 lines suppressed...] - == Using BioPerl from Ruby - - (...) - - == 必要なライブラリのインストール - - 現在のところ、BioRubyの使用には追加の外部ライブラリや拡張モジュールは必要 - ありません(Ruby 1.8.0以降の場合)。(ただし、XMLParseやBDBなど、いくつかの - 拡張モジュールをインストールすることで、一部の機能がスピードアップしたり - 機能が増える場合があります。) - - とはいえ、将来的には必要になるかもしれませんので、BioRubyのウェブサイトや - 付属文書をチェックしてみてください。 - - Rubyの拡張ライブラリをインストールするには、基本的にはその配布物に付属の - READMEなどの文章を注意深く読んで、そこに書いてある事を手動で行う必要が - あります。(将来的には、gems が標準になってより簡単になるかもしれません。) =end --- 2029,2032 ---- From k at pub.open-bio.org Wed Dec 7 00:12:09 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 00:06:13 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.10,1.11 Message-ID: <200512070512.jB75C9VL027055@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv26999/lib/bio Modified Files: shell.rb Log Message: * lib/bioruby.rb is added for easy bioruby script startup after the discussion with Tanka-san (.bioruby/script.rb will use this) * access.rb plugin is moved under the plugin directory as a entry.rb * Core is changed to Ghost :) Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shell.rb 28 Nov 2005 07:06:32 -0000 1.10 --- shell.rb 7 Dec 2005 05:12:06 -0000 1.11 *************** *** 36,40 **** require 'bio/shell/core' require 'bio/shell/session' ! require 'bio/shell/access' require 'bio/shell/plugin/seq' require 'bio/shell/plugin/midi' --- 36,40 ---- require 'bio/shell/core' require 'bio/shell/session' ! require 'bio/shell/plugin/entry' require 'bio/shell/plugin/seq' require 'bio/shell/plugin/midi' *************** *** 44,48 **** require 'bio/shell/plugin/keggapi' ! extend Core extend Private --- 44,48 ---- require 'bio/shell/plugin/keggapi' ! extend Ghost extend Private From k at pub.open-bio.org Wed Dec 7 00:12:08 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 00:06:20 2005 Subject: [BioRuby-cvs] bioruby/bin bioruby,1.9,1.10 Message-ID: <200512070512.jB75C8VL027047@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/bin In directory pub.open-bio.org:/tmp/cvs-serv26999/bin Modified Files: bioruby Log Message: * lib/bioruby.rb is added for easy bioruby script startup after the discussion with Tanka-san (.bioruby/script.rb will use this) * access.rb plugin is moved under the plugin directory as a entry.rb * Core is changed to Ghost :) Index: bioruby =================================================================== RCS file: /home/repository/bioruby/bioruby/bin/bioruby,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** bioruby 28 Nov 2005 07:03:28 -0000 1.9 --- bioruby 7 Dec 2005 05:12:06 -0000 1.10 *************** *** 59,63 **** # change prompt for bioruby ! $_ = Bio::Shell::Core::ESC_SEQ IRB.conf[:PROMPT][:BIORUBY_COLOR] = { :PROMPT_I => "bio#{$_[:ruby]}ruby#{$_[:none]}> ", --- 59,63 ---- # change prompt for bioruby ! $_ = Bio::Shell.esc_seq IRB.conf[:PROMPT][:BIORUBY_COLOR] = { :PROMPT_I => "bio#{$_[:ruby]}ruby#{$_[:none]}> ", From k at pub.open-bio.org Wed Dec 7 00:12:08 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 00:06:20 2005 Subject: [BioRuby-cvs] bioruby/lib bioruby.rb,NONE,1.1 Message-ID: <200512070512.jB75C8VL027049@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory pub.open-bio.org:/tmp/cvs-serv26999/lib Added Files: bioruby.rb Log Message: * lib/bioruby.rb is added for easy bioruby script startup after the discussion with Tanka-san (.bioruby/script.rb will use this) * access.rb plugin is moved under the plugin directory as a entry.rb * Core is changed to Ghost :) --- NEW FILE: bioruby.rb --- # # = bioruby.rb - Loading all BioRuby modules and setup for shell programming # # Copyright:: Copyright (C) 2005 # Toshiaki Katayama # License:: LGPL # # $Id: bioruby.rb,v 1.1 2005/12/07 05:12:06 k Exp $ # #-- # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #++ # require 'bio/shell' include Bio::Shell Bio::Shell.setup From k at pub.open-bio.org Wed Dec 7 00:12:09 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 00:06:31 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb, 1.8, 1.9 entry.rb, 1.3, 1.4 Message-ID: <200512070512.jB75C9VL027063@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv26999/lib/bio/shell/plugin Modified Files: codon.rb entry.rb Log Message: * lib/bioruby.rb is added for easy bioruby script startup after the discussion with Tanka-san (.bioruby/script.rb will use this) * access.rb plugin is moved under the plugin directory as a entry.rb * Core is changed to Ghost :) Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** codon.rb 28 Nov 2005 12:07:42 -0000 1.8 --- codon.rb 7 Dec 2005 05:12:07 -0000 1.9 *************** *** 31,47 **** class ColoredCodonTable - Color = Bio::Shell::Core::ESC_SEQ - - @@colors = { - :text => Color[:none], - :aa => Color[:green], - :start => Color[:red], - :stop => Color[:red], - :basic => Color[:cyan], - :polar => Color[:blue], - :acidic => Color[:magenta], - :nonpolar => Color[:yellow], - } - @@properties = { :basic => %w( H K R ), --- 31,34 ---- *************** *** 58,61 **** --- 45,49 ---- @cuhash = cuhash if Bio::Shell.config[:color] + setup_colors generate_colored_text else *************** *** 65,68 **** --- 53,71 ---- attr_reader :table + def setup_colors + esc_seq = Bio::Shell.esc_seq + + @colors = { + :text => esc_seq[:none], + :aa => esc_seq[:green], + :start => esc_seq[:red], + :stop => esc_seq[:red], + :basic => esc_seq[:cyan], + :polar => esc_seq[:blue], + :acidic => esc_seq[:magenta], + :nonpolar => esc_seq[:yellow], + } + end + def generate_mono_text @table.each do |codon, aa| *************** *** 94,116 **** if aa == '*' ! color_code = "#{@@colors[:stop]}STOP" if @cuhash ! color_aa = "#{@@colors[:stop]}#{aa}" else color_aa = '' end else ! color_code = "#{@@colors[property]}#{@aacode[aa]}" if @table.start_codon?(codon) if @cuhash ! color_aa = "#{@@colors[:aa]}#{aa}" else ! color_aa = "#{@@colors[:start]}#{aa}" end else if @cuhash ! color_aa = "#{@@colors[property]}#{aa}" else ! color_aa = "#{@@colors[:aa]}#{aa}" end end --- 97,119 ---- if aa == '*' ! color_code = "#{@colors[:stop]}STOP" if @cuhash ! color_aa = "#{@colors[:stop]}#{aa}" else color_aa = '' end else ! color_code = "#{@colors[property]}#{@aacode[aa]}" if @table.start_codon?(codon) if @cuhash ! color_aa = "#{@colors[:aa]}#{aa}" else ! color_aa = "#{@colors[:start]}#{aa}" end else if @cuhash ! color_aa = "#{@colors[property]}#{aa}" else ! color_aa = "#{@colors[:aa]}#{aa}" end end *************** *** 119,134 **** if @cuhash percent = @cuhash[codon].to_s.rjust(6) ! eval("@#{codon} = '#{color_aa}#{@@colors[:text]}#{percent}'") else ! eval("@#{codon} = ' #{color_code} #{color_aa}#{@@colors[:text]} '") end end @hydrophilic = [ ! "#{@@colors[:basic]}basic#{@@colors[:text]},", ! "#{@@colors[:polar]}polar#{@@colors[:text]},", ! "#{@@colors[:acidic]}acidic#{@@colors[:text]}" ].join(" ") ! @hydrophobic = "#{@@colors[:nonpolar]}nonpolar" end --- 122,137 ---- if @cuhash percent = @cuhash[codon].to_s.rjust(6) ! eval("@#{codon} = '#{color_aa}#{@colors[:text]}#{percent}'") else ! eval("@#{codon} = ' #{color_code} #{color_aa}#{@colors[:text]} '") end end @hydrophilic = [ ! "#{@colors[:basic]}basic#{@colors[:text]},", ! "#{@colors[:polar]}polar#{@colors[:text]},", ! "#{@colors[:acidic]}acidic#{@colors[:text]}" ].join(" ") ! @hydrophobic = "#{@colors[:nonpolar]}nonpolar" end *************** *** 175,179 **** text = header + table end ! text.gsub(/^\s+#/, @@colors[:text]) end --- 178,182 ---- text = header + table end ! text.gsub(/^\s+#/, @colors[:text]) end Index: entry.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/entry.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** entry.rb 28 Nov 2005 12:07:42 -0000 1.3 --- entry.rb 7 Dec 2005 05:12:07 -0000 1.4 *************** *** 1,4 **** # ! # = bio/shell/access.rb - database access module # # Copyright:: Copyright (C) 2005 --- 1,4 ---- # ! # = bio/shell/plugin/entry.rb - extract entry and sequence # # Copyright:: Copyright (C) 2005 From k at pub.open-bio.org Wed Dec 7 00:12:09 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 00:06:43 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.14,1.15 Message-ID: <200512070512.jB75C9VL027059@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv26999/lib/bio/shell Modified Files: core.rb Log Message: * lib/bioruby.rb is added for easy bioruby script startup after the discussion with Tanka-san (.bioruby/script.rb will use this) * access.rb plugin is moved under the plugin directory as a entry.rb * Core is changed to Ghost :) Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** core.rb 28 Nov 2005 07:03:28 -0000 1.14 --- core.rb 7 Dec 2005 05:12:07 -0000 1.15 *************** *** 1,4 **** # ! # = bio/shell/core.rb - internal methods for BioRuby shell # # Copyright:: Copyright (C) 2005 --- 1,4 ---- # ! # = bio/shell/core.rb - internal methods for the BioRuby shell # # Copyright:: Copyright (C) 2005 *************** *** 27,31 **** # ! module Bio::Shell::Core CONFIG = "config" --- 27,31 ---- # ! module Bio::Shell::Ghost CONFIG = "config" *************** *** 56,59 **** --- 56,63 ---- } + def esc_seq + ESC_SEQ + end + ### save/restore the environment *************** *** 263,267 **** def config_message(str = nil) ! str ||= Bio::Shell::Core::MESSAGE @config[:message] = str end --- 267,271 ---- def config_message(str = nil) ! str ||= MESSAGE @config[:message] = str end *************** *** 437,444 **** File.open(file, "w") do |f| f.print "#!/usr/bin/env ruby\n\n" ! f.print "require 'bio/shell'\n\n" ! f.print "include Bio::Shell\n\n" ! f.print "Bio::Shell.setup\n\n" ! f.puts Readline::HISTORY.to_a[@script_begin..@script_end] end puts "done" --- 441,447 ---- File.open(file, "w") do |f| f.print "#!/usr/bin/env ruby\n\n" ! f.print "require 'bioruby'\n\n" ! f.print Readline::HISTORY.to_a[@script_begin..@script_end] ! f.print "\n\n" end puts "done" From k at pub.open-bio.org Wed Dec 7 02:24:17 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 02:18:24 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.9,1.10 Message-ID: <200512070724.jB77OHVL027374@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv27370/lib/bio/shell/plugin Modified Files: codon.rb Log Message: * codontables is chagned to return hash Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** codon.rb 7 Dec 2005 05:12:07 -0000 1.9 --- codon.rb 7 Dec 2005 07:24:15 -0000 1.10 *************** *** 196,202 **** def codontables ! Bio::CodonTable::DEFINITIONS.sort.each do |i, definition| puts "#{i}\t#{definition}" end end --- 196,204 ---- def codontables ! tables = Bio::CodonTable::DEFINITIONS ! tables.sort.each do |i, definition| puts "#{i}\t#{definition}" end + return tables end From k at pub.open-bio.org Wed Dec 7 02:31:42 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 02:25:46 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.10,1.11 Message-ID: <200512070731.jB77VgVL027418@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv27409/lib/bio/shell/plugin Modified Files: codon.rb Log Message: * fixed a bug introduced by the previous patch to separate Bio::Shell::Core (realized that setup_color is also needed for mono mode) Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** codon.rb 7 Dec 2005 07:24:15 -0000 1.10 --- codon.rb 7 Dec 2005 07:31:40 -0000 1.11 *************** *** 44,49 **** @number = number @cuhash = cuhash if Bio::Shell.config[:color] - setup_colors generate_colored_text else --- 44,49 ---- @number = number @cuhash = cuhash + setup_colors if Bio::Shell.config[:color] generate_colored_text else From k at pub.open-bio.org Wed Dec 7 02:50:47 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 02:44:49 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell session.rb,1.10,1.11 Message-ID: <200512070750.jB77olVL027479@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv27465/lib/bio/shell Modified Files: session.rb Log Message: * less command is changed to use config Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** session.rb 28 Nov 2005 12:07:42 -0000 1.10 --- session.rb 7 Dec 2005 07:50:44 -0000 1.11 *************** *** 123,127 **** def less(file) ! pager = ENV['PAGER'] || "less" system("#{pager} #{file}") end --- 123,127 ---- def less(file) ! pager = Bio::Shell.config[:pager] || ENV['PAGER'] || "less" system("#{pager} #{file}") end From k at pub.open-bio.org Wed Dec 7 05:54:25 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 05:48:27 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.15,1.16 Message-ID: <200512071054.jB7AsPVL028151@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv28147/lib/bio/shell Modified Files: core.rb Log Message: * minor fix (reverted) Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** core.rb 7 Dec 2005 05:12:07 -0000 1.15 --- core.rb 7 Dec 2005 10:54:23 -0000 1.16 *************** *** 442,446 **** f.print "#!/usr/bin/env ruby\n\n" f.print "require 'bioruby'\n\n" ! f.print Readline::HISTORY.to_a[@script_begin..@script_end] f.print "\n\n" end --- 442,446 ---- f.print "#!/usr/bin/env ruby\n\n" f.print "require 'bioruby'\n\n" ! f.puts Readline::HISTORY.to_a[@script_begin..@script_end] f.print "\n\n" end From k at pub.open-bio.org Wed Dec 7 06:23:53 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 06:17:55 2005 Subject: [BioRuby-cvs] bioruby/lib/bio db.rb,0.30,0.31 Message-ID: <200512071123.jB7BNrVL028264@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv28253/lib/bio Modified Files: db.rb Log Message: * fixed to check empty or incomplete string (e.g. empty entry) Index: db.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db.rb,v retrieving revision 0.30 retrieving revision 0.31 diff -C2 -d -r0.30 -r0.31 *** db.rb 30 Oct 2005 17:15:05 -0000 0.30 --- db.rb 7 Dec 2005 11:23:51 -0000 0.31 *************** *** 211,226 **** # space and stripeed. def truncate(str) ! return str.gsub(/\s+/, ' ').strip end # Returns a tag name of the field as a String. def tag_get(str) ! return str[0,@tagsize].strip end # Returns a String of the field without a tag name. def tag_cut(str) ! str[0,@tagsize] = '' ! return str end --- 211,237 ---- # space and stripeed. def truncate(str) ! if str ! str.gsub(/\s+/, ' ').strip ! else ! "" ! end end # Returns a tag name of the field as a String. def tag_get(str) ! if str ! str[0,@tagsize].strip ! else ! "" ! end end # Returns a String of the field without a tag name. def tag_cut(str) ! if str ! str[0,@tagsize] = '' ! else ! "" ! end end From k at pub.open-bio.org Wed Dec 7 06:23:53 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 06:17:55 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/genbank common.rb, 1.8, 1.9 genbank.rb, 0.37, 0.38 Message-ID: <200512071123.jB7BNrVL028268@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/genbank In directory pub.open-bio.org:/tmp/cvs-serv28253/lib/bio/db/genbank Modified Files: common.rb genbank.rb Log Message: * fixed to check empty or incomplete string (e.g. empty entry) Index: genbank.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/genbank.rb,v retrieving revision 0.37 retrieving revision 0.38 diff -C2 -d -r0.37 -r0.38 *** genbank.rb 14 Nov 2005 05:43:43 -0000 0.37 --- genbank.rb 7 Dec 2005 11:23:51 -0000 0.38 *************** *** 32,36 **** class Locus def initialize(locus_line) ! if locus_line.length > 75 # after Rel 126.0 @entry_id = locus_line[12..27].strip @length = locus_line[29..39].to_i --- 32,38 ---- class Locus def initialize(locus_line) ! if locus_line.empty? ! # do nothing (just for empty or incomplete entry string) ! elsif locus_line.length > 75 # after Rel 126.0 @entry_id = locus_line[12..27].strip @length = locus_line[29..39].to_i Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/common.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** common.rb 14 Nov 2005 05:43:43 -0000 1.8 --- common.rb 7 Dec 2005 11:23:51 -0000 1.9 *************** *** 54,62 **** def acc_version ! versions.first end def accession ! acc_version.split(/\./).first end --- 54,62 ---- def acc_version ! versions.first.to_s end def accession ! acc_version.split(/\./).first.to_s end *************** *** 92,95 **** --- 92,96 ---- unless @data['SOURCE'] name, org = get('SOURCE').split('ORGANISM') + org ||= "" if org[/\S+;/] organism = $` *************** *** 137,141 **** authors = truncate(tag_cut(field)) authors = authors.split(/, /) ! authors[-1] = authors[-1].split(/\s+and\s+/) authors = authors.flatten.map { |a| a.sub(/,/, ', ') } hash['authors'] = authors --- 138,142 ---- authors = truncate(tag_cut(field)) authors = authors.split(/, /) ! authors[-1] = authors[-1].split(/\s+and\s+/) if authors[-1] authors = authors.flatten.map { |a| a.sub(/,/, ', ') } hash['authors'] = authors *************** *** 237,240 **** --- 238,242 ---- unless @data['ORIGIN'] ori, seqstr = get('ORIGIN').split("\n", 2) + seqstr ||= "" @data['ORIGIN'] = truncate(tag_cut(ori)) @data['SEQUENCE'] = seqstr.tr("0-9 \t\n\r\/", '') From k at pub.open-bio.org Wed Dec 7 06:40:47 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Dec 7 06:35:00 2005 Subject: [BioRuby-cvs] bioruby/doc Tutorial.rd.ja,1.17,1.18 Message-ID: <200512071140.jB7BelVL028330@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv28316/doc Modified Files: Tutorial.rd.ja Log Message: * clean up Index: Tutorial.rd.ja =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Tutorial.rd.ja,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Tutorial.rd.ja 6 Dec 2005 12:29:00 -0000 1.17 --- Tutorial.rd.ja 7 Dec 2005 11:40:45 -0000 1.18 *************** *** 41,44 **** --- 41,54 ---- のような感じでバージョンが表示されます。バージョン 1.8.2 以降をお勧めします。 + Ruby 標準装備のクラスやメソッドについては、Ruby のリファレンスマニュアルを + 参照してください。 + + * (()) + + コマンドラインでヘルプを参照するには、Ruby 標準添付の ri コマンドや、 + 日本語版の refe コマンドが便利です。 [...1082 lines suppressed...] 出力形式を扱うようにしています。しかし、このフォーマットでは得られる データが限られるので、"-m 7" の XML 形式の出力を使うことをお勧めします。 - (Ruby 1.8.0以降を使用すれば、特別な外部ライブラリを別途インストール - しなくても大丈夫です。Ruby 1.6.X では XMLParser または REXMLを別途 - インストールしてください。) すでに見たように Bio::Fasta::Report と Bio::Blast::Report の Hit オブジェ --- 1634,1645 ---- をそれぞれ指定します。 ! ところで、BLAST では "-m 7" オプションによる XML 出力フォーマッットの方が ! 得られる情報が豊富なため、Bio::Blast は Ruby 用の XML ライブラリである ! XMLParser または REXML が使用可能な場合は、XML 出力を利用します。 ! 両方使用可能な場合、XMLParser のほうが高速なので優先的に使用されます。 ! なお、Ruby 1.8.0 以降では REXML は Ruby 本体に標準添付されています。 ! もし XML ライブラリがインストールされていない場合は "-m 8" のタブ区切りの 出力形式を扱うようにしています。しかし、このフォーマットでは得られる データが限られるので、"-m 7" の XML 形式の出力を使うことをお勧めします。 すでに見たように Bio::Fasta::Report と Bio::Blast::Report の Hit オブジェ From k at pub.open-bio.org Sat Dec 10 13:14:24 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Dec 10 13:08:14 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data na.rb,0.18,0.19 Message-ID: <200512101814.jBAIEOVL014132@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv14128/lib/bio/data Modified Files: na.rb Log Message: * to_re method is improved for the efficiency especially for longer sequence Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.18 retrieving revision 0.19 diff -C2 -d -r0.18 -r0.19 *** na.rb 25 Nov 2005 15:59:29 -0000 0.18 --- na.rb 10 Dec 2005 18:14:22 -0000 0.19 *************** *** 177,188 **** def to_re(seq, rna = false) ! str = "" ! seq.to_s.downcase.each_byte do |base| ! if re = NAMES[base.chr] ! str += re ! else ! str += "." ! end ! end if rna str.tr!("t", "u") --- 177,184 ---- def to_re(seq, rna = false) ! str = seq.to_s ! str.gsub!(/[^atgcu]/) { |base| ! NAMES[base] || '.' ! } if rna str.tr!("t", "u") From nakao at pub.open-bio.org Sun Dec 11 09:59:27 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 11 09:53:17 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/io test_ddbjxml.rb,NONE,1.1 Message-ID: <200512111459.jBBExRVL025284@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/io In directory pub.open-bio.org:/tmp/cvs-serv25274/test/unit/bio/io Added Files: test_ddbjxml.rb Log Message: * Newly added. --- NEW FILE: test_ddbjxml.rb --- # # test/unit/bio/io/test_ddbjxml.rb - Unit test for DDBJ XML. # # Copyright (C) 2005 Mitsuteru Nakao # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_ddbjxml.rb,v 1.1 2005/12/11 14:59:25 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/io/ddbjxml' module Bio class TestDDBJXMLConstants < Test::Unit::TestCase def test_constants constants = ["DDBJ", "TxSearch", "ClustalW", "PML", "Gib", "Fasta", "BASE_URI", "SRS", "Gtop", "GetEntry", "Blast"].sort assert_equal(constants, Bio::DDBJ::XML.constants.sort) end def test_base_url assert_equal("http://xml.nig.ac.jp/wsdl/", Bio::DDBJ::XML::BASE_URI) end def test_blast_server_rul assert_equal("http://xml.nig.ac.jp/wsdl/Blast.wsdl", Bio::DDBJ::XML::Blast::SERVER_URI) end def test_clustalw_server_url assert_equal("http://xml.nig.ac.jp/wsdl/ClustalW.wsdl", Bio::DDBJ::XML::ClustalW::SERVER_URI) end def test_ddbj_server_url assert_equal("http://xml.nig.ac.jp/wsdl/DDBJ.wsdl", Bio::DDBJ::XML::DDBJ::SERVER_URI) end def test_fasta_server_url assert_equal("http://xml.nig.ac.jp/wsdl/Fasta.wsdl", Bio::DDBJ::XML::Fasta::SERVER_URI) end def test_getentry_server_url assert_equal("http://xml.nig.ac.jp/wsdl/GetEntry.wsdl", Bio::DDBJ::XML::GetEntry::SERVER_URI) end def test_gib_server_url assert_equal("http://xml.nig.ac.jp/wsdl/Gib.wsdl", Bio::DDBJ::XML::Gib::SERVER_URI) end def test_gtop_server_url assert_equal("http://xml.nig.ac.jp/wsdl/Gtop.wsdl", Bio::DDBJ::XML::Gtop::SERVER_URI) end def test_pml_server_url assert_equal("http://xml.nig.ac.jp/wsdl/PML.wsdl", Bio::DDBJ::XML::PML::SERVER_URI) end def test_srs_server_url assert_equal("http://xml.nig.ac.jp/wsdl/SRS.wsdl", Bio::DDBJ::XML::SRS::SERVER_URI) end def test_txsearch_server_url assert_equal("http://xml.nig.ac.jp/wsdl/TxSearch.wsdl", Bio::DDBJ::XML::TxSearch::SERVER_URI) end end end From k at pub.open-bio.org Sun Dec 11 20:44:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 11 20:38:29 2005 Subject: [BioRuby-cvs] bioruby README,1.10,1.11 Message-ID: <200512120144.jBC1iuVL026521@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv26517 Modified Files: README Log Message: * fixed typo Index: README =================================================================== RCS file: /home/repository/bioruby/bioruby/README,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README 26 Sep 2005 00:48:04 -0000 1.10 --- README 12 Dec 2005 01:44:54 -0000 1.11 *************** *** 165,169 **** require_gem 'bio' ! == LICENCE BioRuby can be freely distributed under the GNU LGPL licence. --- 165,169 ---- require_gem 'bio' ! == LICENSE BioRuby can be freely distributed under the GNU LGPL licence. From k at pub.open-bio.org Sun Dec 11 21:06:38 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 11 21:00:10 2005 Subject: [BioRuby-cvs] bioruby README,1.11,1.12 Message-ID: <200512120206.jBC26cVL026578@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv26574 Modified Files: README Log Message: * fixed one more typo;) Index: README =================================================================== RCS file: /home/repository/bioruby/bioruby/README,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** README 12 Dec 2005 01:44:54 -0000 1.11 --- README 12 Dec 2005 02:06:35 -0000 1.12 *************** *** 167,171 **** == LICENSE ! BioRuby can be freely distributed under the GNU LGPL licence. Note that, install.rb included in the BioRuby package comes from --- 167,171 ---- == LICENSE ! BioRuby can be freely distributed under the GNU LGPL license. Note that, install.rb included in the BioRuby package comes from From ngoto at pub.open-bio.org Fri Dec 16 14:23:05 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Dec 16 14:16:07 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb atom.rb, 1.2, 1.3 pdb.rb, 1.3, 1.4 Message-ID: <200512161923.jBGJN5VL014379@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory pub.open-bio.org:/tmp/cvs-serv14367/d Modified Files: atom.rb pdb.rb Log Message: grave changes It does not work correctly now. Index: atom.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/atom.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** atom.rb 8 Sep 2005 01:22:11 -0000 1.2 --- atom.rb 16 Dec 2005 19:23:02 -0000 1.3 *************** *** 56,124 **** end #class Coordinate ! #Atom class class Atom - include Utils include Comparable - attr_accessor :serial, :element, :alt_loc, :x, :y, :z, - :occ, :bfac, :residue - - def initialize(serial, element, alt_loc, x, y, z, - occ, bfac, residue = nil) - - @serial = serial - @element = element - @alt_loc = alt_loc - @x = x - @y = y - @z = z - @occ = occ - @bfac = bfac - - @residue = residue - - end - #Returns a Coordinate class instance of the xyz positions def xyz ! Coordinate[@x,@y,@z] end #Returns an array of the xyz positions def to_a ! [@x,@y,@z] end #Sorts based on serial numbers def <=>(other) ! return @serial <=> other.serial end #Stringifies to PDB format def to_s ! if @element.length < 4 ! elementOutput = " " << "%-3s" % @element ! else ! elementOutput = @element ! end ! if @residue.hetatm ! "HETATM%5s %s%1s%3s %1s%4s%1s %8.3f%8.3f%8.3f%6.2f%6.2f" % [ @serial, elementOutput, @alt_loc, @residue.resName, @residue.chain.id, @residue.resSeq, @residue.iCode, @x, @y, @z, @occ, @bfac ] else ! "ATOM %5s %s%1s%3s %1s%4s%1s %8.3f%8.3f%8.3f%6.2f%6.2f" % [ @serial, elementOutput, @alt_loc, @residue.resName, @residue.chain.id, @residue.resSeq, @residue.iCode, @x, @y, @z, @occ, @bfac ] end end - - end - - end - - end - - =begin ! = Bio::PDB::Atom ! A class for atom data - each ATOM line is parsed into an Atom object ! =end --- 56,110 ---- end #class Coordinate ! # Bio::PDB::Atom is a class for atom data. ! # Each ATOM line is parsed into an Atom object. ! Atom = Struct.new(:serial, :element, :alt_loc, :x, :y, :z, ! :occ, :bfac, :residue) class Atom include Utils include Comparable #Returns a Coordinate class instance of the xyz positions def xyz ! Coordinate[ x, y, z ] end #Returns an array of the xyz positions def to_a ! [ x, y, z ] end #Sorts based on serial numbers def <=>(other) ! return serial <=> other.serial end #Stringifies to PDB format def to_s ! if element.length < 4 ! elementOutput = sprintf(" %-3s", element) else ! elementOutput = element end + sprintf("%-6s%5s %s%1s%3s %1s%4s%1s %8.3f%8.3f%8.3f%6.2f%6.2f", + record_type, + serial, elementOutput, alt_loc, residue.resName, + residue.chain.id, residue.resSeq, residue.iCode, + x, y, z, occ, bfac) end ! def record_type ! 'ATOM' ! end ! end #class Atom ! # Bio::PDB::HetAtm is a class for HETATM data. ! # Each HETATM line is parsed into an HetAtm object. ! # Since HetAtm inherits Atom class, please refer Atom class for usage. ! class HetAtm < Atom ! def record_type ! 'HETATM' ! end ! end #class HetAtm ! end #class PDB ! end #class Bio Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pdb.rb 26 Sep 2005 13:00:08 -0000 1.3 --- pdb.rb 16 Dec 2005 19:23:03 -0000 1.4 *************** *** 33,37 **** #This is the main PDB class which takes care of parsing, annotations #and is the entry way to the co-ordinate data held in models ! class PDB < DB include Utils --- 33,37 ---- #This is the main PDB class which takes care of parsing, annotations #and is the entry way to the co-ordinate data held in models ! class PDB #< DB [...2079 lines suppressed...] *************** *** 1179,1186 **** end ! atom = Atom.new(serial,name,altLoc, ! x,y,z, ! occupancy,tempFactor, ! newResidue) newResidue.addAtom(atom) --- 1231,1238 ---- end ! atom = atomclass.new(serial,name,altLoc, ! x,y,z, ! occupancy,tempFactor, ! newResidue) newResidue.addAtom(atom) From ngoto at pub.open-bio.org Fri Dec 16 14:23:05 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Dec 16 14:16:08 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db pdb.rb,1.4,1.5 Message-ID: <200512161923.jBGJN5VL014382@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv14367 Modified Files: pdb.rb Log Message: grave changes It does not work correctly now. Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pdb.rb 8 Mar 2004 07:32:35 -0000 1.4 --- pdb.rb 16 Dec 2005 19:23:03 -0000 1.5 *************** *** 25,29 **** # definition of the PDB class module Bio ! class PDB < DB end #class PDB end #module Bio --- 25,29 ---- # definition of the PDB class module Bio ! class PDB #< DB end #class PDB end #module Bio From ngoto at pub.open-bio.org Sun Dec 18 10:09:48 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 10:03:06 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb atom.rb, 1.3, 1.4 pdb.rb, 1.4, 1.5 residue.rb, 1.2, 1.3 Message-ID: <200512181509.jBIF9mVL028188@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory pub.open-bio.org:/tmp/cvs-serv28178 Modified Files: atom.rb pdb.rb residue.rb Log Message: more changes (does not correctly work now!) Index: atom.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/atom.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** atom.rb 16 Dec 2005 19:23:02 -0000 1.3 --- atom.rb 18 Dec 2005 15:09:46 -0000 1.4 *************** *** 93,99 **** end ! def record_type 'ATOM' end end #class Atom --- 93,102 ---- end ! def record_name 'ATOM' end + def record_type + record_name + end end #class Atom *************** *** 102,106 **** # Since HetAtm inherits Atom class, please refer Atom class for usage. class HetAtm < Atom ! def record_type 'HETATM' end --- 105,109 ---- # Since HetAtm inherits Atom class, please refer Atom class for usage. class HetAtm < Atom ! def record_name 'HETATM' end Index: residue.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/residue.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** residue.rb 26 Sep 2005 13:00:08 -0000 1.2 --- residue.rb 18 Dec 2005 15:09:46 -0000 1.3 *************** *** 88,92 **** #Adds an atom to this residue def addAtom(atom) ! raise "Expecting Bio::PDB::Atom" if not atom.is_a? Bio::PDB::Atom @atoms.push(atom) self --- 88,92 ---- #Adds an atom to this residue def addAtom(atom) ! raise "Expecting ATOM or HETATM" unless atom.is_a? Bio::PDB::Record::ATOM @atoms.push(atom) self Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pdb.rb 16 Dec 2005 19:23:03 -0000 1.4 --- pdb.rb 18 Dec 2005 15:09:46 -0000 1.5 *************** *** 51,55 **** module Pdb_Integer def self.new(str) ! str.strip.to_i end end --- 51,55 ---- module Pdb_Integer def self.new(str) ! str.to_i end [...1773 lines suppressed...] ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, chain) chain.addResidue(newResidue) else ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, ! chain, true) chain.addLigand(newResidue) end ! atom = f ! f.residue = newResidue newResidue.addAtom(atom) cResidue = newResidue ! end end ! ! when 'MODEL' if cModel.model_serial self.addModel(cModel) From k at pub.open-bio.org Sun Dec 18 10:37:21 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:30:45 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/shell/plugin test_seq.rb, 1.2, 1.3 Message-ID: <200512181537.jBIFbLVL028322@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv28318/test/unit/bio/shell/plugin Modified Files: test_seq.rb Log Message: * fixed tests (not yet completed) Index: test_seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin/test_seq.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_seq.rb 23 Nov 2005 11:40:45 -0000 1.2 --- test_seq.rb 18 Dec 2005 15:37:19 -0000 1.3 *************** *** 35,109 **** def test_naseq str = 'ACGT' ! assert_equal(Bio::Sequence::NA, naseq(str).class) ! assert_equal(Bio::Sequence::NA.new(str), naseq(str)) ! assert_equal('acgt', naseq(str)) end def test_aaseq str = 'WD' ! assert_equal(Bio::Sequence::AA, aaseq(str).class) ! assert_equal(Bio::Sequence::AA.new('WD'), aaseq(str)) ! assert_equal('WD', aaseq(str)) ! end ! ! def test_revseq ! str = 'acgta' ! assert_equal('tacgt', revseq(str)) ! end ! ! def test_translate ! str = 'ATGATG' ! assert_equal(Bio::Sequence::AA.new('MM'), translate(str)) end ! def test_seq_report_na ! str = 'ACGT' ! output = '' ! assert_equal(output, seq_report(str)) ! end ! def test_seq_report_aa ! str = 'WD' ! output = '' ! assert_equal(output, seq_report(str)) ! end ! def test_na_report ! naseq = 'ACGT' ! output =<1, \"c\"=>1, \"g\"=>1, \"t\"=>1} ! molecular weight : 1245.88148 ! complemnet weight : 1245.88148 ! protein weight : 119.12 // END ! assert_equal(output, na_report(naseq)) end ! def test_aa_report aaseq = 'WD' output =<1, \"D\"=>1} ! protein weight : 319.315 ! amino acid codes : [\"Trp\", \"Asp\"] ! amino acid names : [\"tryptophan\", \"aspartic acid\"] // END ! assert_equal(output, aa_report(aaseq)) end ! def test_double_helix seq = 'ACGTACGTACGTACGT' output = <3' sequence : atgcatgcatgc ! 3'->5' sequence : gcatgcatgcat ! Translation 1 : MHAC ! Translation 2 : CMH ! Translation 3 : ACM ! Translation -1 : ACMH ! Translation -2 : HAC ! Translation -3 : MHA ! Length : 12 bp ! GC percent : 50 % ! Composition : a - 3 ( 25.00 %) ! c - 3 ( 25.00 %) ! g - 3 ( 25.00 %) ! t - 3 ( 25.00 %) ! Codon usage : + *---------------------------------------------* + | | 2nd | | + | 1st |-------------------------------| 3rd | + | | U | C | A | G | | + |-------+-------+-------+-------+-------+-----| + | U U |F 0.0%|S 0.0%|Y 0.0%|C 0.0%| u | + | U U |F 0.0%|S 0.0%|Y 0.0%|C 25.0%| c | + | U U |L 0.0%|S 0.0%|* 0.0%|* 0.0%| a | + | UUU |L 0.0%|S 0.0%|* 0.0%|W 0.0%| g | + |-------+-------+-------+-------+-------+-----| + | CCCC |L 0.0%|P 0.0%|H 25.0%|R 0.0%| u | + | C |L 0.0%|P 0.0%|H 0.0%|R 0.0%| c | + | C |L 0.0%|P 0.0%|Q 0.0%|R 0.0%| a | + | CCCC |L 0.0%|P 0.0%|Q 0.0%|R 0.0%| g | + |-------+-------+-------+-------+-------+-----| + | A |I 0.0%|T 0.0%|N 0.0%|S 0.0%| u | + | A A |I 0.0%|T 0.0%|N 0.0%|S 0.0%| c | + | AAAAA |I 0.0%|T 0.0%|K 0.0%|R 0.0%| a | + | A A |M 25.0%|T 0.0%|K 0.0%|R 0.0%| g | + |-------+-------+-------+-------+-------+-----| + | GGGG |V 0.0%|A 0.0%|D 0.0%|G 0.0%| u | + | G |V 0.0%|A 0.0%|D 0.0%|G 0.0%| c | + | G GGG |V 0.0%|A 25.0%|E 0.0%|G 0.0%| a | + | GG G |V 0.0%|A 0.0%|E 0.0%|G 0.0%| g | + *---------------------------------------------* ! Molecular weight : 3701.61444 ! Protein weight : 460.565 // END ! assert_equal(output, seqstat(naseq)) end ! def test_aa_seqstat aaseq = 'WD' output =<C sequence : WD ! Length : 2 aa ! Composition : D Asp - 1 ( 50.00 %) aspartic acid ! W Trp - 1 ( 50.00 %) tryptophan ! Protein weight : 319.315 // END ! assert_equal(output, seqstat(aaseq)) end ! def test_doublehelix seq = 'ACGTACGTACGTACGT' output = < Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv28562/lib/bio/shell/plugin Modified Files: keggapi.rb Log Message: * added some notes Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** keggapi.rb 30 Nov 2005 02:01:04 -0000 1.7 --- keggapi.rb 18 Dec 2005 15:47:33 -0000 1.8 *************** *** 119,122 **** --- 119,142 ---- =begin + + == BioRuby extensions + + --- get_all_best_best_neighbors_by_gene(genes_id) + --- get_all_best_neighbors_by_gene(genes_id) + --- get_all_reverse_best_neighbors_by_gene(genes_id) + --- get_all_paralogs_by_gene(genes_id) + --- get_all_genes_by_motifs(motif_id_list) + --- get_all_oc_members_by_gene(genes_id) + --- get_all_pc_members_by_gene(genes_id) + --- get_all_genes_by_organism(org) + --- get_all_linkdb_by_entry(entry_id, db) + --- save_image(url, filename = nil) + --- get_entries(ary = []) + --- get_aaseqs(ary = []) + --- get_naseqs(ary = []) + --- get_definitions(ary = []) + + == Original KEGG API methods + --- get_linkdb_by_entry(entry_id, db, start, max_results) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) *************** *** 164,166 **** --- 184,187 ---- --- get_number_of_genes_by_organism(org) --- convert_mol_to_kcf(mol_text) + =end From k at pub.open-bio.org Sun Dec 18 10:50:08 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:43:04 2005 Subject: [BioRuby-cvs] bioruby/lib/bio location.rb,0.21,0.22 Message-ID: <200512181550.jBIFo8VL028682@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv28673/lib/bio Modified Files: location.rb Log Message: * minor change (error message format) Index: location.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v retrieving revision 0.21 retrieving revision 0.22 diff -C2 -d -r0.21 -r0.22 *** location.rb 30 Oct 2005 22:59:56 -0000 0.21 --- location.rb 18 Dec 2005 15:50:06 -0000 0.22 *************** *** 280,284 **** e = $2.to_i if e - s < 0 ! # raise "[Error] invalid range : #{location}" $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG end --- 280,284 ---- e = $2.to_i if e - s < 0 ! # raise "Error: invalid range : #{location}" $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG end *************** *** 287,291 **** e = $2.to_i if e - s != 1 ! # raise "[Error] invalid range : #{location}" $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG end --- 287,291 ---- e = $2.to_i if e - s != 1 ! # raise "Error: invalid range : #{location}" $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG end *************** *** 296,300 **** ; else ! raise "[Error] unknown location format : #{location}" end --- 296,300 ---- ; else ! raise "Error: unknown location format : #{location}" end From k at pub.open-bio.org Sun Dec 18 10:58:42 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:55:25 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/mafft report.rb,1.7,1.8 Message-ID: <200512181558.jBIFwgVL028868@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/mafft In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/mafft Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 1 Nov 2005 05:32:24 -0000 1.7 --- report.rb 18 Dec 2005 15:58:40 -0000 1.8 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 10:58:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:55:37 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/sosui report.rb,1.8,1.9 Message-ID: <200512181558.jBIFwhVL028882@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/sosui In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/sosui Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sosui/report.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** report.rb 31 Oct 2005 17:01:50 -0000 1.8 --- report.rb 18 Dec 2005 15:58:41 -0000 1.9 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # Licence:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Dec 18 10:58:44 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:56:18 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fetch.rb, 1.3, 1.4 registry.rb, 1.15, 1.16 Message-ID: <200512181558.jBIFwiVL028905@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv28824/io Modified Files: fetch.rb registry.rb Log Message: * s/Licence/License/ Index: registry.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/registry.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** registry.rb 27 Nov 2005 19:55:39 -0000 1.15 --- registry.rb 18 Dec 2005 15:58:42 -0000 1.16 *************** *** 4,8 **** # Copyright:: Copyright (C) 2002, 2003, 2004, 2005 # Toshiaki Katayama ! # Licence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2002, 2003, 2004, 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ Index: fetch.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fetch.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fetch.rb 28 Nov 2005 02:02:38 -0000 1.3 --- fetch.rb 18 Dec 2005 15:58:42 -0000 1.4 *************** *** 4,8 **** # Copyright:: Copyright (C) 2002, 2005 # Toshiaki Katayama ! # Licence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2002, 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Dec 18 10:58:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:56:50 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/targetp report.rb,1.6,1.7 Message-ID: <200512181558.jBIFwhVL028890@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/targetp In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/targetp Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/targetp/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 31 Oct 2005 18:00:16 -0000 1.6 --- report.rb 18 Dec 2005 15:58:41 -0000 1.7 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # Licence:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Dec 18 10:58:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:56:51 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/sim4 report.rb,1.6,1.7 Message-ID: <200512181558.jBIFwhVL028878@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/sim4 In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/sim4 Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 1 Nov 2005 05:32:23 -0000 1.6 --- report.rb 18 Dec 2005 15:58:40 -0000 1.7 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 10:58:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:56:52 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/spidey report.rb,1.7,1.8 Message-ID: <200512181558.jBIFwhVL028886@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/spidey In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/spidey Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/spidey/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 1 Nov 2005 05:32:24 -0000 1.7 --- report.rb 18 Dec 2005 15:58:41 -0000 1.8 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 10:58:41 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 10:56:53 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast wublast.rb,1.4,1.5 Message-ID: <200512181559.jBIFwfVL028853@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/blast Modified Files: wublast.rb Log Message: * s/Licence/License/ Index: wublast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/wublast.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wublast.rb 1 Nov 2005 05:32:23 -0000 1.4 --- wublast.rb 18 Dec 2005 15:58:39 -0000 1.5 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 11:28:48 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:21:37 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/shell/plugin test_seq.rb, 1.3, 1.4 Message-ID: <200512181628.jBIGSmVL029196@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv29192/test/unit/bio/shell/plugin Modified Files: test_seq.rb Log Message: * changed to use require 'bioruby' instead of require 'bio/shell'; include Bio::Shell Index: test_seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin/test_seq.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_seq.rb 18 Dec 2005 15:37:19 -0000 1.3 --- test_seq.rb 18 Dec 2005 16:28:46 -0000 1.4 *************** *** 26,35 **** require 'test/unit' ! require 'bio/shell' module Bio class TestShellPluginSeq < Test::Unit::TestCase - include Bio::Shell def test_naseq --- 26,36 ---- require 'test/unit' ! require 'bioruby' module Bio class TestShellPluginSeq < Test::Unit::TestCase + # include Bio::Shell + # Bio::Shell.instance_variable_set :@config, {} def test_naseq From nakao at pub.open-bio.org Sun Dec 18 11:50:23 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 11:43:13 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl test_fasta.rb,NONE,1.1 Message-ID: <200512181650.jBIGoNVL029315@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv29305/test/unit/bio/appl Added Files: test_fasta.rb Log Message: * Newly added. --- NEW FILE: test_fasta.rb --- # # test/unit/bio/appl/test_fasta.rb - Unit test for Bio::Fasta # # Copyright (C) 2005 Mitsuteru Nakao # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_fasta.rb,v 1.1 2005/12/18 16:50:20 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib'))).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/appl/fasta' module Bio class TestFastaInitialize < Test::Unit::TestCase def test_new_1 program = 'string' db = 'string' option = ['-e', '0.001'] server = 'local' assert_raise(ArgumentError) { Bio::Fasta.new() } assert_raise(ArgumentError) { Bio::Fasta.new(program) } assert(Bio::Fasta.new(program, db)) assert(Bio::Fasta.new(program, db, option)) assert(Bio::Fasta.new(program, db, option, server)) assert_raise(ArgumentError) { Bio::Fasta.new(program, db, option, server, nil) } end def test_option_backward_compatibility fasta = Bio::Fasta.new('program', 'db', "-e 10") assert_equal([ '-Q', '-H', '-m','10', '-e', '10'], fasta.options) end def test_option fasta = Bio::Fasta.new('program', 'db', ["-e", "10"]) assert_equal([ '-Q', '-H', '-m','10', '-e', '10'], fasta.options) end end class TestFasta < Test::Unit::TestCase def setup program = 'ssearch' db = 'nr' option = ['-e', '10'] @obj = Bio::Fasta.new(program, db, option) end def test_program assert_equal('ssearch', @obj.program) @obj.program = 'lalign' assert_equal('lalign', @obj.program) end def test_db assert_equal('nr', @obj.db) @obj.db = 'refseq' assert_equal('refseq', @obj.db) end def test_options assert_equal(["-Q", "-H", "-m", "10", "-e", "10"], @obj.options) @obj.options = ['-Q', '-H', '-m', '8'] assert_equal(['-Q', '-H', '-m', '8'], @obj.options) end def test_server assert_equal('local', @obj.server) @obj.server = 'genomenet' assert_equal('genomenet', @obj.server) end def test_ktup assert_equal(nil, @obj.ktup) @obj.ktup = 6 assert_equal(6, @obj.ktup) end def test_matrix assert_equal(nil, @obj.matrix) @obj.matrix = 'PAM120' assert_equal('PAM120', @obj.matrix) end def test_output assert_equal('', @obj.output) # assert_raise(NoMethodError) { @obj.output = "" } end def test_option option = ['-M'].to_s assert(@obj.option = option) assert_equal(option, @obj.option) end def test_format assert_equal(10, @obj.format) end def test_format_arg_str assert(@obj.format = '1') assert_equal(1, @obj.format) end def test_format_arg_integer assert(@obj.format = 2) assert_equal(2, @obj.format) end end class TestFastaQuery < Test::Unit::TestCase def test_self_parser end def test_self_local # test/functional/bio/test_fasta.rb end def test_self_remote # test/functional/bio/test_fasta.rb end def test_query end end end From k at pub.open-bio.org Sun Dec 18 11:50:58 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:43:49 2005 Subject: [BioRuby-cvs] bioruby/lib/bio pathway.rb,1.33,1.34 Message-ID: <200512181650.jBIGowVL029335@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv29285/lib/bio Modified Files: pathway.rb Log Message: * rolled back to the previous version until bugs caused by the specification change are fixed Index: pathway.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/pathway.rb,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** pathway.rb 4 Nov 2005 17:39:44 -0000 1.33 --- pathway.rb 18 Dec 2005 16:50:56 -0000 1.34 *************** *** 1,21 **** # ! # = bio/pathway.rb - Binary relations and Graph algorithms ! # ! # Copyright:: Copyright (c) 2001, 2005 ! # Toshiaki Katayama , ! # Shuichi Kawashima , ! # Nobuya Tanaka ! # License:: LGPL ! # ! # $Id$ [...1506 lines suppressed...] + + --- Bio::Relation#eql?(rel) + --- Bio::Relation#hash + + Method eql? is an alias of the === method and is used with hash method + to make uniq arry of the Bio::Relation objects. + + a1 = Bio::Relation.new('a', 'b', 1) + a2 = Bio::Relation.new('b', 'a', 1) + a3 = Bio::Relation.new('b', 'c', 1) + p [ a1, a2, a3 ].uniq + + --- Bio::Relation#<=>(rel) + + Used by the each method to compare with another Bio::Relation object. + This method is only usable when the edge objects have the property of + the module Comparable. + + =end + From k at pub.open-bio.org Sun Dec 18 11:50:58 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:43:52 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_pathway.rb,1.2,1.3 Message-ID: <200512181650.jBIGowVL029339@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv29285/test/unit/bio Modified Files: test_pathway.rb Log Message: * rolled back to the previous version until bugs caused by the specification change are fixed Index: test_pathway.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_pathway.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_pathway.rb 24 Sep 2005 03:12:55 -0000 1.2 --- test_pathway.rb 18 Dec 2005 16:50:56 -0000 1.3 *************** *** 1,4 **** # ! # test/unit/bio/tc_pathway.rb - Unit test for Bio::Pathway # # Copyright (C) 2004 Moses Hohman --- 1,4 ---- # ! # test/bio/tc_pathway.rb - Unit test for Bio::Pathway # # Copyright (C) 2004 Moses Hohman *************** *** 22,26 **** require 'pathname' ! libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) --- 22,26 ---- require 'pathname' ! libpath = Pathname.new(File.join(File.dirname(__FILE__), [".."]*2, "lib")).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) *************** *** 29,483 **** class Float ! NaN = 0/0.0 ! Infinity = 1/0.0 end class Array ! def sum ! inject { | sum, val | sum += val } ! end end module Bio ! class Pathway ! # bug in subgraph: does not include nodes w/o edges ! def subgraph(list = nil) ! if list ! @label.clear ! list.each { |node| @label[node] = true } ! end ! sub_graph = Pathway.new([], @undirected) ! @graph.each do |from, hash| ! next unless @label[from] ! sub_graph.graph[from] = {} ! hash.each do |to, relation| ! next unless @label[to] ! sub_graph.graph[from][to] = relation ! end ! end ! sub_graph ! end ! # bug in cliquishness: subgraph of neighbors does not include nodes w/o edges ! def subgraph_adjacency_matrix(nodes) ! adjacency_matrix = to_matrix(0).to_a ! node_indices = nodes.collect { |x| @index[x] } ! subgraph = adjacency_matrix.values_at(*(node_indices)) ! subgraph.collect! { |row| row.values_at(*(node_indices)) } ! end ! # bug in cliquishness: subgraph of neighbors does not include nodes w/o edges ! # Throws exception if graph is directed ! def cliquishness(node) ! raise "Cannot calculate cliquishness in directed graph" if not undirected? ! neighbors = @graph[node].keys ! return Float::NaN if neighbors.size==0 ! return 1 if neighbors.size==1 ! # divide by two to avoid double-counting ! num_neighbor_edges = subgraph_adjacency_matrix(neighbors).flatten.sum/2 ! num_complete_edges = neighbors.size*(neighbors.size-1)/2 ! num_neighbor_edges.to_f / num_complete_edges.to_f end - end ! class TestMyGraph < Test::Unit::TestCase ! def test_cliquishness ! graph = Pathway.new([ ! Relation.new(1, 3, 1), ! Relation.new(2, 3, 1), ! Relation.new(1, 5, 1), ! Relation.new(2, 6, 1), ! Relation.new(3, 6, 1), ! Relation.new(4, 6, 1), ! Relation.new(5, 6, 1), ! ], true) ! assert_equal(0, graph.cliquishness(1), "1's cliquishness wrong") ! assert_equal(1, graph.cliquishness(2), "2's cliquishness wrong") ! assert_in_delta(0.33, graph.cliquishness(3), 0.01, "3's cliquishness wrong") ! assert_equal(1, graph.cliquishness(4), "4's cliquishness wrong") ! assert_equal(0, graph.cliquishness(5), "5's cliquishness wrong") ! assert_in_delta(0.16, graph.cliquishness(6), 0.01, "6's cliquishness wrong") end - end ! class TestRelation < Test::Unit::TestCase ! def test_comparison_operator ! r1 = Relation.new('a', 'b', 1) ! r2 = Relation.new('b', 'a', 1) ! r3 = Relation.new('b', 'a', 2) ! r4 = Relation.new('a', 'b', 1) ! assert(r1 === r2, "r1 === r2 not true, === not symmetric wrt nodes") ! assert(!(r1 === r3), "r1 === r3 not false, === does not take edge into account") ! assert(r1 === r4, "r1 === r4 not true, === is not reflexive wrt nodes") ! assert_equal([r1, r3], [ r1, r2, r3, r4 ].uniq, "uniq did not have expected effect") ! assert(r1.eql?(r2), "r1 not eql r2") ! assert(!r3.eql?(r2), "r3 eql to r2") end - end ! class TestSampleGraph < Test::Unit::TestCase ! ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def setup ! @data = [ ! [ 'q', 's', 1, ], ! [ 'q', 't', 1, ], ! [ 'q', 'w', 1, ], ! [ 'r', 'u', 1, ], ! [ 'r', 'y', 1, ], ! [ 's', 'v', 1, ], ! [ 't', 'x', 1, ], ! [ 't', 'y', 1, ], ! [ 'u', 'y', 1, ], ! [ 'v', 'w', 1, ], ! [ 'w', 's', 1, ], ! [ 'x', 'z', 1, ], ! [ 'y', 'q', 1, ], ! [ 'z', 'x', 1, ], ! ] ! @graph = Pathway.new(@data.collect { |x| Relation.new(*x) }) ! end ! def test_to_matrix ! assert_equal(Matrix[ ! [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], ! [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], ! [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], ! [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], ! [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], ! [0, 1, 0, 0, 0, 0, 0, 1, 1, 0], ! [0, 0, 0, 1, 0, 0, 0, 0, 0, 1], ! [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], ! [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], ! [0, 0, 0, 1, 0, 0, 0, 0, 0, 0] ! ], @graph.to_matrix(0), "matrix wrong") ! assert_equal({"v"=>0,"w"=>1,"x"=>2,"y"=>3,"z"=>4,"q"=>5,"r"=>6,"s"=>7,"t"=>8,"u"=>9}, @graph.index, "node --> matrix index order wrong") ! end ! def test_dump_matrix ! dumped = "[" + ! "# v, w, x, y, z, q, r, s, t, u\n" + ! " [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],\n" + # v ! " [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],\n" + # w ! " [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],\n" + # x ! " [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],\n" + # y ! " [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],\n" + # z ! " [0, 1, 0, 0, 0, 0, 0, 1, 1, 0],\n" + # q ! " [0, 0, 0, 1, 0, 0, 0, 0, 0, 1],\n" + # r ! " [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n" + # s ! " [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],\n" + # t ! " [0, 0, 0, 1, 0, 0, 0, 0, 0, 0]\n]" # u ! assert_equal(dumped, @graph.dump_matrix(0)) ! end ! def test_dump_list ! dumped = "v => w (1)\n" + ! "w => s (1)\n" + ! "x => z (1)\n" + ! "y => q (1)\n" + ! "z => x (1)\n" + ! "q => w (1), s (1), t (1)\n" + ! "r => y (1), u (1)\n" + ! "s => v (1)\n" + ! "t => x (1), y (1)\n" + ! "u => y (1)\n" ! assert_equal(dumped, @graph.dump_list) ! end ! def test_extract_subgraph_by_label ! hash = { 'q' => "L1", 's' => "L2", 'v' => "L3", 'w' => "L4" } ! @graph.label = hash ! dumped = "v => w (1)\n" + ! "w => s (1)\n" + ! "q => w (1), s (1)\n" + ! "s => v (1)\n" ! assert_equal(dumped, @graph.subgraph.dump_list) ! end ! def test_extract_subgraph_by_list ! dumped = "x => z (1)\n" + ! "y => q (1)\n" + ! "z => x (1)\n" + ! "q => t (1)\n" + ! "t => x (1), y (1)\n" ! assert_equal(dumped, @graph.subgraph(['q', 't', 'x', 'y', 'z']).dump_list) ! end ! def test_extract_subgraph_retains_disconnected_nodes ! assert_equal(4, @graph.subgraph(['r', 's', 'v', 'w']).nodes, "wrong number of nodes") ! end ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def test_cliquishness_raises_exception_for_directed_graph ! assert_raises (RuntimeError) { @graph.cliquishness('q') } ! end ! def test_undirected_cliquishness ! @graph.undirected ! assert_in_delta(0.33, @graph.cliquishness('q'), 0.01) ! end ! def test_small_world_aka_node_degree_histogram ! expected = {1=>7, 2=>2, 3=>1} ! expected.default = 0 ! assert_equal(expected, @graph.small_world) ! end ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def test_breadth_first_search ! distances, predecessors = @graph.breadth_first_search('q') ! assert_equal({ ! "v"=>2, ! "w"=>1, ! "x"=>2, ! "y"=>2, ! "z"=>3, ! "q"=>0, ! "s"=>1, ! "t"=>1}, distances, "distances wrong") ! assert_equal({ ! "v"=>"s", ! "w"=>"q", ! "x"=>"t", ! "y"=>"t", ! "z"=>"x", ! "q"=>nil, ! "s"=>"q", ! "t"=>"q"}, predecessors, "predecessors wrong") ! end ! def test_bfs_shortest_path ! step, path = @graph.bfs_shortest_path('y', 'w') ! assert_equal(2, step, "wrong # of steps") ! assert_equal(["y", "q", "w"], path, "wrong path") ! end ! def test_depth_first_search ! timestamp, tree, back, cross, forward = @graph.depth_first_search ! assert_equal({ ! "v"=>[1, 6], ! "w"=>[2, 5], ! "x"=>[7, 10], ! "y"=>[11, 16], ! "z"=>[8, 9], ! "q"=>[12, 15], ! "r"=>[17, 20], ! "s"=>[3, 4], ! "t"=>[13, 14], ! "u"=>[18, 19]}, timestamp, "timestamps wrong") ! assert_equal({ ! "w"=>"v", ! "z"=>"x", ! "q"=>"y", ! "s"=>"w", ! "t"=>"q", ! "u"=>"r"}, tree, "tree edges wrong") ! assert_equal({ ! "z"=>"x", ! "s"=>"v", ! "t"=>"y"}, back, "back edges wrong") ! assert_equal({ ! "q"=>"s", ! "r"=>"y", ! "t"=>"x", ! "u"=>"y"}, cross, "cross edges wrong") ! assert_equal({}, forward, "forward edges wrong") ! end ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def test_dijkstra ! distances, predecessors = @graph.dijkstra('q') ! assert_equal({ ! "v"=>2, ! "w"=>1, ! "x"=>2, ! "y"=>2, ! "z"=>3, ! "q"=>0, ! "r"=>Float::Infinity, ! "s"=>1, ! "t"=>1, ! "u"=>Float::Infinity}, distances, "distances wrong") ! assert_equal({ ! "v"=>"s", ! "w"=>"q", ! "x"=>"t", ! "y"=>"t", ! "z"=>"x", ! "q"=>nil, ! "r"=>nil, ! "s"=>"q", ! "t"=>"q", ! "u"=>nil}, predecessors, "predecessors wrong") ! end ! def test_bellman_ford ! distances, predecessors = @graph.bellman_ford('q') ! assert_equal({ ! "v"=>2, ! "w"=>1, ! "x"=>2, ! "y"=>2, ! "z"=>3, ! "q"=>0, ! "r"=>Float::Infinity, ! "s"=>1, ! "t"=>1, ! "u"=>Float::Infinity}, distances, "distances wrong") ! assert_equal({ ! "v"=>"s", ! "w"=>"q", ! "x"=>"t", ! "y"=>"t", ! "z"=>"x", ! "q"=>nil, ! "r"=>nil, ! "s"=>"q", ! "t"=>"q", ! "u"=>nil}, predecessors, "predecessors wrong") end - end ! class TestTopologicalSort < Test::Unit::TestCase ! # ! # Professor Bumstead topologically sorts his clothing when getting dressed. ! # ! # "undershorts" "socks" ! # | | | ! # v | v "watch" ! # "pants" --+-------> "shoes" ! # | ! # v ! # "belt" <----- "shirt" ----> "tie" ----> "jacket" ! # | ^ ! # `---------------------------------------' ! # ! def test_dfs_topological_sort ! dag = Pathway.new([ ! Relation.new("undershorts", "pants", true), ! Relation.new("undershorts", "shoes", true), ! Relation.new("socks", "shoes", true), ! Relation.new("watch", "watch", true), ! Relation.new("pants", "belt", true), ! Relation.new("pants", "shoes", true), ! Relation.new("shirt", "belt", true), ! Relation.new("shirt", "tie", true), ! Relation.new("tie", "jacket", true), ! Relation.new("belt", "jacket", true), ! ]) ! sorted = dag.dfs_topological_sort ! assert(sorted.index("socks") < sorted.index("shoes"), "socks >= shoes") ! assert(sorted.index("undershorts") < sorted.index("pants"), "undershorts >= pants") ! assert(sorted.index("undershorts") < sorted.index("shoes"), "undershorts >= shoes") ! assert(sorted.index("pants") < sorted.index("shoes"), "pants >= shoes") ! assert(sorted.index("pants") < sorted.index("belt"), "pants >= belt") ! assert(sorted.index("shirt") < sorted.index("belt"), "shirt >= belt") ! assert(sorted.index("shirt") < sorted.index("tie"), "shirt >= tie") ! assert(sorted.index("belt") < sorted.index("jacket"), "belt >= jacket") ! assert(sorted.index("tie") < sorted.index("jacket"), "tie >= jacket") end - end ! #TODO: verify the below ! class TestWeightedGraph < Test::Unit::TestCase ! # 'a' --> 'b' ! # | 1 | 3 ! # |5 v ! # `----> 'c' ! def setup ! r1 = Relation.new('a', 'b', 1) ! r2 = Relation.new('a', 'c', 5) ! r3 = Relation.new('b', 'c', 3) ! @w_graph = Pathway.new([r1, r2, r3]) ! end ! def test_dijkstra_on_weighted_graph ! distances, predecessors = @w_graph.dijkstra('a') ! assert_equal({ ! "a"=>0, ! "b"=>1, ! "c"=>4}, distances, "distances wrong") ! assert_equal({ ! "a"=>nil, ! "b"=>"a", ! "c"=>"b"}, predecessors, "predecessors wrong") ! end ! def test_bellman_ford_on_negative_weighted_graph ! ! # ,-- 'a' --> 'b' ! # | | 1 | 3 ! # | |5 v ! # | `----> 'c' ! # | ^ ! # |2 | -5 ! # `--> 'd' ----' ! ! r4 = Relation.new('a', 'd', 2) ! r5 = Relation.new('d', 'c', -5) ! @w_graph.append(r4) ! @w_graph.append(r5) ! distances, predecessors = @w_graph.bellman_ford('a') ! assert_equal({ ! "a"=>0, ! "b"=>1, ! "c"=>-3, ! "d"=>2}, distances, "distances wrong") ! assert_equal({ ! "a"=>nil, ! "b"=>"a", ! "c"=>"d", ! "d"=>"a"}, predecessors, "predecessors wrong") end - end end --- 29,485 ---- class Float ! NaN = 0/0.0 ! Infinity = 1/0.0 end class Array ! def sum ! inject { | sum, val | sum += val } ! end end module Bio ! class Pathway ! # bug in subgraph: does not include nodes w/o edges ! def subgraph(list = nil) ! if list ! @label.clear ! list.each { |node| @label[node] = true } ! end ! sub_graph = Pathway.new([], @undirected) ! @graph.each do |from, hash| ! next unless @label[from] ! sub_graph.graph[from] = {} ! hash.each do |to, relation| ! next unless @label[to] ! sub_graph.graph[from][to] = relation ! end ! end ! sub_graph ! end ! # bug in cliquishness: subgraph of neighbors does not include nodes w/o edges ! def subgraph_adjacency_matrix(nodes) ! adjacency_matrix = to_matrix(0).to_a ! node_indices = nodes.collect { |x| @index[x] } ! subgraph = adjacency_matrix.values_at(*(node_indices)) ! subgraph.collect! { |row| row.values_at(*(node_indices)) } ! end ! # bug in cliquishness: subgraph of neighbors does not include nodes w/o edges ! # Throws exception if graph is directed ! def cliquishness(node) ! raise "Cannot calculate cliquishness in directed graph" if not undirected? ! neighbors = @graph[node].keys ! return Float::NaN if neighbors.size==0 ! return 1 if neighbors.size==1 ! # divide by two to avoid double-counting ! num_neighbor_edges = subgraph_adjacency_matrix(neighbors).flatten.sum/2 ! num_complete_edges = neighbors.size*(neighbors.size-1)/2 ! num_neighbor_edges.to_f / num_complete_edges.to_f ! end end ! class TestMyGraph < Test::Unit::TestCase ! def test_cliquishness ! graph = Pathway.new([ ! Relation.new(1, 3, 1), ! Relation.new(2, 3, 1), ! Relation.new(1, 5, 1), ! Relation.new(2, 6, 1), ! Relation.new(3, 6, 1), ! Relation.new(4, 6, 1), ! Relation.new(5, 6, 1), ! ], true) ! assert_equal(0, graph.cliquishness(1), "1's cliquishness wrong") ! assert_equal(1, graph.cliquishness(2), "2's cliquishness wrong") ! assert_in_delta(0.33, graph.cliquishness(3), 0.01, "3's cliquishness wrong") ! assert_equal(1, graph.cliquishness(4), "4's cliquishness wrong") ! assert_equal(0, graph.cliquishness(5), "5's cliquishness wrong") ! assert_in_delta(0.16, graph.cliquishness(6), 0.01, "6's cliquishness wrong") ! end end ! class TestRelation < Test::Unit::TestCase ! def test_comparison_operator ! r1 = Relation.new('a', 'b', 1) ! r2 = Relation.new('b', 'a', 1) ! r3 = Relation.new('b', 'a', 2) ! r4 = Relation.new('a', 'b', 1) ! assert(r1 === r2, "r1 === r2 not true, === not symmetric wrt nodes") ! assert(!(r1 === r3), "r1 === r3 not false, === does not take edge into account") ! assert(r1 === r4, "r1 === r4 not true, === is not reflexive wrt nodes") ! assert_equal([r1, r3], [ r1, r2, r3, r4 ].uniq, "uniq did not have expected effect") ! assert(r1.eql?(r2), "r1 not eql r2") ! assert(!r3.eql?(r2), "r3 eql to r2") ! end end ! class TestSampleGraph < Test::Unit::TestCase ! ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def setup ! @data = [ ! [ 'q', 's', 1, ], ! [ 'q', 't', 1, ], ! [ 'q', 'w', 1, ], ! [ 'r', 'u', 1, ], ! [ 'r', 'y', 1, ], ! [ 's', 'v', 1, ], ! [ 't', 'x', 1, ], ! [ 't', 'y', 1, ], ! [ 'u', 'y', 1, ], ! [ 'v', 'w', 1, ], ! [ 'w', 's', 1, ], ! [ 'x', 'z', 1, ], ! [ 'y', 'q', 1, ], ! [ 'z', 'x', 1, ], ! ] ! @graph = Pathway.new(@data.collect { |x| Relation.new(*x) }) ! end ! def test_to_matrix ! assert_equal(Matrix[ ! [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], ! [0, 0, 0, 0, 0, 0, 0, 1, 0, 0], ! [0, 0, 0, 0, 1, 0, 0, 0, 0, 0], ! [0, 0, 0, 0, 0, 1, 0, 0, 0, 0], ! [0, 0, 1, 0, 0, 0, 0, 0, 0, 0], ! [0, 1, 0, 0, 0, 0, 0, 1, 1, 0], ! [0, 0, 0, 1, 0, 0, 0, 0, 0, 1], ! [1, 0, 0, 0, 0, 0, 0, 0, 0, 0], ! [0, 0, 1, 1, 0, 0, 0, 0, 0, 0], ! [0, 0, 0, 1, 0, 0, 0, 0, 0, 0] ! ], @graph.to_matrix(0), "matrix wrong") ! assert_equal({"v"=>0,"w"=>1,"x"=>2,"y"=>3,"z"=>4,"q"=>5,"r"=>6,"s"=>7,"t"=>8,"u"=>9}, @graph.index, "node --> matrix index order wrong") ! end ! def test_dump_matrix ! dumped = "[" + ! "# v, w, x, y, z, q, r, s, t, u\n" + ! " [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],\n" + # v ! " [0, 0, 0, 0, 0, 0, 0, 1, 0, 0],\n" + # w ! " [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],\n" + # x ! " [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],\n" + # y ! " [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],\n" + # z ! " [0, 1, 0, 0, 0, 0, 0, 1, 1, 0],\n" + # q ! " [0, 0, 0, 1, 0, 0, 0, 0, 0, 1],\n" + # r ! " [1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n" + # s ! " [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],\n" + # t ! " [0, 0, 0, 1, 0, 0, 0, 0, 0, 0]\n]" # u ! assert_equal(dumped, @graph.dump_matrix(0)) ! end ! def test_dump_list ! dumped = "v => w (1)\n" + ! "w => s (1)\n" + ! "x => z (1)\n" + ! "y => q (1)\n" + ! "z => x (1)\n" + ! "q => w (1), s (1), t (1)\n" + ! "r => y (1), u (1)\n" + ! "s => v (1)\n" + ! "t => x (1), y (1)\n" + ! "u => y (1)\n" ! assert_equal(dumped, @graph.dump_list) ! end ! def test_extract_subgraph_by_label ! hash = { 'q' => "L1", 's' => "L2", 'v' => "L3", 'w' => "L4" } ! @graph.label = hash ! dumped = ! "v => w (1)\n" + ! "w => s (1)\n" + ! "q => w (1), s (1)\n" + ! "s => v (1)\n" ! assert_equal(dumped, @graph.subgraph.dump_list) ! end ! def test_extract_subgraph_by_list ! dumped = ! "x => z (1)\n" + ! "y => q (1)\n" + ! "z => x (1)\n" + ! "q => t (1)\n" + ! "t => x (1), y (1)\n" ! assert_equal(dumped, @graph.subgraph(['q', 't', 'x', 'y', 'z']).dump_list) ! end ! def test_extract_subgraph_retains_disconnected_nodes ! assert_equal(4, @graph.subgraph(['r', 's', 'v', 'w']).nodes, "wrong number of nodes") ! end ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def test_cliquishness_raises_exception_for_directed_graph ! assert_raises (RuntimeError) { @graph.cliquishness('q') } ! end ! def test_undirected_cliquishness ! @graph.undirected ! assert_in_delta(0.33, @graph.cliquishness('q'), 0.01) ! end ! def test_small_world_aka_node_degree_histogram ! expected = {1=>7, 2=>2, 3=>1} ! expected.default = 0 ! assert_equal(expected, @graph.small_world) ! end ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def test_breadth_first_search ! distances, predecessors = @graph.breadth_first_search('q') ! assert_equal({ ! "v"=>2, ! "w"=>1, ! "x"=>2, ! "y"=>2, ! "z"=>3, ! "q"=>0, ! "s"=>1, ! "t"=>1}, distances, "distances wrong") ! assert_equal({ ! "v"=>"s", ! "w"=>"q", ! "x"=>"t", ! "y"=>"t", ! "z"=>"x", ! "q"=>nil, ! "s"=>"q", ! "t"=>"q"}, predecessors, "predecessors wrong") ! end ! def test_bfs_shortest_path ! step, path = @graph.bfs_shortest_path('y', 'w') ! assert_equal(2, step, "wrong # of steps") ! assert_equal(["y", "q", "w"], path, "wrong path") ! end ! def test_depth_first_search ! timestamp, tree, back, cross, forward = @graph.depth_first_search ! assert_equal({ ! "v"=>[1, 6], ! "w"=>[2, 5], ! "x"=>[7, 10], ! "y"=>[11, 16], ! "z"=>[8, 9], ! "q"=>[12, 15], ! "r"=>[17, 20], ! "s"=>[3, 4], ! "t"=>[13, 14], ! "u"=>[18, 19]}, timestamp, "timestamps wrong") ! assert_equal({ ! "w"=>"v", ! "z"=>"x", ! "q"=>"y", ! "s"=>"w", ! "t"=>"q", ! "u"=>"r"}, tree, "tree edges wrong") ! assert_equal({ ! "z"=>"x", ! "s"=>"v", ! "t"=>"y"}, back, "back edges wrong") ! assert_equal({ ! "q"=>"s", ! "r"=>"y", ! "t"=>"x", ! "u"=>"y"}, cross, "cross edges wrong") ! assert_equal({}, forward, "forward edges wrong") ! end ! # Sample Graph : ! # +----------------+ ! # | | ! # v | ! # +---------(q)-->(t)------->(y)<----(r) ! # | | | ^ | ! # v | v | | ! # +--(s)<--+ | (x)<---+ (u)<-----+ ! # | | | | | ! # v | | v | ! # (v)----->(w)<---+ (z)----+ ! def test_dijkstra ! distances, predecessors = @graph.dijkstra('q') ! assert_equal({ ! "v"=>2, ! "w"=>1, ! "x"=>2, ! "y"=>2, ! "z"=>3, ! "q"=>0, ! "r"=>Float::Infinity, ! "s"=>1, ! "t"=>1, ! "u"=>Float::Infinity}, distances, "distances wrong") ! assert_equal({ ! "v"=>"s", ! "w"=>"q", ! "x"=>"t", ! "y"=>"t", ! "z"=>"x", ! "q"=>nil, ! "r"=>nil, ! "s"=>"q", ! "t"=>"q", ! "u"=>nil}, predecessors, "predecessors wrong") ! end ! def test_bellman_ford ! distances, predecessors = @graph.bellman_ford('q') ! assert_equal({ ! "v"=>2, ! "w"=>1, ! "x"=>2, ! "y"=>2, ! "z"=>3, ! "q"=>0, ! "r"=>Float::Infinity, ! "s"=>1, ! "t"=>1, ! "u"=>Float::Infinity}, distances, "distances wrong") ! assert_equal({ ! "v"=>"s", ! "w"=>"q", ! "x"=>"t", ! "y"=>"t", ! "z"=>"x", ! "q"=>nil, ! "r"=>nil, ! "s"=>"q", ! "t"=>"q", ! "u"=>nil}, predecessors, "predecessors wrong") ! end end ! class TestTopologicalSort < Test::Unit::TestCase ! # ! # Professor Bumstead topologically sorts his clothing when getting dressed. ! # ! # "undershorts" "socks" ! # | | | ! # v | v "watch" ! # "pants" --+-------> "shoes" ! # | ! # v ! # "belt" <----- "shirt" ----> "tie" ----> "jacket" ! # | ^ ! # `---------------------------------------' ! # ! def test_dfs_topological_sort ! dag = Pathway.new([ ! Relation.new("undershorts", "pants", true), ! Relation.new("undershorts", "shoes", true), ! Relation.new("socks", "shoes", true), ! Relation.new("watch", "watch", true), ! Relation.new("pants", "belt", true), ! Relation.new("pants", "shoes", true), ! Relation.new("shirt", "belt", true), ! Relation.new("shirt", "tie", true), ! Relation.new("tie", "jacket", true), ! Relation.new("belt", "jacket", true), ! ]) ! sorted = dag.dfs_topological_sort ! assert(sorted.index("socks") < sorted.index("shoes"), "socks >= shoes") ! assert(sorted.index("undershorts") < sorted.index("pants"), "undershorts >= pants") ! assert(sorted.index("undershorts") < sorted.index("shoes"), "undershorts >= shoes") ! assert(sorted.index("pants") < sorted.index("shoes"), "pants >= shoes") ! assert(sorted.index("pants") < sorted.index("belt"), "pants >= belt") ! assert(sorted.index("shirt") < sorted.index("belt"), "shirt >= belt") ! assert(sorted.index("shirt") < sorted.index("tie"), "shirt >= tie") ! assert(sorted.index("belt") < sorted.index("jacket"), "belt >= jacket") ! assert(sorted.index("tie") < sorted.index("jacket"), "tie >= jacket") ! end end ! #TODO: verify the below ! class TestWeightedGraph < Test::Unit::TestCase ! # 'a' --> 'b' ! # | 1 | 3 ! # |5 v ! # `----> 'c' ! def setup ! r1 = Relation.new('a', 'b', 1) ! r2 = Relation.new('a', 'c', 5) ! r3 = Relation.new('b', 'c', 3) ! @w_graph = Pathway.new([r1, r2, r3]) ! end ! def test_dijkstra_on_weighted_graph ! distances, predecessors = @w_graph.dijkstra('a') ! assert_equal({ ! "a"=>0, ! "b"=>1, ! "c"=>4}, distances, "distances wrong") ! assert_equal({ ! "a"=>nil, ! "b"=>"a", ! "c"=>"b"}, predecessors, "predecessors wrong") ! end ! def test_bellman_ford_on_negative_weighted_graph ! ! # ,-- 'a' --> 'b' ! # | | 1 | 3 ! # | |5 v ! # | `----> 'c' ! # | ^ ! # |2 | -5 ! # `--> 'd' ----' ! ! r4 = Relation.new('a', 'd', 2) ! r5 = Relation.new('d', 'c', -5) ! @w_graph.append(r4) ! @w_graph.append(r5) ! distances, predecessors = @w_graph.bellman_ford('a') ! assert_equal({ ! "a"=>0, ! "b"=>1, ! "c"=>-3, ! "d"=>2}, distances, "distances wrong") ! assert_equal({ ! "a"=>nil, ! "b"=>"a", ! "c"=>"d", ! "d"=>"a"}, predecessors, "predecessors wrong") ! end end end From nakao at pub.open-bio.org Sun Dec 18 11:51:20 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 11:44:11 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io soapwsdl.rb,1.2,1.3 Message-ID: <200512181651.jBIGpKVL029377@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv29367/lib/bio/io Modified Files: soapwsdl.rb Log Message: * Added RDoc. Index: soapwsdl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/soapwsdl.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** soapwsdl.rb 23 Oct 2005 10:41:00 -0000 1.2 --- soapwsdl.rb 18 Dec 2005 16:51:18 -0000 1.3 *************** *** 1,6 **** # ! # bio/io/soapwsdl.rb - SOAP/WSDL interface class # ! # Copyright (C) 2004 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,41 ---- # ! # = bio/io/soapwsdl.rb - SOAP/WSDL interface class # ! # Copyright:: Copyright (C) 2004 ! # KATAYAMA Toshiaki ! # License:: LGPL ! # ! # $Id$ ! # ! # SOAP/WSDL ! # ! # ! # == Examples ! # ! # class API < Bio::SOAPWSDL ! # def initialize ! # @wsdl = 'http://example.com/example.wsdl' ! # @log = File.new("soap_log", 'w') ! # create_driver ! # end ! # end ! # ! # == Use HTTP proxy ! # ! # You need to set following two environmental variables ! # (case might be insensitive) as required by SOAP4R. ! # ! # --- soap_use_proxy ! # Set the value of this variable to 'on'. ! # ! # --- http_proxy ! # Set the URL of your proxy server (http://myproxy.com:8080 etc.). ! # ! # === Example ! # ! # % export soap_use_proxy=on ! # % export http_proxy=http://localhost:8080 ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 53,57 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 30,33 **** --- 65,75 ---- class SOAPWSDL + # WSDL URL + attr_reader :wsdl + + # log IO + attr_reader :log + + def initialize(wsdl = nil) @wsdl = wsdl *************** *** 35,39 **** create_driver end ! attr_reader :wsdl, :log def create_driver --- 77,81 ---- create_driver end ! def create_driver *************** *** 45,49 **** --- 87,94 ---- @driver.generate_explicit_type = true # Ruby obj <-> SOAP obj end + private :create_driver + + # Set a WSDL URL. def wsdl=(url) @wsdl = url *************** *** 51,54 **** --- 96,101 ---- end + + # Set log IO def log=(io) @log = io *************** *** 56,80 **** end def method_missing(*arg) @driver.send(*arg) end end # SOAP end # Bio - - =begin - - To use HTTP proxy, you need to set following two environmental variables - (case might be insensitive) as required by SOAP4R. - - --- soap_use_proxy - - Set the value of this variable to 'on'. - - --- http_proxy - - Set the URL of your proxy server (http://myproxy.com:8080 etc.). - - =end --- 103,114 ---- end + def method_missing(*arg) @driver.send(*arg) end + private :method_missing end # SOAP end # Bio From k at pub.open-bio.org Sun Dec 18 10:58:42 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:46:20 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blat report.rb,1.5,1.6 Message-ID: <200512181559.jBIFwgVL028857@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blat In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/blat Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blat/report.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** report.rb 1 Nov 2005 05:32:24 -0000 1.5 --- report.rb 18 Dec 2005 15:58:39 -0000 1.6 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 10:58:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:46:21 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/tmhmm report.rb,1.5,1.6 Message-ID: <200512181558.jBIFwhVL028894@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/tmhmm Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm/report.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** report.rb 6 Nov 2005 16:10:07 -0000 1.5 --- report.rb 18 Dec 2005 15:58:41 -0000 1.6 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # Licence:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Dec 18 10:58:41 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:46:21 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/bl2seq report.rb,1.5,1.6 Message-ID: <200512181559.jBIFwfVL028849@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/bl2seq Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq/report.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** report.rb 1 Nov 2005 05:32:23 -0000 1.5 --- report.rb 18 Dec 2005 15:58:39 -0000 1.6 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2005 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2005 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 10:58:42 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:46:22 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/genscan report.rb,1.7,1.8 Message-ID: <200512181558.jBIFwgVL028866@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/genscan In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/genscan Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/genscan/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 6 Nov 2005 18:24:41 -0000 1.7 --- report.rb 18 Dec 2005 15:58:40 -0000 1.8 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # Licence:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Dec 18 10:58:42 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:46:25 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/clustalw report.rb,1.8,1.9 Message-ID: <200512181558.jBIFwgVL028864@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/clustalw In directory pub.open-bio.org:/tmp/cvs-serv28824/appl/clustalw Modified Files: report.rb Log Message: * s/Licence/License/ Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw/report.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** report.rb 1 Nov 2005 05:32:23 -0000 1.8 --- report.rb 18 Dec 2005 15:58:40 -0000 1.9 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 10:58:42 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:46:27 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl clustalw.rb, 1.9, 1.10 mafft.rb, 1.8, 1.9 sim4.rb, 1.4, 1.5 Message-ID: <200512181558.jBIFwgVL028860@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv28824/appl Modified Files: clustalw.rb mafft.rb sim4.rb Log Message: * s/Licence/License/ Index: sim4.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sim4.rb 1 Nov 2005 05:32:23 -0000 1.4 --- sim4.rb 18 Dec 2005 15:58:40 -0000 1.5 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL # #-- Index: clustalw.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** clustalw.rb 1 Nov 2005 05:32:23 -0000 1.9 --- clustalw.rb 18 Dec 2005 15:58:40 -0000 1.10 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL # #-- Index: mafft.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mafft.rb 1 Nov 2005 05:32:23 -0000 1.8 --- mafft.rb 18 Dec 2005 15:58:40 -0000 1.9 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # Licence:: LGPL # #-- --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL # #-- From k at pub.open-bio.org Sun Dec 18 10:58:44 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:46:30 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db aaindex.rb, 1.15, 1.16 gff.rb, 1.4, 1.5 litdb.rb, 0.6, 0.7 nbrf.rb, 1.6, 1.7 Message-ID: <200512181558.jBIFwiVL028898@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv28824/db Modified Files: aaindex.rb gff.rb litdb.rb nbrf.rb Log Message: * s/Licence/License/ Index: litdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/litdb.rb,v retrieving revision 0.6 retrieving revision 0.7 diff -C2 -d -r0.6 -r0.7 *** litdb.rb 7 Nov 2005 14:28:12 -0000 0.6 --- litdb.rb 18 Dec 2005 15:58:41 -0000 0.7 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki ! # Licence:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki ! # License:: LGPL # # $Id$ Index: aaindex.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/aaindex.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** aaindex.rb 8 Nov 2005 02:13:44 -0000 1.15 --- aaindex.rb 18 Dec 2005 15:58:41 -0000 1.16 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001 KAWASHIMA Shuichi ! # Licence:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001 KAWASHIMA Shuichi ! # License:: LGPL # # $Id$ Index: nbrf.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/nbrf.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** nbrf.rb 1 Nov 2005 05:32:24 -0000 1.6 --- nbrf.rb 18 Dec 2005 15:58:41 -0000 1.7 *************** *** 4,8 **** # Copyright:: Copyright (C) 2001-2003 GOTO Naohisa # Copyright (C) 2001-2002 KATAYAMA Toshiaki ! # Licence:: LGPL # #-- --- 4,8 ---- # Copyright:: Copyright (C) 2001-2003 GOTO Naohisa # Copyright (C) 2001-2002 KATAYAMA Toshiaki ! # License:: LGPL # #-- Index: gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/gff.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** gff.rb 7 Nov 2005 13:19:17 -0000 1.4 --- gff.rb 18 Dec 2005 15:58:41 -0000 1.5 *************** *** 2,9 **** # = bio/db/gff.rb - GFF format class # ! # Copyright:: Copyright (C) 2003 KATAYAMA Toshiaki ! # Licence:: LGPL # ! # $Id$ # # == Description --- 2,10 ---- # = bio/db/gff.rb - GFF format class # ! # Copyright:: Copyright (C) 2003, 2005 ! # Toshiaki Katayama ! # License:: LGPL # ! # $Id$ # # == Description *************** *** 11,15 **** --- 12,19 ---- # # == Example + # + # # == References + # # * http://www.sanger.ac.uk/Software/formats/GFF/ # *************** *** 35,122 **** module Bio ! # = GFF ! class GFF ! # Returns ! attr_accessor :records ! # ! def initialize(str = '') ! @records = Array.new ! str.each_line do |line| ! @records << Record.new(line) ! end end ! # = GFF::Record ! class Record ! ! # Returns ! attr_accessor :seqname ! ! # Returns ! attr_accessor :source ! ! # Returns ! attr_accessor :feature ! ! # Returns ! attr_accessor :start ! ! # Returns ! attr_accessor :end ! ! # Returns ! attr_accessor :score ! ! # Returns ! attr_accessor :strand ! ! # Returns ! attr_accessor :frame ! ! # Returns ! attr_accessor :attributes ! # Returns ! attr_accessor :comments ! # ! def initialize(str) ! @comments = str.chomp[/#.*/] ! return if /^#/.match(str) ! @seqname, @source, @feature, @start, @end, @score, @strand, @frame, ! attributes, = str.chomp.split("\t") ! @attributes = parse_attributes(attributes) if attributes ! end ! private ! def parse_attributes(attributes) ! hash = Hash.new ! attributes.split(/[^\\];/).each do |atr| ! key, value = atr.split(' ', 2) ! hash[key] = value ! end ! return hash end end end - # = GFF2 class GFF2 < GFF - - # VERSION = 2 end - # = GFF3 class GFF3 < GFF - - # VERSION = 3 end ! end --- 39,97 ---- module Bio ! class GFF ! attr_accessor :records ! def initialize(str = '') ! @records = Array.new ! str.each_line do |line| ! @records << Record.new(line) end + end ! class Record ! attr_accessor :seqname ! attr_accessor :source ! attr_accessor :feature ! attr_accessor :start ! attr_accessor :end ! attr_accessor :score ! attr_accessor :strand ! attr_accessor :frame ! attr_accessor :attributes ! attr_accessor :comments ! def initialize(str) ! @comments = str.chomp[/#.*/] ! return if /^#/.match(str) ! @seqname, @source, @feature, @start, @end, @score, @strand, @frame, ! attributes, = str.chomp.split("\t") ! @attributes = parse_attributes(attributes) if attributes ! end ! private ! def parse_attributes(attributes) ! hash = Hash.new ! attributes.split(/[^\\];/).each do |atr| ! key, value = atr.split(' ', 2) ! hash[key] = value end + return hash end end class GFF2 < GFF VERSION = 2 end class GFF3 < GFF VERSION = 3 end ! end # class GFF ! ! end # module Bio From nakao at pub.open-bio.org Sun Dec 18 11:56:08 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 11:48:56 2005 Subject: [BioRuby-cvs] bioruby/test/data/genscan - New directory Message-ID: <200512181656.jBIGu8VL029439@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/data/genscan In directory pub.open-bio.org:/tmp/cvs-serv29429/test/data/genscan Log Message: Directory /home/repository/bioruby/bioruby/test/data/genscan added to the repository From nakao at pub.open-bio.org Sun Dec 18 11:56:38 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 11:49:28 2005 Subject: [BioRuby-cvs] bioruby/test/data/genscan sample.report,NONE,1.1 Message-ID: <200512181656.jBIGucVL029476@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/data/genscan In directory pub.open-bio.org:/tmp/cvs-serv29466/test/data/genscan Added Files: sample.report Log Message: * Newly added. --- NEW FILE: sample.report --- GENSCAN 1.0 Date run: 30-May-103 Time: 14:06:28 Sequence HUMRASH : 12942 bp : 68.17% C+G : Isochore 4 (57 - 100 C+G%) Parameter matrix: HumanIso.smat Predicted genes/exons: Gn.Ex Type S .Begin ...End .Len Fr Ph I/Ac Do/T CodRg P.... Tscr.. ----- ---- - ------ ------ ---- -- -- ---- ---- ----- ----- ------ 1.01 Init + 1664 1774 111 1 0 94 83 212 0.997 21.33 1.02 Intr + 2042 2220 179 1 2 104 66 408 0.997 40.12 1.03 Intr + 2374 2533 160 1 1 89 94 302 0.999 32.08 1.04 Term + 3231 3350 120 2 0 115 48 202 0.980 18.31 1.05 PlyA + 3722 3727 6 -5.80 2.00 Prom + 6469 6508 40 -7.92 2.01 Init + 8153 8263 111 1 0 94 83 212 0.998 21.33 2.02 Intr + 8531 8709 179 1 2 104 66 408 0.997 40.12 2.03 Intr + 8863 9022 160 1 1 89 94 302 0.999 32.08 2.04 Term + 9720 9839 120 2 0 115 48 202 0.961 18.31 Predicted peptide sequence(s): Predicted coding sequence(s): >HUMRASH|GENSCAN_predicted_peptide_1|189_aa MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG QEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDL AARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPG CMSCKCVLS >HUMRASH|GENSCAN_predicted_CDS_1|570_bp atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgacc atccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctac cggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggc caggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgt gtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatc aaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctg gctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccc tacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtg cgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggc tgcatgagctgcaagtgtgtgctctcctga >HUMRASH|GENSCAN_predicted_peptide_2|189_aa MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG QEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDL AARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPG CMSCKCVLS >HUMRASH|GENSCAN_predicted_CDS_2|570_bp atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgacc atccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctac cggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggc caggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgt gtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatc aaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctg gctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccc tacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtg cgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggc tgcatgagctgcaagtgtgtgctctcctga From k at pub.open-bio.org Sun Dec 18 11:57:18 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:50:06 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_shell.rb,1.2,1.3 Message-ID: <200512181657.jBIGvIVL029504@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv29415/test/unit/bio Modified Files: test_shell.rb Log Message: * removed some test methods as the test targets (global variables) are already removed Index: test_shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_shell.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_shell.rb 23 Nov 2005 11:49:50 -0000 1.2 --- test_shell.rb 18 Dec 2005 16:57:15 -0000 1.3 *************** *** 31,42 **** class TestShell < Test::Unit::TestCase - def test_const_bioruby_config - assert_equal({}, $bioruby_config) - end - - def test_const_bioruby_cache - assert_equal({}, $bioruby_cache) - end - end end --- 31,34 ---- From nakao at pub.open-bio.org Sun Dec 18 11:59:00 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 11:51:47 2005 Subject: [BioRuby-cvs] bioruby/lib/bio reference.rb,1.17,1.18 Message-ID: <200512181659.jBIGx0VL029575@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv29565/lib/bio Modified Files: reference.rb Log Message: * Removed TAB. Index: reference.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/reference.rb,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** reference.rb 8 Sep 2005 01:22:08 -0000 1.17 --- reference.rb 18 Dec 2005 16:58:58 -0000 1.18 *************** *** 27,45 **** def initialize(hash) hash.default = '' ! @authors = hash['authors'] # [ "Hoge, J.P.", "Fuga, F.B." ] ! @title = hash['title'] # "Title of the study." ! @journal = hash['journal'] # "Theor. J. Hoge" ! @volume = hash['volume'] # 12 ! @issue = hash['issue'] # 3 ! @pages = hash['pages'] # 123-145 ! @year = hash['year'] # 2001 ! @pubmed = hash['pubmed'] # 12345678 ! @medline = hash['medline'] # 98765432 ! @abstract = hash['abstract'] ! @url = hash['url'] ! @mesh = hash['mesh'] @affiliations = hash['affiliations'] ! @authors = [] if @authors.empty? ! @mesh = [] if @mesh.empty? @affiliations = [] if @affiliations.empty? end --- 27,45 ---- def initialize(hash) hash.default = '' ! @authors = hash['authors'] # [ "Hoge, J.P.", "Fuga, F.B." ] ! @title = hash['title'] # "Title of the study." ! @journal = hash['journal'] # "Theor. J. Hoge" ! @volume = hash['volume'] # 12 ! @issue = hash['issue'] # 3 ! @pages = hash['pages'] # 123-145 ! @year = hash['year'] # 2001 ! @pubmed = hash['pubmed'] # 12345678 ! @medline = hash['medline'] # 98765432 ! @abstract = hash['abstract'] ! @url = hash['url'] ! @mesh = hash['mesh'] @affiliations = hash['affiliations'] ! @authors = [] if @authors.empty? ! @mesh = [] if @mesh.empty? @affiliations = [] if @affiliations.empty? end From k at pub.open-bio.org Sun Dec 18 12:00:12 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 11:53:01 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_shell.rb,1.3,1.4 Message-ID: <200512181700.jBIH0CVL029640@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv29620/test/unit/bio Modified Files: test_shell.rb Log Message: * removed class to avoid test failure with 'No tests were specified.' Index: test_shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_shell.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_shell.rb 18 Dec 2005 16:57:15 -0000 1.3 --- test_shell.rb 18 Dec 2005 17:00:10 -0000 1.4 *************** *** 26,34 **** require 'test/unit' ! require 'bio/shell' module Bio - class TestShell < Test::Unit::TestCase - - end end --- 26,31 ---- require 'test/unit' ! require 'bioruby' module Bio end From nakao at pub.open-bio.org Sun Dec 18 12:06:58 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 11:59:47 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl/blast test_xmlparser.rb, 1.2, 1.3 Message-ID: <200512181706.jBIH6wVL029705@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/blast In directory pub.open-bio.org:/tmp/cvs-serv29695/test/unit/bio/appl/blast Modified Files: test_xmlparser.rb Log Message: * Fix a test data class. Index: test_xmlparser.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/blast/test_xmlparser.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_xmlparser.rb 22 Nov 2005 08:31:47 -0000 1.2 --- test_xmlparser.rb 18 Dec 2005 17:06:56 -0000 1.3 *************** *** 175,179 **** class TestBlastReportIteration < Test::Unit::TestCase def setup ! data = Bio::TestBlastData.data report = Bio::Blast::Report.new(data) @itr = report.iterations.first --- 175,179 ---- class TestBlastReportIteration < Test::Unit::TestCase def setup ! data = TestBlastFormat7XMLParserData.output report = Bio::Blast::Report.new(data) @itr = report.iterations.first From nakao at pub.open-bio.org Sun Dec 18 12:08:31 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 12:01:23 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db prosite.rb,0.11,0.12 Message-ID: <200512181708.jBIH8VVL029754@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv29744/lib/bio/db Modified Files: prosite.rb Log Message: * Added some RDoc documents. Index: prosite.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/prosite.rb,v retrieving revision 0.11 retrieving revision 0.12 diff -C2 -d -r0.11 -r0.12 *** prosite.rb 26 Sep 2005 13:00:06 -0000 0.11 --- prosite.rb 18 Dec 2005 17:08:29 -0000 0.12 *************** *** 1,6 **** # ! # bio/db/prosite.rb - PROSITE database class # ! # Copyright (C) 2001 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,16 ---- # ! # = bio/db/prosite.rb - PROSITE database class ! # ! # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description # ! # ! # == Example ! # == References ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 28,32 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 27,32 **** class PROSITE < EMBLDB ! DELIMITER = RS = "\n//\n" ! TAGSIZE = 5 def initialize(entry) --- 37,49 ---- class PROSITE < EMBLDB ! # Delimiter ! DELIMITER = "\n//\n" ! ! # Delimiter ! RS = DELIMITER ! ! # Bio::DB API ! TAGSIZE = 5 ! def initialize(entry) *************** *** 39,42 **** --- 56,60 ---- # ID ENTRY_NAME; ENTRY_TYPE. (ENTRY_TYPE : PATTERN, MATRIX, RULE) # + # Returns def name unless @data['ID'] *************** *** 45,48 **** --- 63,68 ---- @data['ID'] end + + # Returns def division unless @data['TYPE'] *************** *** 57,60 **** --- 77,81 ---- # AC PSnnnnn; # + # Returns def ac unless @data['AC'] *************** *** 63,66 **** --- 84,88 ---- @data['AC'] end + alias entry_id ac *************** *** 70,76 **** --- 92,100 ---- # DT MMM-YYYY (CREATED); MMM-YYYY (DATA UPDATE); MMM-YYYY (INFO UPDATE). # + # Returns def dt field_fetch('DT') end + alias date dt *************** *** 80,86 **** --- 104,112 ---- # DE Description. # + # Returns def de field_fetch('DE') end + alias definition de *************** *** 90,93 **** --- 116,120 ---- # see - pa2re method # + # Returns def pa field_fetch('PA') *************** *** 96,99 **** --- 123,127 ---- @data['PA'] end + alias pattern pa *************** *** 103,109 **** --- 131,139 ---- # see - ma2re method # + # Returns def ma field_fetch('MA') end + alias profile ma *************** *** 115,121 **** --- 145,153 ---- # The rule is described in ordinary English and is free-format. # + # Returns def ru field_fetch('RU') end + alias rule ru *************** *** 138,141 **** --- 170,174 ---- # profile because they are partial (fragment) sequences. # + # Returns def nr unless @data['NR'] *************** *** 159,224 **** --- 192,274 ---- @data['NR'] end + alias statistics nr + # Returns def release statistics['RELEASE'] end + # Returns def swissprot_release_number release.first end + # Returns def swissprot_release_sequences release.last end + # Returns def total statistics['TOTAL'] end + # Returns def total_hits total.first end + # Returns def total_sequences total.last end + # Returns def positive statistics['POSITIVE'] end + # Returns def positive_hits positive.first end + # Returns def positive_sequences positive.last end + # Returns def unknown statistics['UNKNOWN'] end + # Returns def unknown_hits unknown.first end + # Returns def unknown_sequences unknown.last end + # Returns def false_pos statistics['FALSE_POS'] end + # Returns def false_positive_hits false_pos.first end + # Returns def false_positive_sequences false_pos.last end + # Returns def false_neg statistics['FALSE_NEG'] *************** *** 226,229 **** --- 276,280 ---- alias false_negative_hits false_neg + # Returns def partial statistics['PARTIAL'] *************** *** 242,245 **** --- 293,297 ---- # by a program (because it is too unspecific). # + # Returns def cc unless @data['CC'] *************** *** 252,257 **** --- 304,311 ---- @data['CC'] end + alias comment cc + # Returns def taxon_range(expand = nil) range = comment['TAXO-RANGE'] *************** *** 272,279 **** --- 326,335 ---- end + # Returns def max_repeat comment['MAX-REPEAT'].to_i end + # Returns def site if comment['SITE'] *************** *** 283,286 **** --- 339,343 ---- end + # Returns def skip_flag if comment['SKIP-FLAG'] == 'TRUE' *************** *** 312,315 **** --- 369,373 ---- # consideration. # + # Returns def dr unless @data['DR'] *************** *** 324,329 **** --- 382,389 ---- @data['DR'] end + alias sp_xref dr + # Returns def list_xref(flag, by_name = nil) ary = [] *************** *** 341,360 **** --- 401,425 ---- end + # Returns def list_truepositive(by_name = nil) list_xref('T', by_name) end + # Returns def list_falsenegative(by_name = nil) list_xref('F', by_name) end + # Returns def list_falsepositive(by_name = nil) list_xref('P', by_name) end + # Returns def list_potentialhit(by_name = nil) list_xref('P', by_name) end + # Returns def list_unknown(by_name = nil) list_xref('?', by_name) *************** *** 366,369 **** --- 431,435 ---- # 3D name; [name2;...] # + # Returns def pdb_xref unless @data['3D'] *************** *** 378,381 **** --- 444,448 ---- # DO PDOCnnnnn; # + # Returns def pdoc_xref @data['DO'] = fetch('DO').chomp(';') *************** *** 421,424 **** --- 488,492 ---- # translated as: Ala-any-[Ser or Thr]-[Ser or Thr]-(any or none)-Val # + # Returns def pa2re(pattern) pattern.gsub!(/\s/, '') # remove white spaces *************** *** 442,445 **** --- 510,514 ---- # prosite/profile.txt: # + # Returns def ma2re(matrix) raise NotImplementedError From nakao at pub.open-bio.org Sun Dec 18 12:09:55 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 12:03:08 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/io test_soapwsdl.rb,NONE,1.1 Message-ID: <200512181709.jBIH9tVL029782@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/io In directory pub.open-bio.org:/tmp/cvs-serv29772/test/unit/bio/io Added Files: test_soapwsdl.rb Log Message: * Newly added. --- NEW FILE: test_soapwsdl.rb --- # # test/unit/bio/io/test_soapwsdl.rb - Unit test for SOAP/WSDL # # Copyright (C) 2005 Mitsuteru Nakao # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_soapwsdl.rb,v 1.1 2005/12/18 17:09:53 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/io/soapwsdl' module Bio class TestSOAPWSDL < Test::Unit::TestCase def setup @obj = Bio::SOAPWSDL end def test_methods methods = ['wsdl', 'wsdl=', 'log', 'log='] assert_equal(methods.sort, (@obj.instance_methods - Object.methods).sort) end end end From nakao at pub.open-bio.org Sun Dec 18 12:11:27 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 12:04:18 2005 Subject: [BioRuby-cvs] bioruby/test/functional/bio/io test_soapwsdl.rb, NONE, 1.1 Message-ID: <200512181711.jBIHBRVL029836@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/functional/bio/io In directory pub.open-bio.org:/tmp/cvs-serv29816/test/functional/bio/io Added Files: test_soapwsdl.rb Log Message: * Newly added. --- NEW FILE: test_soapwsdl.rb --- # # test/functional/bio/io/test_soapwsdl.rb - Unit test for SOAP/WSDL # # Copyright (C) 2005 Mitsuteru Nakao # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_soapwsdl.rb,v 1.1 2005/12/18 17:11:25 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/io/soapwsdl' module Bio class TestSOAPWSDL < Test::Unit::TestCase def setup @wsdl = 'http://www.ebi.ac.uk/xembl/XEMBL.wsdl' @obj = Bio::SOAPWSDL.new(@wsdl) end def test_wsdl assert_equal(@wsdl, @obj.wsdl) end def test_set_wsdl @obj.wsdl = 'http://soap.genome.jp/KEGG.wsdl' assert_equal('http://soap.genome.jp/KEGG.wsdl', @obj.wsdl) end def test_log assert_equal(nil, @obj.log) end def test_set_log require 'stringio' io = StringIO.new @obj.log = io assert_equal(StringIO, @obj.log.class) end end end From nakao at pub.open-bio.org Sun Dec 18 12:28:58 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 12:21:46 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl blast.rb,1.26,1.27 Message-ID: <200512181728.jBIHSwVL029938@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv29928/lib/bio/appl Modified Files: blast.rb Log Message: * Removed TAB. Index: blast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast.rb,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** blast.rb 26 Sep 2005 13:00:04 -0000 1.26 --- blast.rb 18 Dec 2005 17:28:55 -0000 1.27 *************** *** 40,53 **** def initialize(program, db, opt = [], server = 'local') ! @program = program ! @db = db ! @server = server @blastall = 'blastall' ! @matrix = nil ! @filter = nil ! @output = '' ! @parser = nil begin --- 40,53 ---- def initialize(program, db, opt = [], server = 'local') ! @program = program ! @db = db ! @server = server @blastall = 'blastall' ! @matrix = nil ! @filter = nil ! @output = '' ! @parser = nil begin *************** *** 64,72 **** end end ! @options = [ *a ] end attr_accessor :program, :db, :options, :server, :blastall, :matrix, :filter attr_reader :output, :format ! attr_writer :parser # to change :xmlparser, :rexml, :tab def self.local(program, db, option = '') --- 64,72 ---- end end ! @options = [ *a ] end attr_accessor :program, :db, :options, :server, :blastall, :matrix, :filter attr_reader :output, :format ! attr_writer :parser # to change :xmlparser, :rexml, :tab def self.local(program, db, option = '') *************** *** 97,102 **** ary = [] input.each("\n") do |xml| ! xml.sub!(/[^<]*( tag ! next if xml.empty? # skip trailing no hits if block_given? yield Report.new(xml, parser) --- 97,102 ---- ary = [] input.each("\n") do |xml| ! xml.sub!(/[^<]*( tag ! next if xml.empty? # skip trailing no hits if block_given? yield Report.new(xml, parser) *************** *** 146,158 **** form = { ! 'style' => 'raw', ! 'prog' => @program, ! 'dbname' => @db, ! 'sequence' => CGI.escape(query), ! 'other_param' => CGI.escape(make_command_line_unix(opt)), ! 'matrix' => matrix, ! 'filter' => filter, ! 'V_value' => 500, # default value for GenomeNet ! 'B_value' => 250, # default value for GenomeNet 'alignment_view' => 0, } --- 146,158 ---- form = { ! 'style' => 'raw', ! 'prog' => @program, ! 'dbname' => @db, ! 'sequence' => CGI.escape(query), ! 'other_param' => CGI.escape(make_command_line_unix(opt)), ! 'matrix' => matrix, ! 'filter' => filter, ! 'V_value' => 500, # default value for GenomeNet ! 'B_value' => 250, # default value for GenomeNet 'alignment_view' => 0, } From ngoto at pub.open-bio.org Sun Dec 18 12:33:34 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 12:26:22 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb atom.rb,1.4,1.5 Message-ID: <200512181733.jBIHXYVL029982@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory pub.open-bio.org:/tmp/cvs-serv29972 Modified Files: atom.rb Log Message: removed Bio::PDB::Atom (and Bio::PDB::HetAtm) Index: atom.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/atom.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** atom.rb 18 Dec 2005 15:09:46 -0000 1.4 --- atom.rb 18 Dec 2005 17:33:32 -0000 1.5 *************** *** 56,113 **** end #class Coordinate - # Bio::PDB::Atom is a class for atom data. - # Each ATOM line is parsed into an Atom object. - Atom = Struct.new(:serial, :element, :alt_loc, :x, :y, :z, - :occ, :bfac, :residue) - class Atom - include Utils - include Comparable - - #Returns a Coordinate class instance of the xyz positions - def xyz - Coordinate[ x, y, z ] - end - - #Returns an array of the xyz positions - def to_a - [ x, y, z ] - end - - #Sorts based on serial numbers - def <=>(other) - return serial <=> other.serial - end - - #Stringifies to PDB format - def to_s - if element.length < 4 - elementOutput = sprintf(" %-3s", element) - else - elementOutput = element - end - sprintf("%-6s%5s %s%1s%3s %1s%4s%1s %8.3f%8.3f%8.3f%6.2f%6.2f", - record_type, - serial, elementOutput, alt_loc, residue.resName, - residue.chain.id, residue.resSeq, residue.iCode, - x, y, z, occ, bfac) - end - - def record_name - 'ATOM' - end - def record_type - record_name - end - end #class Atom - - # Bio::PDB::HetAtm is a class for HETATM data. - # Each HETATM line is parsed into an HetAtm object. - # Since HetAtm inherits Atom class, please refer Atom class for usage. - class HetAtm < Atom - def record_name - 'HETATM' - end - end #class HetAtm - end #class PDB end #class Bio --- 56,60 ---- end #class Coordinate end #class PDB end #class Bio + From ngoto at pub.open-bio.org Sun Dec 18 12:34:49 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 12:27:36 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb residue.rb,1.3,1.4 Message-ID: <200512181734.jBIHYnVL029999@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory pub.open-bio.org:/tmp/cvs-serv29989 Modified Files: residue.rb Log Message: changed the ID generation codes Index: residue.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/residue.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** residue.rb 18 Dec 2005 15:09:46 -0000 1.3 --- residue.rb 18 Dec 2005 17:34:47 -0000 1.4 *************** *** 52,58 **** @id = nil else ! @id = @resSeq.to_s << @iCode if @hetatm ! @id = 'LIGAND' << @id end end --- 52,58 ---- @id = nil else ! @id = "#{@resSeq}#{@iCode.strip}" if @hetatm ! @id = 'LIGAND' + @id end end *************** *** 72,78 **** def resSeq=(resSeq) @resSeq = resSeq.to_i ! @id = resSeq.to_s << @iCode if @hetatm ! @id = 'LIGAND' << @id end end --- 72,78 ---- def resSeq=(resSeq) @resSeq = resSeq.to_i ! @id = "#{@resSeq}#{@iCode.strip}" if @hetatm ! @id = 'LIGAND' + @id end end *************** *** 80,86 **** def iCode=(iCode) @iCode = iCode ! @id = @resSeq.to_s << iCode if @hetatm ! @id = 'LIGAND' << @id end end --- 80,86 ---- def iCode=(iCode) @iCode = iCode ! @id = "#{@resSeq}#{@iCode.strip}" if @hetatm ! @id = 'LIGAND' + @id end end From ngoto at pub.open-bio.org Sun Dec 18 12:37:16 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 12:30:06 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.5,1.6 Message-ID: <200512181737.jBIHbGVL030018@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory pub.open-bio.org:/tmp/cvs-serv30006 Modified Files: pdb.rb Log Message: changed logics It might work correctly, but would stil have many bugs. Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pdb.rb 18 Dec 2005 15:09:46 -0000 1.5 --- pdb.rb 18 Dec 2005 17:37:14 -0000 1.6 *************** *** 1196,1205 **** } - #Aha! Our entry into the world of PDB parsing, we initialise a PDB - #object with the whole PDB file as a string - #each PDB has an array of the lines of the original file - #a bit memory-tastic! A hash of records and an array of models - #also has an id def initialize(str) @data = str.split(/[\r\n]+/) --- 1196,1205 ---- } def initialize(str) + #Aha! Our entry into the world of PDB parsing, we initialise a PDB + #object with the whole PDB file as a string + #each PDB has an array of the lines of the original file + #a bit memory-tastic! A hash of records and an array of models + #also has an id @data = str.split(/[\r\n]+/) *************** *** 1236,1252 **** end ! #The meat of the atom parsing - could be speeded up I think case key ! when 'ATOM', 'HETATM' #Each model has a special solvent chain #any chain id with the solvent is lost #I can fix this if really needed ! if key == 'HETATM' and f.resName == 'HOH' solvent = Residue.new(f.resName, f.resSeq, f.iCode, cModel.solvent, true) ! solvent_atom = f f.residue = solvent ! solvent.addAtom(solvent_atom) cModel.addSolvent(solvent) --- 1236,1278 ---- end ! # Do something for ATOM and HETATM case key ! when 'ATOM' ! residueID = "#{f.resSeq}#{f.iCode.strip}".strip ! #p f ! ! if f.chainID == cChain.id ! chain = cChain ! elsif !(chain = cModel[f.chainID]) ! #If we don't have chain, add a new chain ! newChain = Chain.new(f.chainID, cModel) ! cModel.addChain(newChain) ! cChain = newChain ! chain = newChain ! end ! ! if !newChain and residueID == cResidue.id ! residue = cResidue ! elsif newChain or !(residue = chain[residueID]) ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, chain) ! chain.addResidue(newResidue) ! cResidue = newResidue ! residue = newResidue ! end ! ! f.residue = residue ! residue.addAtom(f) ! ! when 'HETATM' #Each model has a special solvent chain #any chain id with the solvent is lost #I can fix this if really needed ! if f.resName == 'HOH' solvent = Residue.new(f.resName, f.resSeq, f.iCode, cModel.solvent, true) ! #p solvent f.residue = solvent ! solvent.addAtom(f) cModel.addSolvent(solvent) *************** *** 1257,1317 **** #numbers for HETATMS residueID = "#{f.resSeq}#{f.iCode.strip}".strip ! if key == 'HETATM' ! residueID = "LIGAND" + residueID ! end ! ! #If this atom is part of the current residue then add it to ! #the current residue straight away ! if f.chainID == cChain.id and residueID == cResidue.id ! ! #If we have this chain and residue just add the atom ! atom = f ! f.residue = cResidue ! cResidue.addAtom(atom) ! elsif !cModel[f.chainID] ! ! #If we don't have anyhting, add a new chain, residue and atom ! newChain = Chain.new(f.chainID, cModel) cModel.addChain(newChain) ! ! if key == 'ATOM' ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, ! newChain) ! newChain.addResidue(newResidue) ! else ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, ! newChain, true) ! newChain.addLigand(newResidue) ! end ! atom = f ! f.residue = newResidue ! newResidue.addAtom(atom) ! ! cChain = newChain ! cResidue = newResidue ! ! elsif !cModel[f.chainID][residueID] ! #If we have the chain (but not the residue) ! #make a new residue, add it and add the atom ! chain = cModel[f.chainID] ! ! if key == 'ATOM' ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, ! chain) ! chain.addResidue(newResidue) ! else ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, ! chain, true) ! chain.addLigand(newResidue) ! end ! ! atom = f ! f.residue = newResidue ! newResidue.addAtom(atom) cResidue = newResidue ! end end --- 1283,1313 ---- #numbers for HETATMS residueID = "#{f.resSeq}#{f.iCode.strip}".strip ! residueID = "LIGAND" + residueID ! #p f ! #p residueID ! if f.chainID == cChain.id ! chain = cChain ! elsif !(chain = cModel[f.chainID]) ! #If we don't have chain, add a new chain ! newChain = Chain.new(f.chainID, cModel) cModel.addChain(newChain) ! cChain = newChain ! chain = newChain ! end ! if !newChain and residueID == cResidue.id ! residue = cResidue ! elsif newChain or !(residue = chain[residueID]) ! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, ! chain, true) ! chain.addLigand(newResidue) cResidue = newResidue ! residue = newResidue end + + f.residue = residue + residue.addAtom(f) + end From nakao at pub.open-bio.org Sun Dec 18 12:43:53 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Dec 18 12:36:42 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/embl test_uniprot.rb, 1.2, 1.3 Message-ID: <200512181743.jBIHhrVL030050@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/embl In directory pub.open-bio.org:/tmp/cvs-serv30040/test/unit/bio/db/embl Modified Files: test_uniprot.rb Log Message: * Removed redundunt test codes. Index: test_uniprot.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/embl/test_uniprot.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_uniprot.rb 23 Nov 2005 10:12:09 -0000 1.2 --- test_uniprot.rb 18 Dec 2005 17:43:51 -0000 1.3 *************** *** 37,170 **** end - def test_id_line - assert(@obj.id_line) - end - def test_id_line_entry_name - assert_equal('P53_HUMAN', @obj.id_line('ENTRY_NAME')) - end - def test_id_line_data_class - assert_equal('STANDARD', @obj.id_line('DATA_CLASS')) - end - def test_id_line_molecule_type - assert_equal('PRT', @obj.id_line('MOLECULE_TYPE')) - end - def test_id_line_sequence_length - assert_equal(393, @obj.id_line('SEQUENCE_LENGTH')) - end - - - def test_ac - assert_equal([], @obj.ac) - assert_equal([], @obj.acccessions) - end - def test_accession - assert_equal('', @obj.accession) - end - - def test_de - assert(@obj.de) - end - - def test_protein_name - assert_equal("Cellular tumor antigen p53", @obj.protein_name) - end - - def test_synonyms - assert_equal(["Tumor suppressor p53", "Phosphoprotein p53", "Antigen NY-CO-13"], @obj.synonyms) - end - - def test_gn - assert_equal([{:orfs=>[], :synonyms=>["P53"], :name=>"TP53", :loci=>[]}], @obj.gn) - end - def test_gn_uniprot_parser - gn_uniprot_data = '' - assert_equal('', @obj.instance_eval(gn_uniprot_parser(gn_uniprot_data))) - end - # def test_gn_old_parser - # gn_old_data = '' - # assert_equal('', @obj.instance_eval(gn_old_parser(gn_old_data))) - # end - - def test_gene_names - assert_equal(["TP53"], @obj.gene_names) - end - def test_gene_name assert_equal('TP53', @obj.gene_name) end - def test_os - assert(@obj.os) - end - - def test_os_access - assert_equal({'name' => '', 'os' => ''}, @obj.os(1)) - end - - def test_os_access2 - assert_equal({}, @obj.os[1]) - end - - - def test_cc - data = '' - assert_equal('', @obj.instance_eval(cc_scan_alternative_products(data))) - data = '' - assert_equal('', @obj.instance_eval(cc_scan_database(data))) - data = '' - assert_equal('', @obj.instance_eval(cc_scan_mass_spectorometry(data))) - - assert_equal([], @obj.cc) - end - def test_cc_database - assert_equal([], @obj.cc('DATABASE')) - end - def test_cc_alternative_products - assert_equal({}, @obj.cc('ALTERNATIVE PRODUCTS')) - end - def test_cc_mass_spectrometry - assert_equal([], @obj.cc('MASS SPECTROMETRY')) - end - - def test_cc_interaction - data =< Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory pub.open-bio.org:/tmp/cvs-serv30126/test/unit/bio/db Modified Files: test_fasta.rb Log Message: * fixed to pass all test, replaced the data with suitable one Index: test_fasta.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_fasta.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_fasta.rb 23 Nov 2005 11:21:15 -0000 1.2 --- test_fasta.rb 18 Dec 2005 17:55:13 -0000 1.3 *************** *** 39,44 **** ! class TestFastaFormat < Test::Unit::TestCase def setup text =<gi|1171674|sp|P42267|NDD_BPR69 NUCLEAR DISRUPTION PROTEIN ! MKYMTVTDLNNAGATVIGTIKGGEWFLGTPHKDILSKPGFYFLVSKLDGRPFSNPCVSARFYVGNQRSKQGFSAVLSHIR ! QRRSQLARTIANNNMVYTVFYLPASKMKPLTTGFGKGQLALAFTRNHHSEYQTLEEMNRMLADNFKFVLQAY ! END ! @obj = Bio::FastaFormat.new(text) ! end ! ! def test_locus ! assert_equal(nil, @obj.locus) ! end ! end ! ! class TestFastaFormatKeggGenesNT < Test::Unit::TestCase ! def setup ! text =<eco:b0001 thrL; thr operon leader peptide (N) ! atgaaacgcattagcaccaccattaccaccaccatcaccattaccacaggtaacggtgcg ! ggctga ! END ! @obj = Bio::FastaFormat.new(text) ! end ! ! def test_naseq_class ! assert_equal(Bio::Sequence::NA, @obj.naseq.class) ! end ! ! def test_naseq ! seq = 'atgaaacgcattagcaccaccattaccaccaccatcaccattaccacaggtaacggtgcgggctga' ! assert_equal(seq, @obj.naseq) ! end + def test_nalen + assert_equal(66, @obj.nalen) + end + end + + class TestFastaFormatKeggGenesAA < Test::Unit::TestCase def setup text =<gi|55416189|gb|AAV50056.1| NADH dehydrogenase subunit 1 [Dasyurus hallucatus] ! MFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALT ! IALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSF ! TLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTI ! LFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL ! >gi|55416190|gb|AAV50057.1| NADH dehydrogenase subunit 2 [Dasyurus hallucatus] ! MSPYVLMILTLSLFIGTCLTIFSNHWFTAWMGLEINTLAIIPLMTAPNNPRSTEAATKYFLTQATASMLMMFAIIYNAWS ! TNQWALPQLSDDWISLLMTVALAIKLGLAPFHFWVPEVTQGIPLLTGMILLTWQKIAPTAILFQIAPYLNMKFLVILAIL ! STLVGGWGGLNQTHLRKILAYSSIAHMGWMIIIVQINPTLSIFTLTIYVMATLTTFLTLNLSNSTKIKSLGNLWNKSATA ! TIIIFLTLLSLGGLPPLTGFMPKWLILQELINNGNIITATMMALSALLNLFFYMRLIYASSLTMFPSINNSKMQWYNNSM ! KTTTLIPTATVISSLLLPLTPLFVTLY ! END ! @obj = Bio::FastaFormat.new(text) end ! def test_entry ! data = ">gi|55416189|gb|AAV50056.1| NADH dehydrogenase subunit 1 [Dasyurus hallucatus]\nMFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALT\nIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSF\nTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTI\nLFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL\n" ! assert_equal(data, @obj.entry) end ! def test_entry_id ! assert_equal('gi|55416189', @obj.entry_id) end ! def test_definition ! data = "gi|55416189|gb|AAV50056.1| NADH dehydrogenase subunit 1 [Dasyurus hallucatus]" ! assert_equal(data, @obj.definition) ! end ! ! def test_data ! data = "\nMFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALT\nIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSF\nTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTI\nLFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL\n" ! assert_equal(data, @obj.data) ! end ! ! def test_seq ! seq = 'MFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALTIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSFTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTILFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL' ! assert_equal(seq, @obj.seq) ! end ! ! def test_length ! assert_equal(318, @obj.length) end def test_aaseq ! seq = "MFTINLLIYIIPILLAVAFLTLIERKMLGYMQFRKGPNIVGPYGLLQPFADAVKLFTKEPLRPLTSSISIFIIAPILALTIALTIWTPLPMPNTLLDLNLGLIFILSLSGLSVYSILWSGWASNSKYALIGALRAVAQTISYEVSLAIILLSIMLINGSFTLKTLSITQENLWLIITTWPLAMMWYISTLAETNRAPFDLTEGESELVSGFNVEYAAGPFAMFFLAEYANIIAMNAITTILFLGPSLTPNLSHLNTLSFMLKTLLLTMVFLWVRASYPRFRYDQLMHLLWKNFLPMTLAMCLWFISLPIALSCIPPQL" assert_equal(seq, @obj.aaseq) end def test_aalen ! assert_equal(318, @obj.aalen) end def test_identifiers ! assert_equal(Bio::FastaDefline, @obj.identifiers.class) end def test_gi ! assert_equal('55416189', @obj.gi) end def test_accession ! assert_equal('AAV50056', @obj.accession) end def test_accessions ! assert_equal(['AAV50056'], @obj.accessions) end def test_acc_version ! assert_equal('AAV50056.1', @obj.acc_version) end From k at pub.open-bio.org Sun Dec 18 13:04:33 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 12:57:21 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_gff.rb,1.2,1.3 Message-ID: <200512181804.jBII4XVL030197@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory pub.open-bio.org:/tmp/cvs-serv30193/test/unit/bio/db Modified Files: test_gff.rb Log Message: * fixed Errors and Failures Index: test_gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_gff.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_gff.rb 23 Nov 2005 11:29:16 -0000 1.2 --- test_gff.rb 18 Dec 2005 18:04:31 -0000 1.3 *************** *** 55,59 **** class TestGFF2 < Test::Unit::TestCase def test_version ! assert_equal(2, Bio::GFF2::VERSION) end end --- 55,59 ---- class TestGFF2 < Test::Unit::TestCase def test_version ! assert_equal(2, Bio::GFF::GFF2::VERSION) end end *************** *** 62,66 **** class TestGFF3 < Test::Unit::TestCase def test_version ! assert_equal(3, Bio::GFF3::VERSION) end end --- 62,66 ---- class TestGFF3 < Test::Unit::TestCase def test_version ! assert_equal(3, Bio::GFF::GFF3::VERSION) end end *************** *** 109,118 **** def test_attributes ! at = {"Note"=>"Chromosome I Centromere", "Gene"=>"CEN1"} assert_equal(at, @obj.attributes) end def test_comments ! assert_equal('', @obj.comments) end --- 109,118 ---- def test_attributes ! at = {"Note"=>'"Chromosome I Centromere"', "Gene"=>'"CEN1"'} assert_equal(at, @obj.attributes) end def test_comments ! assert_equal(nil, @obj.comments) end *************** *** 128,132 **** def test_add_seqname name = "test" ! record = Bio::GFF::Record.new record.seqname = name @obj.records << record --- 128,132 ---- def test_add_seqname name = "test" ! record = Bio::GFF::Record.new("") record.seqname = name @obj.records << record From ngoto at pub.open-bio.org Sun Dec 18 13:20:36 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 13:13:27 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.43,1.44 Message-ID: <200512181820.jBIIKaVL030314@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv30301 Modified Files: ChangeLog Log Message: added changelog for PDB classes Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** ChangeLog 5 Nov 2005 10:20:54 -0000 1.43 --- ChangeLog 18 Dec 2005 18:20:34 -0000 1.44 *************** *** 1,2 **** --- 1,24 ---- + 2005-12-19 Naohisa Goto + + * lib/bio/db/pdb.rb, lib/bio/db/pdb/pdb.rb, lib/bio/db/pdb/*.rb + * Many changes have been made. + * Bio::PDB::FieldDef is removed and Bio::PDB::Record is completely + changed. Now, Record is changed from hash to Struct, and + method_missing is no longer used. + * In the "MODEL" record, model_serial is changed to serial. + * In any records, record_type is changed to record_name. + * In most records contains real numbers, changed to return + float values instead of strings. + * Pdb_AChar, Pdb_Atom, Pdb_Character, Pdb_Continuation, + Pdb_Date, Pdb_IDcode, Pdb_Integer, Pdb_LString, Pdb_List, + Pdb_Real, Pdb_Residue_name, Pdb_SList, Pdb_Specification_list, + Pdb_String, Pdb_StringRJ and Pdb_SymOP are moved under + Bio::PDB::DataType. + + * lib/bio/db/pdb/atom.rb + * Bio::PDB::Atom is removed. + Instead, please use Bio::PDB::Record::ATOM and + Bio::PDB::Record::HETATM. + 2005-11-05 Toshiaki Katayama From ngoto at pub.open-bio.org Sun Dec 18 13:20:36 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 13:13:49 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.9,1.10 Message-ID: <200512181820.jBIIKaVL030318@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv30301/doc Modified Files: Changes-0.7.rd Log Message: added changelog for PDB classes Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Changes-0.7.rd 28 Nov 2005 04:57:32 -0000 1.9 --- Changes-0.7.rd 18 Dec 2005 18:20:34 -0000 1.10 *************** *** 165,168 **** --- 165,186 ---- * Bio::GFF3 is renamed to Bio::GFF::GFF3 + --- Bio::PDB + + * Bio::PDB::Atom is removed. Instead, please use Bio::PDB::Record::ATOM and + Bio::PDB::Record::HETATM. + * Bio::PDB::FieldDef is removed and Bio::PDB::Record is completely + changed. Now, Record is changed from hash to Struct, and + method_missing is no longer used. + * In the "MODEL" record, model_serial is changed to serial. + * In records, record_type is changed to record_name. + * In any records, record_type is changed to record_name. + * In most records contains real numbers, changed to return + float values instead of strings. + * Pdb_AChar, Pdb_Atom, Pdb_Character, Pdb_Continuation, + Pdb_Date, Pdb_IDcode, Pdb_Integer, Pdb_LString, Pdb_List, + Pdb_Real, Pdb_Residue_name, Pdb_SList, Pdb_Specification_list, + Pdb_String, Pdb_StringRJ and Pdb_SymOP are moved under + Bio::PDB::DataType. + === Deleted files From k at pub.open-bio.org Sun Dec 18 13:22:01 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 13:14:48 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_prosite.rb,1.2,1.3 Message-ID: <200512181822.jBIIM1VL030407@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory pub.open-bio.org:/tmp/cvs-serv30403/test/unit/bio/db Modified Files: test_prosite.rb Log Message: * fixed to pass the tests Index: test_prosite.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_prosite.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_prosite.rb 23 Nov 2005 11:32:13 -0000 1.2 --- test_prosite.rb 18 Dec 2005 18:21:58 -0000 1.3 *************** *** 1438,1457 **** def test_pa2re ! assert_equal('', @obj.pa2re) ! end ! ! def test_ma2re ! assert_raise(@obj.ma2re, NotImplementedError) end def test_self_pa2re ! assert(Bio::PROSITE.pattern2re) ! end ! ! def test_self_ma2re ! assert(Bio::PROSITE.profile2re) end - end # class TestPROSITE end --- 1438,1450 ---- def test_pa2re ! pa = '[AC]-x-V-x(4)-{ED}.' ! assert_equal(/[AC].V.{4}[^ED]/, @obj.pa2re(pa)) end def test_self_pa2re ! pa = '[AC]-x-V-x(4)-{ED}.' ! assert_equal(/[AC].V.{4}[^ED]/, Bio::PROSITE.pa2re(pa)) end end # class TestPROSITE end From k at pub.open-bio.org Sun Dec 18 13:24:10 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 13:16:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db prosite.rb,0.12,0.13 Message-ID: <200512181824.jBIIOAVL030508@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv30504/lib/bio/db Modified Files: prosite.rb Log Message: * fixed to pass the tests * class method Bio::PROSITE.pa2re(pattern) #=> regexp is added * pdb_xref method is fixed to remove ; from the last entry Index: prosite.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/prosite.rb,v retrieving revision 0.12 retrieving revision 0.13 diff -C2 -d -r0.12 -r0.13 *** prosite.rb 18 Dec 2005 17:08:29 -0000 0.12 --- prosite.rb 18 Dec 2005 18:24:08 -0000 0.13 *************** *** 434,438 **** def pdb_xref unless @data['3D'] ! @data['3D'] = fetch('3D').split(/; /) end @data['3D'] --- 434,438 ---- def pdb_xref unless @data['3D'] ! @data['3D'] = fetch('3D').split(/; */) end @data['3D'] *************** *** 488,493 **** # translated as: Ala-any-[Ser or Thr]-[Ser or Thr]-(any or none)-Val # ! # Returns ! def pa2re(pattern) pattern.gsub!(/\s/, '') # remove white spaces pattern.sub!(/\.$/, '') # (1) remove trailing '.' --- 488,492 ---- # translated as: Ala-any-[Ser or Thr]-[Ser or Thr]-(any or none)-Val # ! def self.pa2re(pattern) pattern.gsub!(/\s/, '') # remove white spaces pattern.sub!(/\.$/, '') # (1) remove trailing '.' *************** *** 503,506 **** --- 502,509 ---- pattern.tr!('-', '') # (6) each element is separated by a '-' Regexp.new(pattern) + end + + def pa2re(pattern) + self.class.pa2re(pattern) end From ngoto at pub.open-bio.org Sun Dec 18 13:44:28 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 13:37:17 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.10,1.11 Message-ID: <200512181844.jBIIiSVL030701@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv30685/doc Modified Files: Changes-0.7.rd Log Message: * added changelogs for Bio::Alignment * added "to be written..." to changelogs of Bio::PDB Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Changes-0.7.rd 18 Dec 2005 18:20:34 -0000 1.10 --- Changes-0.7.rd 18 Dec 2005 18:44:26 -0000 1.11 *************** *** 165,168 **** --- 165,186 ---- * Bio::GFF3 is renamed to Bio::GFF::GFF3 + --- Bio::Alignment + + * Old Bio::Alignment class is renamed to Bio::Alignment::OriginalAlignment. + Now, new Bio::Alignment is a module. However, you don't mind so much + because most of the class methods previously existed are defined + to delegate to the new Bio::Alignment::OriginalAlignment class, + for keeping backward compatibility. + * New classes and modules are introduced. Please refer RDoc. + * each_site and some methods changed to return Bio::Alignment::Site, + which inherits Array (previously returned Array). + * consensus_iupac now returns only standard bases + 'a', 'c', 'g', 't', 'm', 'r', 'w', 's', 'y', 'k', 'v', + 'h', 'd', 'b', 'n', or nil (in SiteMethods#consensus_iupac) or + '?' (or missing_char, in EnumerableExtension#consensus_iupac). + Note that consensus_iupac now does not return u and invalid letters + not defined in IUPAC standard even if all bases are equal. + * There are more and more changes to be written... + --- Bio::PDB *************** *** 182,185 **** --- 200,204 ---- Pdb_String, Pdb_StringRJ and Pdb_SymOP are moved under Bio::PDB::DataType. + * There are more and more changes to be written... === Deleted files From ngoto at pub.open-bio.org Sun Dec 18 13:44:28 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Sun Dec 18 13:37:19 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.44,1.45 Message-ID: <200512181844.jBIIiRVL030697@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv30685 Modified Files: ChangeLog Log Message: * added changelogs for Bio::Alignment * added "to be written..." to changelogs of Bio::PDB Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ChangeLog 18 Dec 2005 18:20:34 -0000 1.44 --- ChangeLog 18 Dec 2005 18:44:25 -0000 1.45 *************** *** 15,18 **** --- 15,19 ---- Pdb_String, Pdb_StringRJ and Pdb_SymOP are moved under Bio::PDB::DataType. + * There are more and more changes to be written... * lib/bio/db/pdb/atom.rb *************** *** 20,23 **** --- 21,46 ---- Instead, please use Bio::PDB::Record::ATOM and Bio::PDB::Record::HETATM. + + 2005-12-02 Naohisa Goto + + * lib/bio/alignment.rb + * Old Bio::Alignment class is renamed to + Bio::Alignment::OriginalAlignment. + Now, new Bio::Alignment is a module. However, + you don't mind so much because most of the class methods + previously existed are defined to delegate to the new + Bio::Alignment::OriginalAlignment class, + for keeping backward compatibility. + * New classes and modules are introduced. Please refer RDoc. + * each_site and some methods changed to return Bio::Alignment::Site, + which inherits Array (previously returned Array). + * consensus_iupac now returns only standard bases + 'a', 'c', 'g', 't', 'm', 'r', 'w', 's', 'y', 'k', 'v', + 'h', 'd', 'b', 'n', or nil (in SiteMethods#consensus_iupac) or + '?' (or missing_char, in EnumerableExtension#consensus_iupac). + Note that consensus_iupac now does not return u and invalid + letters not defined in IUPAC standard even if all bases + are equal. + * There are more and more changes to be written... 2005-11-05 Toshiaki Katayama From k at pub.open-bio.org Sun Dec 18 14:10:57 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 14:03:46 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io keggapi.rb,1.10,1.11 Message-ID: <200512181910.jBIJAvVL030900@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv30891/lib/bio/io Modified Files: keggapi.rb Log Message: * get_neighbors_by_gene method no more available on the server side since some while ago Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/keggapi.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** keggapi.rb 25 Nov 2005 11:28:30 -0000 1.10 --- keggapi.rb 18 Dec 2005 19:10:55 -0000 1.11 *************** *** 51,57 **** end ! def get_all_neighbors_by_gene(genes_id, org) ! get_all(:get_neighbors_by_gene, genes_id, org) ! end def get_all_best_best_neighbors_by_gene(genes_id) --- 51,57 ---- end ! # def get_all_neighbors_by_gene(genes_id, org) ! # get_all(:get_neighbors_by_gene, genes_id, org) ! # end def get_all_best_best_neighbors_by_gene(genes_id) *************** *** 826,830 **** --- btit(string) --- get_linkdb_by_entry(entry_id, db, start, max_results) ! --- get_neighbors_by_gene(genes_id, org, start, max_results) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) --- get_best_neighbors_by_gene(genes_id, start, max_results) --- 826,830 ---- --- btit(string) --- get_linkdb_by_entry(entry_id, db, start, max_results) ! #--- get_neighbors_by_gene(genes_id, org, start, max_results) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) --- get_best_neighbors_by_gene(genes_id, start, max_results) From k at pub.open-bio.org Sun Dec 18 14:13:12 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 14:05:59 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.11,1.12 Message-ID: <200512181913.jBIJDCVL030937@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv30933/doc Modified Files: Changes-0.7.rd Log Message: * changes on the Pathway is delayed Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Changes-0.7.rd 18 Dec 2005 18:44:26 -0000 1.11 --- Changes-0.7.rd 18 Dec 2005 19:13:09 -0000 1.12 *************** *** 116,125 **** can be proposed. Until then, this class is removed. ! --- Bio::Pathway ! ! * Bio::Pathway#nodes returns an Array of the node objects instead of ! the number of the node objects. ! * Bio::Pathway#edges returns an Array of the edge objects instead of ! the number of the edge objects. --- Bio::GenBank --- 116,129 ---- can be proposed. Until then, this class is removed. ! # ! # Following changes are suspended for a while (not yet introduced for now) ! # ! # --- Bio::Pathway ! # ! # * Bio::Pathway#nodes returns an Array of the node objects instead of ! # the number of the node objects. ! # * Bio::Pathway#edges returns an Array of the edge objects instead of ! # the number of the edge objects. ! # --- Bio::GenBank From k at pub.open-bio.org Sun Dec 18 20:20:08 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 20:12:56 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.15,1.16 Message-ID: <200512190120.jBJ1K8VL031540@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv31531/lib/bio/shell/plugin Modified Files: seq.rb Log Message: * removed comment Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** seq.rb 28 Nov 2005 12:07:42 -0000 1.15 --- seq.rb 19 Dec 2005 01:20:06 -0000 1.16 *************** *** 96,100 **** hash[codon] = percent end ! rep << codontable(1, hash).output #*TODO* how to hide? begin --- 96,100 ---- hash[codon] = percent end ! rep << codontable(1, hash).output begin From k at pub.open-bio.org Sun Dec 18 20:21:45 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 20:14:30 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_gff.rb,1.3,1.4 Message-ID: <200512190121.jBJ1LjVL031672@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory pub.open-bio.org:/tmp/cvs-serv31668/test/unit/bio/db Modified Files: test_gff.rb Log Message: * separate a test method Index: test_gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_gff.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_gff.rb 18 Dec 2005 18:04:31 -0000 1.3 --- test_gff.rb 19 Dec 2005 01:21:42 -0000 1.4 *************** *** 47,50 **** --- 47,53 ---- def test_records assert_equal(8, @obj.records.size) + end + + def test_record_class assert_equal(Bio::GFF::Record, @obj.records[0].class) end From k at pub.open-bio.org Sun Dec 18 21:34:27 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 21:27:14 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.11,1.12 Message-ID: <200512190234.jBJ2YRVL031865@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv31861/lib/bio/shell/plugin Modified Files: codon.rb Log Message: * fixed to pass the unit test (not output escape sequence in mono mode, completely) Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** codon.rb 7 Dec 2005 07:31:40 -0000 1.11 --- codon.rb 19 Dec 2005 02:34:24 -0000 1.12 *************** *** 178,182 **** text = header + table end ! text.gsub(/^\s+#/, @colors[:text]) end --- 178,186 ---- text = header + table end ! if Bio::Shell.config[:color] ! text.gsub(/^\s+#/, @colors[:text]) ! else ! text.gsub(/^\s+#/, '') ! end end From k at pub.open-bio.org Sun Dec 18 21:44:06 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Dec 18 21:36:54 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/shell/plugin test_seq.rb, 1.4, 1.5 Message-ID: <200512190244.jBJ2i6VL031930@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv31926/test/unit/bio/shell/plugin Modified Files: test_seq.rb Log Message: * modified to supress puts during tests Index: test_seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin/test_seq.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_seq.rb 18 Dec 2005 16:28:46 -0000 1.4 --- test_seq.rb 19 Dec 2005 02:44:03 -0000 1.5 *************** *** 100,104 **** // END ! assert_equal(output, seqstat(naseq)) end --- 100,114 ---- // END ! $str = '' ! alias puts_orig puts ! def puts(*args) ! args.each do |obj| ! $str << obj.to_s ! end ! end ! seqstat(naseq) ! undef puts ! alias puts puts_orig ! assert_equal(output, $str) end *************** *** 116,120 **** // END ! assert_equal(output, seqstat(aaseq)) end --- 126,140 ---- // END ! $str = '' ! alias puts_orig puts ! def puts(*args) ! args.each do |obj| ! $str << obj.to_s ! end ! end ! seqstat(aaseq) ! undef puts ! alias puts puts_orig ! assert_equal(output, $str) end *************** *** 139,147 **** at END ! $doublehelix = '' alias puts_orig puts def puts(*args) args.each do |obj| ! $doublehelix << obj.to_s end end --- 159,167 ---- at END ! $str = '' alias puts_orig puts def puts(*args) args.each do |obj| ! $str << obj.to_s end end *************** *** 149,153 **** undef puts alias puts puts_orig ! assert_equal(output, $doublehelix) end --- 169,173 ---- undef puts alias puts puts_orig ! assert_equal(output, $str) end From k at pub.open-bio.org Tue Dec 27 12:27:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Dec 27 12:19:35 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/util sirna.rb,1.6,1.7 Message-ID: <200512271727.jBRHReVL000863@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv830/lib/bio/util Modified Files: sirna.rb Log Message: * unit tests are fixed to run without errors with Ruby 1.8.4 (due to the change of rand algorithm in 1.8.3) as reported by N. Goto. Index: sirna.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/sirna.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sirna.rb 14 Nov 2005 15:44:30 -0000 1.6 --- sirna.rb 27 Dec 2005 17:27:38 -0000 1.7 *************** *** 202,209 **** class ShRNA ! # aBio::Sequence::NA attr_accessor :top_strand ! # aBio::Sequence::NA attr_accessor :bottom_strand --- 202,209 ---- class ShRNA ! # Bio::Sequence::NA attr_accessor :top_strand ! # Bio::Sequence::NA attr_accessor :bottom_strand From k at pub.open-bio.org Tue Dec 27 12:27:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Dec 27 12:19:41 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/util test_sirna.rb,1.1,1.2 Message-ID: <200512271727.jBRHReVL000861@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/util In directory pub.open-bio.org:/tmp/cvs-serv830/test/unit/bio/util Modified Files: test_sirna.rb Log Message: * unit tests are fixed to run without errors with Ruby 1.8.4 (due to the change of rand algorithm in 1.8.3) as reported by N. Goto. Index: test_sirna.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/util/test_sirna.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_sirna.rb 14 Nov 2005 14:46:06 -0000 1.1 --- test_sirna.rb 27 Dec 2005 17:27:38 -0000 1.2 *************** *** 29,36 **** module Bio class TestSiRNANew < Test::Unit::TestCase def test_new ! srand(1) ! naseq = Bio::Sequence::NA.new("ACGT" * 100).randomize assert(Bio::SiRNA.new(naseq)) assert(Bio::SiRNA.new(naseq, 21)) --- 29,38 ---- module Bio + + RANDOM_SEQ = "ctttcggtgcggacgtaaggagtattcctgtactaactaaatggagttaccaaggtaggaccacggtaaaatcgcgagcagcctcgatacaagcgttgtgctgaagcctatcgctgacctgaaggggggcgtaagcaaggcagcggttcaccttcatcagttctgctagaaatcacctagcaccccttatcatccgcgtcaggtccattacccttcccattatgtcggactcaattgaggtgcttgtgaacttatacttgaatccaaaacgtctactgtattggcgactaaaaagcacttgtggggagtcggcttgatcagcctccattagggccaggcactgaggatcatccagttaacgtcagattcaaggtctggctcttagcactcggagttgcac" + class TestSiRNANew < Test::Unit::TestCase def test_new ! naseq = Bio::Sequence::NA.new(RANDOM_SEQ) assert(Bio::SiRNA.new(naseq)) assert(Bio::SiRNA.new(naseq, 21)) *************** *** 44,49 **** class TestSiRNA < Test::Unit::TestCase def setup ! srand(1) ! naseq = Bio::Sequence::NA.new("ACGT" * 100).randomize @obj = Bio::SiRNA.new(naseq) end --- 46,50 ---- class TestSiRNA < Test::Unit::TestCase def setup ! naseq = Bio::Sequence::NA.new(RANDOM_SEQ) @obj = Bio::SiRNA.new(naseq) end *************** *** 117,122 **** class TestSiRNAPair < Test::Unit::TestCase def setup ! srand(1) ! naseq = Bio::Sequence::NA.new("ACGT" * 100).randomize @obj = Bio::SiRNA.new(naseq).design.first end --- 118,122 ---- class TestSiRNAPair < Test::Unit::TestCase def setup ! naseq = Bio::Sequence::NA.new(RANDOM_SEQ) @obj = Bio::SiRNA.new(naseq).design.first end *************** *** 176,181 **** class TestShRNA < Test::Unit::TestCase def setup ! srand(1) ! naseq = Bio::Sequence::NA.new("ACGT" * 100).randomize sirna = Bio::SiRNA.new(naseq) pairs = sirna.design --- 176,180 ---- class TestShRNA < Test::Unit::TestCase def setup ! naseq = Bio::Sequence::NA.new(RANDOM_SEQ) sirna = Bio::SiRNA.new(naseq) pairs = sirna.design *************** *** 247,251 **** 3'-CCUGCAUUCCUCAUAAGGACACACACGACAGGUGUCCUUAUGAGGAAUGCAGGAAAA-5' END ! @obj.design assert_equal(report, @obj.report) end --- 246,251 ---- 3'-CCUGCAUUCCUCAUAAGGACACACACGACAGGUGUCCUUAUGAGGAAUGCAGGAAAA-5' END ! #@obj.design ! @obj.block_it assert_equal(report, @obj.report) end