From nakao at dev.open-bio.org Mon Dec 3 01:19:14 2007 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Mon, 03 Dec 2007 06:19:14 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/sequence test_aa.rb, 1.4, 1.5 test_common.rb, 1.4, 1.5 test_na.rb, 1.5, 1.6 Message-ID: <200712030619.lB36JEY8011532@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/sequence In directory dev.open-bio.org:/tmp/cvs-serv11507/test/unit/bio/sequence Modified Files: test_aa.rb test_common.rb test_na.rb Log Message: * Fixed Bio::Sequence::NA#concat bug reported by Dr. M. Matsuzaki. * Added tests for concat and << for Bio::Sequence::NA and AA. Index: test_common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/sequence/test_common.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_common.rb 5 Apr 2007 23:35:44 -0000 1.4 --- test_common.rb 3 Dec 2007 06:19:12 -0000 1.5 *************** *** 32,35 **** --- 32,39 ---- end + def test_to_str + assert_equal('atgcatgcatgcatgcaaaa', @obj.to_str) + end + def test_seq str = "atgcatgcatgcatgcaaaa" *************** *** 37,41 **** end - # <<(*arg) def test_push --- 41,44 ---- *************** *** 44,47 **** --- 47,56 ---- end + # concat(*arg) + def test_concat + str = "atgcatgcatgcatgcaaaaA" + assert_equal(str, @obj.concat("A")) + end + # +(*arg) def test_sum Index: test_na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/sequence/test_na.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_na.rb 5 Apr 2007 23:35:44 -0000 1.5 --- test_na.rb 3 Dec 2007 06:19:12 -0000 1.6 *************** *** 176,179 **** --- 176,241 ---- end + class TestSequenceCommon < Test::Unit::TestCase + + def setup + @obj = Bio::Sequence::NA.new('atgcatgcatgcatgcaaaa') + end + + def test_to_s + assert_equal('atgcatgcatgcatgcaaaa', @obj.to_s) + end + + def test_to_str + assert_equal('atgcatgcatgcatgcaaaa', @obj.to_str) + end + + def test_seq + str = "atgcatgcatgcatgcaaaa" + assert_equal(str, @obj.seq) + end + + # <<(*arg) + def test_push + str = "atgcatgcatgcatgcaaaaa" + assert_equal(str, @obj << "A") + end + + # concat(*arg) + def test_concat + str = "atgcatgcatgcatgcaaaaa" + assert_equal(str, @obj.concat("A")) + end + + # +(*arg) + def test_sum + str = "atgcatgcatgcatgcaaaaatgcatgcatgcatgcaaaa" + assert_equal(str, @obj + @obj) + end + + # window_search(window_size, step_size = 1) + def test_window_search + @obj.window_search(4) do |subseq| + assert_equal(20, @obj.size) + end + end + + #total(hash) + def test_total + hash = {'a' => 1, 'c' => 2, 'g' => 4, 't' => 3} + assert_equal(44.0, @obj.total(hash)) + end + + def test_composition + composition = {"a"=>8, "c"=>4, "g"=>4, "t"=>4} + assert_equal(composition, @obj.composition) + end + + def test_splicing + #(position) + assert_equal("atgcatgc", @obj.splicing("join(1..4, 13..16)")) + end + end + + class TestSequenceNATranslation < Test::Unit::TestCase def setup Index: test_aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/sequence/test_aa.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_aa.rb 14 Apr 2007 05:09:23 -0000 1.4 --- test_aa.rb 3 Dec 2007 06:19:12 -0000 1.5 *************** *** 20,25 **** module Bio - class TestSequenceAANew < Test::Unit::TestCase def test_new str = "RRLEHTFVFL RNFSLMLLRY" --- 20,25 ---- module Bio class TestSequenceAANew < Test::Unit::TestCase + def test_new str = "RRLEHTFVFL RNFSLMLLRY" *************** *** 87,90 **** --- 87,91 ---- assert_equal(ary, @obj.names) end + end From nakao at dev.open-bio.org Mon Dec 3 01:19:14 2007 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Mon, 03 Dec 2007 06:19:14 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/sequence common.rb,1.4,1.5 Message-ID: <200712030619.lB36JEQ7011529@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/sequence In directory dev.open-bio.org:/tmp/cvs-serv11507/lib/bio/sequence Modified Files: common.rb Log Message: * Fixed Bio::Sequence::NA#concat bug reported by Dr. M. Matsuzaki. * Added tests for concat and << for Bio::Sequence::NA and AA. Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence/common.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** common.rb 5 Apr 2007 23:35:41 -0000 1.4 --- common.rb 3 Dec 2007 06:19:12 -0000 1.5 *************** *** 92,99 **** # --- # *Returns*:: current Bio::Sequence::NA/AA object (modified) ! def <<(*arg) super(self.class.new(*arg)) end ! alias concat << # Create a new sequence by adding to an existing sequence. --- 92,102 ---- # --- # *Returns*:: current Bio::Sequence::NA/AA object (modified) ! def concat(*arg) super(self.class.new(*arg)) end ! ! def <<(*arg) ! concat(*arg) ! end # Create a new sequence by adding to an existing sequence. From k at dev.open-bio.org Thu Dec 6 21:00:44 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 07 Dec 2007 02:00:44 +0000 Subject: [BioRuby-cvs] bioruby README,1.16,1.17 Message-ID: <200712070200.lB720iVV000343@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv339 Modified Files: README Log Message: * procedure of the CVS is updated Index: README =================================================================== RCS file: /home/repository/bioruby/bioruby/README,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** README 23 Apr 2007 20:05:34 -0000 1.16 --- README 7 Dec 2007 02:00:42 -0000 1.17 *************** *** 1,5 **** $Id$ ! Copyright (C) 2001-2006 Toshiaki Katayama = BioRuby --- 1,5 ---- $Id$ ! Copyright (C) 2001-2007 Toshiaki Katayama = BioRuby *************** *** 52,58 **** and can be obtained by the following procedure. ! % cvs -d :pserver:anonymous at cvs.bioruby.org:/export/cvs login ! CVS password: (no password is required, just push return) ! % cvs -d :pserver:anonymous at cvs.bioruby.org:/export/cvs co bioruby --- RubyGems --- 52,58 ---- and can be obtained by the following procedure. ! % cvs -d :pserver:cvs at code.open-bio.org:/home/repository/bioruby login ! CVS password: cvs (login with a password 'cvs' for the first time) ! % cvs -d :pserver:cvs at code.open-bio.org:/home/repository/bioruby co bioruby --- RubyGems *************** *** 163,166 **** --- 163,167 ---- require_gem 'bio' + == LICENSE *************** *** 175,176 **** --- 176,178 ---- Current staffs of the BioRuby project can be reached by sending e-mail to . + From ngoto at dev.open-bio.org Tue Dec 11 10:13:35 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 11 Dec 2007 15:13:35 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io/flatfile indexer.rb,1.25,1.26 Message-ID: <200712111513.lBBFDZZi015988@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io/flatfile In directory dev.open-bio.org:/tmp/cvs-serv15968/lib/bio/io/flatfile Modified Files: indexer.rb Log Message: An mistake of variable name in Bio::FlatFileIndex.formatstring2class is corrected. Thanks to Dr. Frank Schwach for reporting the bug. Index: indexer.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile/indexer.rb,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** indexer.rb 5 Apr 2007 23:35:41 -0000 1.25 --- indexer.rb 11 Dec 2007 15:13:32 -0000 1.26 *************** *** 715,719 **** ############################################################## def self.formatstring2class(format_string) ! case format when /genbank/i dbclass = Bio::GenBank --- 715,719 ---- ############################################################## def self.formatstring2class(format_string) ! case format_string when /genbank/i dbclass = Bio::GenBank From k at dev.open-bio.org Wed Dec 12 08:53:28 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Wed, 12 Dec 2007 13:53:28 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io pubmed.rb,1.22,1.23 Message-ID: <200712121353.lBCDrSFH018851@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv18817/lib/bio/io Modified Files: pubmed.rb Log Message: * minor fix (from yonayona bar) Index: pubmed.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/pubmed.rb,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pubmed.rb 28 Nov 2007 06:34:33 -0000 1.22 --- pubmed.rb 12 Dec 2007 13:53:26 -0000 1.23 *************** *** 52,60 **** # # # If you don't know the pubmed ID: ! # Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)").each do |x| # p x # end # ! # Bio::PubMed.search("(genome AND analysis) OR bioinformatics)").each do |x| # p x # end --- 52,60 ---- # # # If you don't know the pubmed ID: ! # Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics").each do |x| # p x # end # ! # Bio::PubMed.search("(genome AND analysis) OR bioinformatics").each do |x| # p x # end *************** *** 274,284 **** opts = {"rettype" => "count"} puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! pubmed.esearch("(genome AND analysis) OR bioinformatics)").each do |x| puts x end --- 274,284 ---- opts = {"rettype" => "count"} puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! pubmed.esearch("(genome AND analysis) OR bioinformatics").each do |x| puts x end *************** *** 298,302 **** puts "--- Search PubMed by Entrez CGI ---" ! pubmed.search("(genome AND analysis) OR bioinformatics)").each do |x| p x end --- 298,302 ---- puts "--- Search PubMed by Entrez CGI ---" ! pubmed.search("(genome AND analysis) OR bioinformatics").each do |x| p x end *************** *** 316,326 **** opts = {"rettype" => "count"} puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)").each do |x| puts x end --- 316,326 ---- opts = {"rettype" => "count"} puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics").each do |x| puts x end *************** *** 340,344 **** puts "--- Search PubMed by Entrez CGI ---" ! Bio::PubMed.search("(genome AND analysis) OR bioinformatics)").each do |x| p x end --- 340,344 ---- puts "--- Search PubMed by Entrez CGI ---" ! Bio::PubMed.search("(genome AND analysis) OR bioinformatics").each do |x| p x end From ngoto at dev.open-bio.org Wed Dec 12 11:06:24 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 12 Dec 2007 16:06:24 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.69,1.70 Message-ID: <200712121606.lBCG6OLR019336@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv19312 Modified Files: ChangeLog Log Message: * lib/bio/db/newick.rb: Changed to be compliant with the Gary Olsen's Interpretation of the "Newick's 8:45" Tree Format Standard. In addtion, RDoc is improved. * test/unit/bio/db/test_newick.rb More tests are added. * ChangeLog ChangeLog in 12/Dec/2007 are added. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ChangeLog 10 Nov 2007 08:28:50 -0000 1.69 --- ChangeLog 12 Dec 2007 16:06:22 -0000 1.70 *************** *** 1,2 **** --- 1,17 ---- + 2007-12-12 Naohisa Goto + + * lib/bio/db/newick.rb: + + Changed to be compliant with the Gary Olsen's Interpretation of + the "Newick's 8:45" Tree Format Standard. + + * test/unit/bio/db/test_newick.rb + + More tests are added. + + * lib/bio/io/flatfile/indexer.rb + + Fixed a misspelling in Bio::FlatFileIndex.formatstring2class. + 2007-11-10 Toshiaki Katayama From ngoto at dev.open-bio.org Wed Dec 12 11:06:24 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 12 Dec 2007 16:06:24 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db newick.rb,1.7,1.8 Message-ID: <200712121606.lBCG6Oxj019339@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv19312/lib/bio/db Modified Files: newick.rb Log Message: * lib/bio/db/newick.rb: Changed to be compliant with the Gary Olsen's Interpretation of the "Newick's 8:45" Tree Format Standard. In addtion, RDoc is improved. * test/unit/bio/db/test_newick.rb More tests are added. * ChangeLog ChangeLog in 12/Dec/2007 are added. Index: newick.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/newick.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** newick.rb 5 Apr 2007 23:35:40 -0000 1.7 --- newick.rb 12 Dec 2007 16:06:22 -0000 1.8 *************** *** 9,13 **** --- 9,23 ---- # $Id$ # + # == Description + # + # This file contains parser and formatter of Newick and NHX. + # + # == References + # + # * http://evolution.genetics.washington.edu/phylip/newick_doc.html + # * http://www.phylosoft.org/forester/NHX.html + # + require 'strscan' require 'bio/tree' *************** *** 19,22 **** --- 29,33 ---- #+++ + # default options DEFAULT_OPTIONS = { :indent => ' ' } *************** *** 33,40 **** private :__get_option # formats leaf def __to_newick_format_leaf(node, edge, options) ! label = get_node_name(node).to_s dist = get_edge_distance_string(edge) --- 44,67 ---- private :__get_option + + # formats Newick label (unquoted_label or quoted_label) + def __to_newick_format_label(str, options) + if __get_option(:parser, options) == :naive then + return str.to_s + end + str = str.to_s + if /([\(\)\,\:\[\]\_\'\x00-\x1f\x7f])/ =~ str then + # quoted_label + return "\'" + str.gsub(/\'/, "\'\'") + "\'" + end + # unquoted_label + return str.gsub(/ /, '_') + end + private :__to_newick_format_label + # formats leaf def __to_newick_format_leaf(node, edge, options) ! label = __to_newick_format_label(get_node_name(node), options) dist = get_edge_distance_string(edge) *************** *** 63,67 **** def __to_newick_format_leaf_NHX(node, edge, options) ! label = get_node_name(node).to_s dist = get_edge_distance_string(edge) --- 90,94 ---- def __to_newick_format_leaf_NHX(node, edge, options) ! label = __to_newick_format_label(get_node_name(node), options) dist = get_edge_distance_string(edge) *************** *** 166,174 **** # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # Description about options. ! # :indent : indent string; set false to disable (default: ' ') ! # :bootstrap_style : :disabled disables bootstrap representations ! # :traditional traditional style ! # :molphy Molphy style (default) def output_newick(options = {}, &block) #:yields: node1, node2 root = @root --- 193,204 ---- # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # ! # Available options: ! # :indent:: ! # indent string; set false to disable (default: ' ') ! # :bootstrap_style:: ! # :disabled disables bootstrap representations. ! # :traditional for traditional style. ! # :molphy for Molphy style (default). def output_newick(options = {}, &block) #:yields: node1, node2 root = @root *************** *** 186,191 **** # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # Description about options. ! # :indent : indent string; set false to disable (default: ' ') def output_nhx(options = {}, &block) #:yields: node1, node2 root = @root --- 216,224 ---- # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # ! # Available options: ! # :indent:: ! # indent string; set false to disable (default: ' ') ! # def output_nhx(options = {}, &block) #:yields: node1, node2 root = @root *************** *** 258,268 **** # _options_ for parsing can be set. # ! # Note: molphy-style bootstrap values may be parsed, even if ! # the options[:bootstrap_style] is set to :traditional or :disabled. ! # Note: By default, if all of the internal node's names are numeric # and there are no NHX and no molphy-style boostrap values, # the names of internal nodes are regarded as bootstrap values. ! # options[:bootstrap_style] = :disabled or :molphy to disable the feature ! # (or at least one NHX tag exists). def initialize(str, options = nil) str = str.sub(/\;(.*)/m, ';') --- 291,316 ---- # _options_ for parsing can be set. # ! # Available options: ! # :bootstrap_style:: ! # :traditional for traditional bootstrap style, ! # :molphy for molphy style, ! # :disabled to ignore bootstrap strings. ! # For details of default actions, please read the notes below. ! # :parser:: ! # :naive for using naive parser, compatible with ! # BioRuby 1.1.0, which ignores quoted strings and ! # do not convert underscores to spaces. ! # ! # Notes for bootstrap style: ! # Molphy-style bootstrap values may always be parsed, even if ! # the options[:bootstrap_style] is set to ! # :traditional or :disabled. ! # ! # Note for default or traditional bootstrap style: ! # By default, if all of the internal node's names are numeric # and there are no NHX and no molphy-style boostrap values, # the names of internal nodes are regarded as bootstrap values. ! # options[:bootstrap_style] = :disabled or :molphy ! # to disable the feature (or at least one NHX tag exists). def initialize(str, options = nil) str = str.sub(/\;(.*)/m, ';') *************** *** 309,354 **** # Parses newick formatted leaf (or internal node) name. ! def __parse_newick_leaf(str, node, edge, options) ! case str ! when /(.*)\:(.*)\[(.*)\]/ ! node.name = $1 ! edge.distance_string = $2 if $2 and !($2.strip.empty?) ! # bracketted string into bstr ! bstr = $3 ! when /(.*)\[(.*)\]/ ! node.name = $1 ! # bracketted string into bstr ! bstr = $2 ! when /(.*)\:(.*)/ ! node.name = $1 ! edge.distance_string = $2 if $2 and !($2.strip.empty?) ! else ! node.name = str end ! # determines NHX or Molphy-style bootstrap ! if bstr and !(bstr.strip.empty?) case __get_option(:original_format, options) when :nhx # regarded as NHX string which might be broken ! __parse_nhx(bstr, node, edge) when :traditional # simply ignored else ! case bstr when /\A\&\&NHX/ # NHX string # force to set NHX mode @options[:original_format] = :nhx ! __parse_nhx(bstr, node, edge) else # Molphy-style boostrap values # let molphy mode if nothing determined @options[:original_format] ||= :molphy node.bootstrap_string = bstr ! end #case bstr end end # returns true true --- 357,410 ---- # Parses newick formatted leaf (or internal node) name. ! def __parse_newick_leaf(leaf_tokens, node, edge, options) ! t = leaf_tokens.shift ! if !t.kind_of?(Symbol) then ! node.name = t ! t = leaf_tokens.shift end ! if t == :':' then ! t = leaf_tokens.shift ! if !t.kind_of?(Symbol) then ! edge.distance_string = t if t and !(t.strip.empty?) ! t = leaf_tokens.shift ! end ! end ! ! if t == :'[' then ! btokens = leaf_tokens case __get_option(:original_format, options) when :nhx # regarded as NHX string which might be broken ! __parse_nhx(btokens, node, edge) when :traditional # simply ignored else ! case btokens[0].to_s.strip ! when '' ! # not automatically determined when /\A\&\&NHX/ # NHX string # force to set NHX mode @options[:original_format] = :nhx ! __parse_nhx(btokens, node, edge) else # Molphy-style boostrap values # let molphy mode if nothing determined @options[:original_format] ||= :molphy + bstr = '' + while t = btokens.shift and t != :']' + bstr.concat t.to_s + end node.bootstrap_string = bstr ! end #case btokens[0] end end + if !btokens and !leaf_tokens.empty? then + # syntax error? + end + node.name ||= '' # compatibility for older BioRuby + # returns true true *************** *** 356,363 **** # Parses NHX (New Hampshire eXtended) string ! def __parse_nhx(bstr, node, edge) ! a = bstr.split(/\:/) ! a.shift if a[0] == '&&NHX' ! a.each do |str| tag, val = str.split(/\=/, 2) case tag --- 412,420 ---- # Parses NHX (New Hampshire eXtended) string ! def __parse_nhx(btokens, node, edge) ! btokens.shift if btokens[0] == '&&NHX' ! btokens.each do |str| ! break if str == :']' ! next if str.kind_of?(Symbol) tag, val = str.split(/\=/, 2) case tag *************** *** 392,395 **** --- 449,543 ---- end + # splits string to tokens + def __parse_newick_tokenize(str, options) + str = str.chop if str[-1..-1] == ';' + # http://evolution.genetics.washington.edu/phylip/newick_doc.html + # quoted_label ==> ' string_of_printing_characters ' + # single quote in quoted_label is '' (two single quotes) + # + + if __get_option(:parser, options) == :naive then + ary = str.split(/([\(\)\,\:\[\]])/) + ary.collect! { |x| x.strip!; x.empty? ? nil : x } + ary.compact! + ary.collect! do |x| + if /\A([\(\)\,\:\[\]])\z/ =~ x then + x.intern + else + x + end + end + return ary + end + + tokens = [] + ss = StringScanner.new(str) + + while !(ss.eos?) + if ss.scan(/\s+/) then + # do nothing + + elsif ss.scan(/[\(\)\,\:\[\]]/) then + # '(' or ')' or ',' or ':' or '[' or ']' + t = ss.matched + tokens.push t.intern + + elsif ss.scan(/\'/) then + # quoted_label + t = '' + while true + if ss.scan(/([^\']*)\'/) then + t.concat ss[1] + if ss.scan(/\'/) then + # single quote in quoted_label + t.concat ss.matched + else + break + end + else + # incomplete quoted_label? + break + end + end #while true + unless ss.match?(/\s*[\(\)\,\:\[\]]/) or ss.match?(/\s*\z/) then + # label continues? (illegal, but try to rescue) + if ss.scan(/[^\(\)\,\:\[\]]+/) then + t.concat ss.matched.lstrip + end + end + tokens.push t + + elsif ss.scan(/[^\(\)\,\:\[\]]+/) then + # unquoted_label + t = ss.matched.strip + t.gsub!(/[\r\n]/, '') + # unquoted underscore should be converted to blank + t.gsub!(/\_/, ' ') + tokens.push t unless t.empty? + + else + # unquoted_label in end of string + t = ss.rest.strip + t.gsub!(/[\r\n]/, '') + # unquoted underscore should be converted to blank + t.gsub!(/\_/, ' ') + tokens.push t unless t.empty? + ss.terminate + + end + end #while !(ss.eos?) + + tokens + end + + # get tokens for a leaf + def __parse_newick_get_tokens_for_leaf(ary) + r = [] + while t = ary[0] and t != :',' and t != :')' and t != :'(' + r.push ary.shift + end + r + end + # Parses newick formatted string. def __parse_newick(str, options = {}) *************** *** 402,409 **** node_stack = [] # preparation of tokens ! str = str.chop if str[-1..-1] == ';' ! ary = str.split(/([\(\)\,])/) ! ary.collect! { |x| x.strip!; x.empty? ? nil : x } ! ary.compact! previous_token = nil # main loop --- 550,554 ---- node_stack = [] # preparation of tokens ! ary = __parse_newick_tokenize(str, options) previous_token = nil # main loop *************** *** 411,416 **** #p token case token ! when ',' ! if previous_token == ',' or previous_token == '(' then # there is a leaf whose name is empty. ary.unshift(token) --- 556,561 ---- #p token case token ! when :',' ! if previous_token == :',' or previous_token == :'(' then # there is a leaf whose name is empty. ary.unshift(token) *************** *** 418,422 **** token = nil end ! when '(' node = Node.new nodes << node --- 563,567 ---- token = nil end ! when :'(' node = Node.new nodes << node *************** *** 424,429 **** node_stack.push(cur_node) cur_node = node ! when ')' ! if previous_token == ',' or previous_token == '(' then # there is a leaf whose name is empty. ary.unshift(token) --- 569,574 ---- node_stack.push(cur_node) cur_node = node ! when :')' ! if previous_token == :',' or previous_token == :'(' then # there is a leaf whose name is empty. ary.unshift(token) *************** *** 432,439 **** else edge = Edge.new ! next_token = ary[0] ! if next_token and next_token != ',' and next_token != ')' then ! __parse_newick_leaf(next_token, cur_node, edge, options) ! ary.shift end parent = node_stack.pop --- 577,584 ---- else edge = Edge.new ! leaf_tokens = __parse_newick_get_tokens_for_leaf(ary) ! token = nil ! if leaf_tokens.size > 0 then ! __parse_newick_leaf(leaf_tokens, cur_node, edge, options) end parent = node_stack.pop *************** *** 445,449 **** leaf = Node.new edge = Edge.new ! __parse_newick_leaf(token, leaf, edge, options) nodes << leaf edges << Bio::Relation.new(cur_node, leaf, edge) --- 590,597 ---- leaf = Node.new edge = Edge.new ! ary.unshift(token) ! leaf_tokens = __parse_newick_get_tokens_for_leaf(ary) ! token = nil ! __parse_newick_leaf(leaf_tokens, leaf, edge, options) nodes << leaf edges << Bio::Relation.new(cur_node, leaf, edge) From ngoto at dev.open-bio.org Wed Dec 12 11:06:24 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 12 Dec 2007 16:06:24 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_newick.rb,1.5,1.6 Message-ID: <200712121606.lBCG6OVv019342@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory dev.open-bio.org:/tmp/cvs-serv19312/test/unit/bio/db Modified Files: test_newick.rb Log Message: * lib/bio/db/newick.rb: Changed to be compliant with the Gary Olsen's Interpretation of the "Newick's 8:45" Tree Format Standard. In addtion, RDoc is improved. * test/unit/bio/db/test_newick.rb More tests are added. * ChangeLog ChangeLog in 12/Dec/2007 are added. Index: test_newick.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_newick.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_newick.rb 5 Apr 2007 23:35:43 -0000 1.5 --- test_newick.rb 12 Dec 2007 16:06:22 -0000 1.6 *************** *** 54,56 **** --- 54,293 ---- end #class TestNewick + + class TestNewick2 < Test::Unit::TestCase + + TREE_STRING = <<-END_OF_TREE_STRING + ( + ( + 'this is test':0.0625, + 'test2 (abc, def)':0.125 + ) 'internal node''s name' : 0.25, + ( + '''':0.03125, + ( + 'ABCAC_HUMAN [ABC superfamily]':0.015625, + hypothetical_protein:0.5 + ) ABC : 0.25 [99] + ) test3 :0.5 + )root; + END_OF_TREE_STRING + + def test_string_tree + newick = Bio::Newick.new(TREE_STRING) + tree = newick.tree + assert_equal('root', tree.root.name) + assert_equal([ + "this is test", + "test2 (abc, def)", + "internal node\'s name", + "\'", + "ABCAC_HUMAN [ABC superfamily]", + "hypothetical protein", + "ABC", + "test3", + "root" + ].sort, + tree.nodes.collect { |x| x.name }.sort) + + assert_equal(tree.children(tree.root).collect { |x| x.name }.sort, + [ "internal node\'s name", "test3" ]) + + node = tree.get_node_by_name('ABC') + assert_equal(99, node.bootstrap) + + assert_equal(1.5625, + tree.distance(tree.get_node_by_name('hypothetical protein'), + tree.get_node_by_name('this is test'))) + end + + end #class TestNewick2 + + class TestNewickPrivate < Test::Unit::TestCase + def setup + @newick = Bio::Newick.new('') # dummy data + end + + def test_parse_newick_leaf + leaf_tokens = [ "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]" ] + node = Bio::Tree::Node.new + edge = Bio::Tree::Edge.new + options = {} + + assert_equal(true, + @newick.instance_eval do + __parse_newick_leaf(leaf_tokens, node, edge, options) + end) + + assert_equal(:nhx, @newick.options[:original_format]) + assert_equal("A:B _C(D,E)F\'s G[H]", node.name) + assert_equal("human", node.scientific_name) + assert_equal("1.1.1.1", node.ec_number) + assert_equal(0.5, edge.distance) + end + + def test_parse_newick_get_tokens_for_leaf + input = [ "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]", + :",", :"(", "bbb", :":", "0.2", :")" ] + leaf_should_be = [ "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]" ] + rest_should_be = [ :",", :"(", "bbb", :":", "0.2", :")" ] + + assert_equal(leaf_should_be, + @newick.instance_eval do + __parse_newick_get_tokens_for_leaf(input) + end) + + assert_equal(rest_should_be, input) + end + + def test_parse_newick_tokenize + examples = + [ + [ + '(a,b);', # input + [ :"(", 'a', :",", 'b', :")" ], # normal parser result + [ :"(", 'a', :",", 'b', :")" ], # naive parser result + ], + [ + # input + "(\'A:B _C(D,E)F\'\'s G[H]\':0.5[&&NHX:S=human:E=1.1.1.1], \n(bbb:0.2, c_d_e[&&NHX:B=100]);", + # normal parser result + [ :"(", "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]", + :",", :"(", "bbb", :":", "0.2", :",", + "c d e", :"[", "&&NHX", :":", "B=100", :"]", :")" ], + # naive parser result + [ :"(", "\'A", :":", "B _C", :"(", "D", :",", "E", + :")", "F\'\'s G", :"[", "H", :"]", "\'", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]", + :",", :"(", "bbb", :":", "0.2", :",", + "c_d_e", :"[", "&&NHX", :":", "B=100", :"]", :")" ] + ] + ] + + examples.each do |a| + # normal parser + assert_equal(a[1], + @newick.instance_eval do + __parse_newick_tokenize(a[0], {}) + end) + + # naive parser + assert_equal(a[2], + @newick.instance_eval do + __parse_newick_tokenize(a[0], { :parser => :naive }) + end) + end + end + end #class TestNewickPrivate + + class TestBioTreeOutputPrivate < Test::Unit::TestCase + + def setup + @tree = Bio::Tree.new + end + + def test_to_newick_format_label + # unquoted_label + assert_equal('ABC', @tree.instance_eval do + __to_newick_format_label('ABC', {}) + end) + + # unquoted_label, replaces blank to underscore + assert_equal('A_B_C', @tree.instance_eval do + __to_newick_format_label('A B C', {}) + end) + + # quoted_label example 1 + assert_equal("\'A B_C\'", @tree.instance_eval do + __to_newick_format_label('A B_C', {}) + end) + + # quoted_label example 2 + assert_equal("\'A(B),C\'", @tree.instance_eval do + __to_newick_format_label('A(B),C', {}) + end) + + # normal formatter + assert_equal("\'A_B_C\'", @tree.instance_eval do + __to_newick_format_label('A_B_C', {}) + end) + # naive formatter + assert_equal("A_B_C", @tree.instance_eval do + __to_newick_format_label('A_B_C', + { :parser => :naive }) + end) + end + + + def test_to_newick_format_leaf + node = Bio::Tree::Node.new('ABC') + edge = Bio::Tree::Edge.new(0.5) + + assert_equal('ABC:0.5', @tree.instance_eval do + __to_newick_format_leaf(node, edge, {}) + end) + + # disable branch length + assert_equal('ABC', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :branch_length_style => + :disabled }) + end) + + node.bootstrap = 98 + # default: molphy style bootstrap + assert_equal('ABC:0.5[98]', @tree.instance_eval do + __to_newick_format_leaf(node, edge, {}) + end) + # force molphy style bootstrap + assert_equal('ABC:0.5[98]', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :bootstrap_style => :molphy }) + end) + # disable bootstrap output + assert_equal('ABC:0.5', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :bootstrap_style => + :disabled }) + end) + + # force traditional bootstrap style + assert_equal('ABC98:0.5', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :bootstrap_style => + :traditional }) + end) + # normally, when traditional style, no node name allowed for the node + node2 = Bio::Tree::Node.new + node2.bootstrap = 98 + assert_equal('98:0.5', @tree.instance_eval do + __to_newick_format_leaf(node2, edge, + { :bootstrap_style => + :traditional }) + end) + + end + + def test_to_newick_format_leaf_NHX + node = Bio::Tree::Node.new('ADH') + edge = Bio::Tree::Edge.new(0.5) + node.bootstrap = 98 + node.ec_number = '1.1.1.1' + node.scientific_name = 'human' + node.taxonomy_id = '9606' + node.events.push :gene_duplication + edge.log_likelihood = 1.5 + edge.width = 3 + + str = 'ADH:0.5[&&NHX:B=98:D=Y:E=1.1.1.1:L=1.5:S=human:T=9606:W=3]' + assert_equal(str, @tree.instance_eval do + __to_newick_format_leaf_NHX(node, edge, {}) + end) + end + + end #class TestBioTreeOutputPrivate + end #module Bio From k at dev.open-bio.org Fri Dec 14 11:04:57 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:04:57 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.86,1.87 Message-ID: <200712141604.lBEG4uVu023020@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv23016/lib Modified Files: bio.rb Log Message: * updated for BioRuby 1.2.0 release Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** bio.rb 16 Jul 2007 12:26:28 -0000 1.86 --- bio.rb 14 Dec 2007 16:04:54 -0000 1.87 *************** *** 2,6 **** # = bio.rb - Loading all BioRuby modules # ! # Copyright:: Copyright (C) 2001-2006 # Toshiaki Katayama # License:: The Ruby License --- 2,6 ---- # = bio.rb - Loading all BioRuby modules # ! # Copyright:: Copyright (C) 2001-2007 # Toshiaki Katayama # License:: The Ruby License *************** *** 11,15 **** module Bio ! BIORUBY_VERSION = [1, 1, 0].extend(Comparable) ### Basic data types --- 11,15 ---- module Bio ! BIORUBY_VERSION = [1, 2, 0].extend(Comparable) ### Basic data types From k at dev.open-bio.org Fri Dec 14 11:09:39 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:09:39 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb,1.22,1.23 Message-ID: <200712141609.lBEG9dln023132@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv23128/lib/bio/appl/blast Modified Files: format0.rb Log Message: * added target_id for compatibility with other format parsers Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** format0.rb 21 Apr 2007 08:58:17 -0000 1.22 --- format0.rb 14 Dec 2007 16:09:36 -0000 1.23 *************** *** 861,867 **** def definition; parse_hitname; @definition; end #-- # Aliases to keep compatibility with Bio::Fasta::Report::Hit. - #alias target_id accession alias target_def definition alias target_len len --- 861,868 ---- def definition; parse_hitname; @definition; end + def target_id; definition[/^\s*(\S+)/]; end + #-- # Aliases to keep compatibility with Bio::Fasta::Report::Hit. alias target_def definition alias target_len len From k at dev.open-bio.org Fri Dec 14 11:12:19 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:12:19 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb,1.23,1.24 Message-ID: <200712141612.lBEGCJK4023154@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv23150/lib/bio/appl/blast Modified Files: format0.rb Log Message: * typo Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** format0.rb 14 Dec 2007 16:09:36 -0000 1.23 --- format0.rb 14 Dec 2007 16:12:17 -0000 1.24 *************** *** 861,865 **** def definition; parse_hitname; @definition; end ! def target_id; definition[/^\s*(\S+)/]; end #-- --- 861,865 ---- def definition; parse_hitname; @definition; end ! def target_id; definition[/^\s*(\S+)/, 1]; end #-- From k at dev.open-bio.org Fri Dec 14 11:15:22 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:15:22 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format8.rb,1.7,1.8 Message-ID: <200712141615.lBEGFMBG023196@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv23172/lib/bio/appl/blast Modified Files: format8.rb Log Message: * fixed a bug that two lines of same target with diffrent queries are come in continuously, the parser failed to create an new Hit object. Index: format8.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format8.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** format8.rb 5 Apr 2007 23:35:39 -0000 1.7 --- format8.rb 14 Dec 2007 16:15:20 -0000 1.8 *************** *** 2,6 **** # = bio/appl/blast/format8.rb - BLAST tab-delimited output (-m 8) parser # ! # Copyright:: Copyright (C) 2002, 2003 Toshiaki Katayama # License:: The Ruby License # --- 2,6 ---- # = bio/appl/blast/format8.rb - BLAST tab-delimited output (-m 8) parser # ! # Copyright:: Copyright (C) 2002, 2003, 2007 Toshiaki Katayama # License:: The Ruby License # *************** *** 23,26 **** --- 23,27 ---- @query_id = @query_def = data[/\S+/] + query_prev = '' target_prev = '' hit_num = 1 *************** *** 30,34 **** ary = line.chomp.split("\t") query_id, target_id, hsp = tab_parse_hsp(ary) ! if target_prev != target_id hit = Hit.new hit.num = hit_num --- 31,35 ---- ary = line.chomp.split("\t") query_id, target_id, hsp = tab_parse_hsp(ary) ! if query_prev != query_id or target_prev != target_id hit = Hit.new hit.num = hit_num *************** *** 42,45 **** --- 43,47 ---- hsp_num += 1 hit.hsps.push(hsp) + query_prev = query_id target_prev = target_id end From k at dev.open-bio.org Fri Dec 14 11:19:56 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:19:56 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg orthology.rb,1.9,1.10 Message-ID: <200712141619.lBEGJuhM023364@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv23360/lib/bio/db/kegg Modified Files: orthology.rb Log Message: * added dblinks_as_hash and genes_as_hash methods for convenience Index: orthology.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/orthology.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** orthology.rb 5 Apr 2007 15:42:59 -0000 1.9 --- orthology.rb 14 Dec 2007 16:19:54 -0000 1.10 *************** *** 68,72 **** end ! # Returns a Hash of Array of a database name and entry IDs in DBLINKS field. def dblinks unless @data['DBLINKS'] --- 68,72 ---- end ! # Returns an Array of a database name and entry IDs in DBLINKS field. def dblinks unless @data['DBLINKS'] *************** *** 76,80 **** end ! # Returns a Hash of Array of the organism ID and entry IDs in GENES field. def genes unless @data['GENES'] --- 76,91 ---- end ! # Returns a Hash of the DB name and an Array of entry IDs in DBLINKS field. ! def dblinks_as_hash ! hash = {} ! dblinks.each do |line| ! name, *list = line.split(/\s+/) ! db = name.downcase.sub(/:/, '') ! hash[db] = list ! end ! return hash ! end ! ! # Returns an Array of the organism ID and entry IDs in GENES field. def genes unless @data['GENES'] *************** *** 83,86 **** --- 94,110 ---- @data['GENES'] end + + # Returns a Hash of the organism ID and an Array of entry IDs in GENES field. + def genes_as_hash + hash = {} + genes.each do |line| + name, *list = line.split(/\s+/) + org = name.downcase.sub(/:/, '') + genes = list.map {|x| x.sub(/\(.*\)/, '')} + #names = list.map {|x| x.scan(/.*\((.*)\)/)} + hash[org] = genes + end + return hash + end end # ORTHOLOGY From k at dev.open-bio.org Fri Dec 14 11:20:40 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:20:40 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg enzyme.rb, 0.11, 0.12 genes.rb, 0.25, 0.26 glycan.rb, 1.6, 1.7 Message-ID: <200712141620.lBEGKe9l023386@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv23382/lib/bio/db/kegg Modified Files: enzyme.rb genes.rb glycan.rb Log Message: * ORTHOLOG field is fixed to ORTHOLOGY Index: genes.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/genes.rb,v retrieving revision 0.25 retrieving revision 0.26 diff -C2 -d -r0.25 -r0.26 *** genes.rb 5 Apr 2007 23:35:41 -0000 0.25 --- genes.rb 14 Dec 2007 16:20:38 -0000 0.26 *************** *** 138,142 **** def orthologs ! lines_fetch('ORTHOLOG') end --- 138,142 ---- def orthologs ! lines_fetch('ORTHOLOGY') end Index: enzyme.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/enzyme.rb,v retrieving revision 0.11 retrieving revision 0.12 diff -C2 -d -r0.11 -r0.12 *** enzyme.rb 5 Apr 2007 23:35:41 -0000 0.11 --- enzyme.rb 14 Dec 2007 16:20:38 -0000 0.12 *************** *** 107,113 **** end ! # ORTHOLOG def orthologs ! lines_fetch('ORTHOLOG') end --- 107,113 ---- end ! # ORTHOLOGY def orthologs ! lines_fetch('ORTHOLOGY') end Index: glycan.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/glycan.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** glycan.rb 28 Jun 2007 11:27:24 -0000 1.6 --- glycan.rb 14 Dec 2007 16:20:38 -0000 1.7 *************** *** 95,104 **** end ! # ORTHOLOG def orthologs ! unless @data['ORTHOLOG'] ! @data['ORTHOLOG'] = lines_fetch('ORTHOLOG') end ! @data['ORTHOLOG'] end --- 95,104 ---- end ! # ORTHOLOGY def orthologs ! unless @data['ORTHOLOGY'] ! @data['ORTHOLOGY'] = lines_fetch('ORTHOLOGY') end ! @data['ORTHOLOGY'] end From k at dev.open-bio.org Fri Dec 14 11:22:26 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:22:26 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.70,1.71 Message-ID: <200712141622.lBEGMQCP023447@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv23421 Modified Files: ChangeLog Log Message: * preparation for BioRuby 1.2 release Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** ChangeLog 12 Dec 2007 16:06:22 -0000 1.70 --- ChangeLog 14 Dec 2007 16:22:24 -0000 1.71 *************** *** 1,2 **** --- 1,21 ---- + 2007-12-15 Toshiaki Katayama + + * BioRuby 1.2.0 released + + * BioRuby shell is improved + * file save functionality is fixed + * deprecated require_gem is changed to gem to suppress warnings + * deprecated end_form_tag is rewrited to suppress warnings + * images for Rails shell are separated to the bioruby directory + * spinner is shown during the evaluation + * background image in the textarea is removed for the visibility + * Bio::Blast is fixed to parse -m 8 formatted result correctly + * Bio::PubMed is rewrited to enhance its functionality + * e.g. 'rettype' => 'count' and 'retmode' => 'xml' are available + * Bio::FlatFile is improved to accept recent MEDLINE format + * Bio::KEGG::COMPOUND is enhanced to utilize REMARK field + * Bio::KEGG::API is fixed to skip filter when the value is Fixnum + * A number of minor bug fixes + 2007-12-12 Naohisa Goto *************** *** 14,18 **** Fixed a misspelling in Bio::FlatFileIndex.formatstring2class. ! 2007-11-10 Toshiaki Katayama * lib/bio/io/pubmed.rb: --- 33,37 ---- Fixed a misspelling in Bio::FlatFileIndex.formatstring2class. ! 2007-11-28 Toshiaki Katayama * lib/bio/io/pubmed.rb: *************** *** 21,24 **** --- 40,54 ---- strongly recommended). + efetch method is enhanced to accept any PubMed search options + as a hash (to retrieve in XML format etc.) + + Changed to wait 3 seconds among each access by default to be + compliant with the NCBI terms (Make no more than one request + every 3 seconds). + + All Bio::PubMed.* class methods are changed to instance methods + (interface as the class methods are remained for the backward + compatibility). + 2007-07-19 Toshiaki Katayama From k at dev.open-bio.org Fri Dec 14 11:23:00 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:23:00 +0000 Subject: [BioRuby-cvs] bioruby gemspec.rb,1.8,1.9 Message-ID: <200712141623.lBEGN0iS023484@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv23480 Modified Files: gemspec.rb Log Message: * prepare for BioRuby 1.2 release Index: gemspec.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/gemspec.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gemspec.rb 24 Dec 2006 14:55:53 -0000 1.8 --- gemspec.rb 14 Dec 2007 16:22:58 -0000 1.9 *************** *** 3,7 **** spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.1.0" s.author = "BioRuby project" --- 3,7 ---- spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.2.0" s.author = "BioRuby project" From ngoto at dev.open-bio.org Tue Dec 18 08:48:45 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 18 Dec 2007 13:48:45 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb chain.rb, 1.8, 1.9 model.rb, 1.9, 1.10 pdb.rb, 1.23, 1.24 residue.rb, 1.13, 1.14 Message-ID: <200712181348.lBIDmj6R011143@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv11123/lib/bio/db/pdb Modified Files: chain.rb model.rb pdb.rb residue.rb Log Message: * lib/bio/db/pdb/pdb.rb Bio::PDB#inspect is added to prevent memory exhaust problem. ([BioRuby] Parse big PDB use up all memory) * lib/bio/db/pdb/model.rb Added Bio::PDB::Model#inspect. * lib/bio/db/pdb/chain.rb Added Bio::PDB::Chain#inspect. * lib/bio/db/pdb/residue.rb Added Bio::PDB::Residue#inspect. This also affects Bio::PDB::Heterogen#inspect. Index: residue.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/residue.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** residue.rb 23 Apr 2007 16:03:25 -0000 1.13 --- residue.rb 18 Dec 2007 13:48:42 -0000 1.14 *************** *** 130,133 **** --- 130,139 ---- end + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} resName=#{resName.inspect} id=#{residue_id.inspect} chain.id=#{(chain ? chain.id : nil).inspect} resSeq=#{resSeq.inspect} iCode=#{iCode.inspect} atoms.size=#{atoms.size}>" + end + # Always returns false. # Index: model.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/model.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** model.rb 5 Apr 2007 23:35:41 -0000 1.9 --- model.rb 18 Dec 2007 13:48:42 -0000 1.10 *************** *** 135,138 **** --- 135,144 ---- return string end + + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} serial=#{serial.inspect} chains.size=#{chains.size}>" + end end #class Model Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** pdb.rb 10 Jul 2007 10:44:46 -0000 1.23 --- pdb.rb 18 Dec 2007 13:48:42 -0000 1.24 *************** *** 1877,1880 **** --- 1877,1886 ---- end + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} entry_id=#{entry_id.inspect}>" + end + end #class PDB Index: chain.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/chain.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** chain.rb 5 Apr 2007 23:35:41 -0000 1.8 --- chain.rb 18 Dec 2007 13:48:42 -0000 1.9 *************** *** 173,176 **** --- 173,182 ---- end + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} id=#{chain_id.inspect} model.serial=#{(model ? model.serial : nil).inspect} residues.size=#{residues.size} heterogens.size=#{heterogens.size} aaseq=#{aaseq.inspect}>" + end + # gets an amino acid sequence of this chain from ATOM records def aaseq From ngoto at dev.open-bio.org Tue Dec 18 08:54:58 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 18 Dec 2007 13:54:58 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.71,1.72 Message-ID: <200712181354.lBIDsw3C011195@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv11175 Modified Files: ChangeLog Log Message: ChangeLog added for changes of lib/bio/db/pdb/pdb.rb and so on. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** ChangeLog 14 Dec 2007 16:22:24 -0000 1.71 --- ChangeLog 18 Dec 2007 13:54:56 -0000 1.72 *************** *** 1,2 **** --- 1,22 ---- + 2007-12-18 Naohisa Goto + + * lib/bio/db/pdb/pdb.rb + + Bio::PDB#inspect is added to prevent memory exhaust problem. + ([BioRuby] Parse big PDB use up all memory) + + * lib/bio/db/pdb/model.rb + + Bio::PDB::Model#inspect is added. + + * lib/bio/db/pdb/chain.rb + + Bio::PDB::Chain#inspect is added. + + * lib/bio/db/pdb/residue.rb + + Bio::PDB::Residue#inspect is added. + This also affects Bio::PDB::Heterogen#inspect. + 2007-12-15 Toshiaki Katayama From k at dev.open-bio.org Fri Dec 21 00:12:44 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 21 Dec 2007 05:12:44 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db medline.rb,1.16,1.17 Message-ID: <200712210512.lBL5Ci1l022445@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv22441 Modified Files: medline.rb Log Message: * added doi and pii methods to extract DOI and PII number from AID field Index: medline.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/medline.rb,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** medline.rb 5 Apr 2007 23:35:40 -0000 1.16 --- medline.rb 21 Dec 2007 05:12:41 -0000 1.17 *************** *** 26,30 **** class MEDLINE < NCBIDB - # def initialize(entry) @pubmed = Hash.new('') --- 26,29 ---- *************** *** 38,41 **** --- 37,41 ---- end end + attr_reader :pubmed *************** *** 188,197 **** alias affiliations ad - - ### Other MEDLINE tags - # AID - Article Identifier # Article ID values may include the pii (controlled publisher identifier) # or doi (Digital Object Identifier). # CI - Copyright Information --- 188,203 ---- alias affiliations ad # AID - Article Identifier # Article ID values may include the pii (controlled publisher identifier) # or doi (Digital Object Identifier). + def doi + @pubmed['AID'][/(\S+) \[doi\]/, 1] + end + + def pii + @pubmed['AID'][/(\S+) \[pii\]/, 1] + end + + ### Other MEDLINE tags # CI - Copyright Information From k at dev.open-bio.org Fri Dec 21 00:14:46 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 21 Dec 2007 05:14:46 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.72,1.73 Message-ID: <200712210514.lBL5EkTl022483@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv22479 Modified Files: ChangeLog Log Message: * In Bio::MEDLINE, doi and pii methods are added to extract DOI and PII number from AID field Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** ChangeLog 18 Dec 2007 13:54:56 -0000 1.72 --- ChangeLog 21 Dec 2007 05:14:44 -0000 1.73 *************** *** 1,2 **** --- 1,8 ---- + 2007-12-21 Toshiaki Katayama + + * lib/bio/db/medline.rb + + Added doi and pii methods to extract DOI and PII number from AID field + 2007-12-18 Naohisa Goto From ngoto at dev.open-bio.org Wed Dec 26 08:55:44 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 13:55:44 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_alignment.rb,1.11,1.12 Message-ID: <200712261355.lBQDthqC017482@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory dev.open-bio.org:/tmp/cvs-serv17413/test/unit/bio Modified Files: test_alignment.rb Log Message: Ruby 1.9 compliant: The last comma in Array.[] is no longer allowed. (For example, class A < Array; end; A[ 1, 2, 3, ] raises error in Ruby 1.9.) Index: test_alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_alignment.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_alignment.rb 5 Apr 2007 23:35:42 -0000 1.11 --- test_alignment.rb 26 Dec 2007 13:55:40 -0000 1.12 *************** *** 427,431 **** Sequence::AA.new('MHTL'), Sequence::AA.new('MQNV'), ! Sequence::AA.new('MKKW'), ] assert_equal('*:. ', a.match_line) --- 427,431 ---- Sequence::AA.new('MHTL'), Sequence::AA.new('MQNV'), ! Sequence::AA.new('MKKW') ] assert_equal('*:. ', a.match_line) From ngoto at dev.open-bio.org Wed Dec 26 09:08:04 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 14:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.23,1.24 Message-ID: <200712261408.lBQE841o017751@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv17518/lib/bio Modified Files: alignment.rb Log Message: * Ruby 1.9 compliant: in EnumerableExtension#each_window and OriginalAlignment#index methods, local variable names outside the iterator loops are changed not to be shadowed by iterator variables. * Warning messages for uninitialized instance variables of @gap_regexp, @gap_char, @missing_char, and @seqclass are suppressed. Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** alignment.rb 16 Jul 2007 12:21:39 -0000 1.23 --- alignment.rb 26 Dec 2007 14:08:02 -0000 1.24 *************** *** 94,98 **** # Returns regular expression for checking gap. def gap_regexp ! @gap_regexp or GAP_REGEXP end # regular expression for checking gap --- 94,98 ---- # Returns regular expression for checking gap. def gap_regexp ! ((defined? @gap_regexp) ? @gap_regexp : nil) or GAP_REGEXP end # regular expression for checking gap *************** *** 101,105 **** # Gap character. def gap_char ! @gap_char or GAP_CHAR end # gap character --- 101,105 ---- # Gap character. def gap_char ! ((defined? @gap_char) ? @gap_char : nil) or GAP_CHAR end # gap character *************** *** 108,112 **** # Character if the site is missing or unknown. def missing_char ! @missing_char or MISSING_CHAR end # Character if the site is missing or unknown. --- 108,112 ---- # Character if the site is missing or unknown. def missing_char ! ((defined? @missing_char) ? @missing_char : nil) or MISSING_CHAR end # Character if the site is missing or unknown. *************** *** 119,123 **** # If no sequences are found, returns nil. def seqclass ! @seqclass or String end --- 119,123 ---- # If no sequences are found, returns nil. def seqclass ! ((defined? @seqclass) ? @seqclass : nil) or String end *************** *** 348,352 **** # If no sequences are found, returns nil. def seqclass ! if @seqclass then @seqclass else --- 348,352 ---- # If no sequences are found, returns nil. def seqclass ! if (defined? @seqclass) and @seqclass then @seqclass else *************** *** 482,490 **** return nil if window_size < 0 if step_size >= 0 then ! i = nil 0.step(alignment_length - window_size, step_size) do |i| yield alignment_window(i, window_size) end ! alignment_window((i+window_size)..-1) else i = alignment_length - window_size --- 482,491 ---- return nil if window_size < 0 if step_size >= 0 then ! last_step = nil 0.step(alignment_length - window_size, step_size) do |i| yield alignment_window(i, window_size) + last_step = i end ! alignment_window((last_step + window_size)..-1) else i = alignment_length - window_size *************** *** 1821,1826 **** def index(seq) #(Hash-like) ! k = nil self.each_pair do |k, s| if s.class == seq.class then r = (s == seq) --- 1822,1828 ---- def index(seq) #(Hash-like) ! last_key = nil self.each_pair do |k, s| + last_key = k if s.class == seq.class then r = (s == seq) *************** *** 1830,1834 **** break if r end ! k end --- 1832,1836 ---- break if r end ! last_key end From ngoto at dev.open-bio.org Wed Dec 26 09:14:43 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 14:14:43 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.73,1.74 Message-ID: <200712261414.lBQEEhAF017908@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv17878 Modified Files: ChangeLog Log Message: changelog for changes of lib/bio/alignment.rb and test/unit/bio/test_alignment.rb are added. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** ChangeLog 21 Dec 2007 05:14:44 -0000 1.73 --- ChangeLog 26 Dec 2007 14:14:41 -0000 1.74 *************** *** 1,2 **** --- 1,23 ---- + 2007-12-26 Naohisa Goto + + * lib/bio/alignment.rb + + Ruby 1.9 compliant: in EnumerableExtension#each_window and + OriginalAlignment#index methods, local variable names outside the + iterator loops are changed not to be shadowed by iterator + variables. + + Warning messages for uninitialized instance variables of + @gap_regexp, @gap_char, @missing_char, and @seqclass + are suppressed. + + * test/unit/bio/test_alignment.rb + + Ruby 1.9 compliant: Ruby 1.9 compliant: The last comma in Array.[] + is no longer allowed. (For example, + class A < Array; end; A[ 1, 2, 3, ] + raises syntax error in Ruby 1.9.) + + 2007-12-21 Toshiaki Katayama From ngoto at dev.open-bio.org Wed Dec 26 09:16:27 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 14:16:27 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.74,1.75 Message-ID: <200712261416.lBQEGRax017972@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv17926 Modified Files: ChangeLog Log Message: removed a void line in ChangeLog of 2007-12-26 Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** ChangeLog 26 Dec 2007 14:14:41 -0000 1.74 --- ChangeLog 26 Dec 2007 14:16:25 -0000 1.75 *************** *** 19,23 **** raises syntax error in Ruby 1.9.) - 2007-12-21 Toshiaki Katayama --- 19,22 ---- From ngoto at dev.open-bio.org Thu Dec 27 12:28:59 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Dec 2007 17:28:59 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb, 1.24, 1.25 wublast.rb, 1.11, 1.12 Message-ID: <200712271728.lBRHSxCt027589@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv27557/lib/bio/appl/blast Modified Files: format0.rb wublast.rb Log Message: Fixed parse error for NCBI BLAST 2.2.17. Added Default::Report#references and Default::Report::HSP#stat_method methods. Index: wublast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/wublast.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wublast.rb 21 Apr 2007 08:58:17 -0000 1.11 --- wublast.rb 27 Dec 2007 17:28:57 -0000 1.12 *************** *** 71,78 **** def format0_split_headers(data) @f0header = data.shift while r = data.first case r when /^Reference\: / ! @f0reference = data.shift when /^Copyright / @f0copyright = data.shift --- 71,79 ---- def format0_split_headers(data) @f0header = data.shift + @f0references = [] while r = data.first case r when /^Reference\: / ! @f0references.push data.shift when /^Copyright / @f0copyright = data.shift Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** format0.rb 14 Dec 2007 16:12:17 -0000 1.24 --- format0.rb 27 Dec 2007 17:28:57 -0000 1.25 *************** *** 224,232 **** # Returns the bibliography reference of the BLAST software. def reference ! unless defined?(@reference) ! @reference = @f0reference.to_s.gsub(/\s+/, ' ').strip end #unless ! @reference end --- 224,243 ---- # Returns the bibliography reference of the BLAST software. + # Note that this method shows only the first reference. + # When you want to get additional references, + # you can use references method. def reference ! references[0] ! end ! ! # Returns the bibliography references of the BLAST software. ! # Returns an array of strings. ! def references ! unless defined?(@references) ! @references = @f0references.collect do |x| ! x.to_s.gsub(/\s+/, ' ').strip ! end end #unless ! @references end *************** *** 277,281 **** def format0_split_headers(data) @f0header = data.shift ! @f0reference = data.shift @f0query = data.shift @f0database = data.shift --- 288,295 ---- def format0_split_headers(data) @f0header = data.shift ! @f0references = [] ! while data[0] and /\AQuery\=/ !~ data[0] ! @f0references.push data.shift ! end @f0query = data.shift @f0database = data.shift *************** *** 1021,1024 **** --- 1035,1042 ---- pv = '1' + pv if pv[0] == ?e @pvalue = pv.to_f + elsif sc.skip(/Method\:\s*(.+)/) then + # signature of composition-based statistics method + # for example, "Method: Composition-based stats." + @stat_method = sc[1] else raise ScanError *************** *** 1090,1093 **** --- 1108,1118 ---- method_after_parse_score :hit_strand + # statistical method for calculating evalue and/or score + # (nil or a string) + # (note that composition-based statistics for blastp or tblastn + # were enabled by default after NCBI BLAST 2.2.17) + attr_reader :stat_method if false #dummy + method_after_parse_score :stat_method + # Parses alignments. def parse_alignment From ngoto at dev.open-bio.org Thu Dec 27 12:28:59 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Dec 2007 17:28:59 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.75,1.76 Message-ID: <200712271728.lBRHSxkH027586@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv27557 Modified Files: ChangeLog Log Message: Fixed parse error for NCBI BLAST 2.2.17. Added Default::Report#references and Default::Report::HSP#stat_method methods. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** ChangeLog 26 Dec 2007 14:16:25 -0000 1.75 --- ChangeLog 27 Dec 2007 17:28:57 -0000 1.76 *************** *** 1,2 **** --- 1,17 ---- + 2007-12-28 Naohisa Goto + + * lib/bio/appl/blast/report/format0.rb + + Fixed parse error when compisition-based statistics were enabled. + In addition, Bio::Blast::Default::Report#references and + Bio::Blast::Default::Report::HSP#stat_method methods are added. + In NCBI BLAST 2.2.17, default option of composition-based + statistics for blastp or tblastn are changed to be enabled + by default. + + * lib/bio/appl/blast/report/wublast.rb + + Changed to follow the above changes in format0.rb. + 2007-12-26 Naohisa Goto From ngoto at dev.open-bio.org Thu Dec 27 12:36:04 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Dec 2007 17:36:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/sequence common.rb,1.5,1.6 Message-ID: <200712271736.lBRHa4FS027742@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/sequence In directory dev.open-bio.org:/tmp/cvs-serv27687/lib/bio/sequence Modified Files: common.rb Log Message: (ruby 1.9 comliant) in window_search method, changed to avoid shadowing of local variable by loop local variable. Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence/common.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** common.rb 3 Dec 2007 06:19:12 -0000 1.5 --- common.rb 27 Dec 2007 17:36:02 -0000 1.6 *************** *** 178,186 **** # *Returns*:: new Bio::Sequence::NA/AA object def window_search(window_size, step_size = 1) ! i = 0 0.step(self.length - window_size, step_size) do |i| yield self[i, window_size] end ! return self[i + window_size .. -1] end --- 178,187 ---- # *Returns*:: new Bio::Sequence::NA/AA object def window_search(window_size, step_size = 1) ! last_step = 0 0.step(self.length - window_size, step_size) do |i| yield self[i, window_size] + last_step = i end ! return self[last_step + window_size .. -1] end From ngoto at dev.open-bio.org Fri Dec 28 08:35:33 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 13:35:33 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.24,1.25 Message-ID: <200712281335.lBSDZXLJ032744@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv32724/lib/bio/db/pdb Modified Files: pdb.rb Log Message: Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly." error. Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** pdb.rb 18 Dec 2007 13:48:42 -0000 1.24 --- pdb.rb 28 Dec 2007 13:35:30 -0000 1.25 *************** *** 234,238 **** klass.module_eval { symbolary.each do |x| ! define_method(x) { do_parse; super } end } --- 234,238 ---- klass.module_eval { symbolary.each do |x| ! define_method(x) { do_parse; super() } end } *************** *** 268,272 **** klass.module_eval { define_method(:initialize_from_string) { |str| ! r = super do_parse r --- 268,272 ---- klass.module_eval { define_method(:initialize_from_string) { |str| ! r = super(str) do_parse r From ngoto at dev.open-bio.org Fri Dec 28 08:36:10 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 13:36:10 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.76,1.77 Message-ID: <200712281336.lBSDaAOw000304@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv32752 Modified Files: ChangeLog Log Message: changes of lib/bio/sequence/common.rb and lib/bio/db/pdb/pdb.rb by ngoto Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** ChangeLog 27 Dec 2007 17:28:57 -0000 1.76 --- ChangeLog 28 Dec 2007 13:36:08 -0000 1.77 *************** *** 14,17 **** --- 14,29 ---- Changed to follow the above changes in format0.rb. + * lib/bio/sequence/common.rb + + Ruby 1.9 compliant: in window_search method, a local variable name + outside the iterator loop is changed not to be shadowed by the + iterator variable. + + * lib/bio/db/pdb/pdb.rb + + Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit + argument passing of super from method defined by define_method() + is not supported. Specify all arguments explicitly." error. + 2007-12-26 Naohisa Goto From ngoto at dev.open-bio.org Fri Dec 28 09:31:08 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 14:31:08 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.77,1.78 Message-ID: <200712281431.lBSEV8v7000425@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv400 Modified Files: ChangeLog Log Message: Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and Bio::PDB::Record.create_definition_hash (Note: they should only be internally used by PDB parser and users should not call them) are changed to follow the change of Module#constants which returns an array of Symbol instead of String. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** ChangeLog 28 Dec 2007 13:36:08 -0000 1.77 --- ChangeLog 28 Dec 2007 14:31:06 -0000 1.78 *************** *** 26,29 **** --- 26,35 ---- is not supported. Specify all arguments explicitly." error. + Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and + Bio::PDB::Record.create_definition_hash (Note: they should only + be internally used by PDB parser and users should not call them) + are changed to follow the change of Module#constants which + returns an array of Symbol instead of String. + 2007-12-26 Naohisa Goto From ngoto at dev.open-bio.org Fri Dec 28 09:31:08 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 14:31:08 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.25,1.26 Message-ID: <200712281431.lBSEV85x000422@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv400/lib/bio/db/pdb Modified Files: pdb.rb Log Message: Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and Bio::PDB::Record.create_definition_hash (Note: they should only be internally used by PDB parser and users should not call them) are changed to follow the change of Module#constants which returns an array of Symbol instead of String. Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** pdb.rb 28 Dec 2007 13:35:30 -0000 1.25 --- pdb.rb 28 Dec 2007 14:31:06 -0000 1.26 *************** *** 438,442 **** hash = {} constants.each do |x| ! hash[x] = const_get(x) if /\A[A-Z][A-Z0-9]+\z/ =~ x end if x = const_get(:Default) then --- 438,443 ---- hash = {} constants.each do |x| ! x = x.intern # keep compatibility both Ruby 1.8 and 1.9 ! hash[x] = const_get(x) if /\A[A-Z][A-Z0-9]+\z/ =~ x.to_s end if x = const_get(:Default) then *************** *** 1381,1385 **** def_rec([ 2, 1, Pdb_Integer, :serial ]) # dummy field (always 0) ! Definition['END'] = End # Basically just look up the class in Definition hash --- 1382,1386 ---- def_rec([ 2, 1, Pdb_Integer, :serial ]) # dummy field (always 0) ! Definition['END'.intern] = End # Basically just look up the class in Definition hash *************** *** 1387,1397 **** def self.get_record_class(str) t = fetch_record_name(str) if d = Definition[t] then return d end case t ! when 'JRNL' d = Jrnl::Definition[str[12..15].to_s.strip] ! when 'REMARK' case str[7..9].to_i when 1 --- 1388,1399 ---- def self.get_record_class(str) t = fetch_record_name(str) + t = t.intern unless t.empty? if d = Definition[t] then return d end case t ! when :JRNL d = Jrnl::Definition[str[12..15].to_s.strip] ! when :REMARK case str[7..9].to_i when 1 *************** *** 1418,1428 **** --- 1420,1438 ---- Coordinate_fileds = { 'MODEL' => true, + :MODEL => true, 'ENDMDL' => true, + :ENDMDL => true, 'ATOM' => true, + :ATOM => true, 'HETATM' => true, + :HETATM => true, 'SIGATM' => true, + :SIGATM => true, 'SIGUIJ' => true, + :SIGUIJ => true, 'ANISOU' => true, + :ANISOU => true, 'TER' => true, + :TER => true, } From ngoto at dev.open-bio.org Fri Dec 28 09:43:46 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 14:43:46 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.26,1.27 Message-ID: <200712281443.lBSEhkLR000523@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv503/lib/bio/db/pdb Modified Files: pdb.rb Log Message: changes made from 1.25 to 1.26 were still incomplete and additional changes are added Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** pdb.rb 28 Dec 2007 14:31:06 -0000 1.26 --- pdb.rb 28 Dec 2007 14:43:44 -0000 1.27 *************** *** 1394,1402 **** case t when :JRNL ! d = Jrnl::Definition[str[12..15].to_s.strip] when :REMARK case str[7..9].to_i when 1 ! d = Remark1::Definition[str[12..15].to_s.strip] when 2 if str[28..37] == 'ANGSTROMS.' then --- 1394,1406 ---- case t when :JRNL ! ts = str[12..15].to_s.strip ! ts = ts.intern unless ts.empty? ! d = Jrnl::Definition[ts] when :REMARK case str[7..9].to_i when 1 ! ts = str[12..15].to_s.strip ! ts = ts.intern unless ts.empty? ! d = Remark1::Definition[ts] when 2 if str[28..37] == 'ANGSTROMS.' then From k at dev.open-bio.org Sat Dec 29 14:19:09 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Sat, 29 Dec 2007 19:19:09 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.87,1.88 Message-ID: <200712291919.lBTJJ9ZT007982@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv7972/lib Modified Files: bio.rb Log Message: * preparation for BioRuby 1.2.1 release Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** bio.rb 14 Dec 2007 16:04:54 -0000 1.87 --- bio.rb 29 Dec 2007 19:19:07 -0000 1.88 *************** *** 11,15 **** module Bio ! BIORUBY_VERSION = [1, 2, 0].extend(Comparable) ### Basic data types --- 11,15 ---- module Bio ! BIORUBY_VERSION = [1, 2, 1].extend(Comparable) ### Basic data types From k at dev.open-bio.org Sat Dec 29 14:19:09 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Sat, 29 Dec 2007 19:19:09 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.78,1.79 gemspec.rb,1.9,1.10 Message-ID: <200712291919.lBTJJ9Yl007978@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv7972 Modified Files: ChangeLog gemspec.rb Log Message: * preparation for BioRuby 1.2.1 release Index: gemspec.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/gemspec.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gemspec.rb 14 Dec 2007 16:22:58 -0000 1.9 --- gemspec.rb 29 Dec 2007 19:19:06 -0000 1.10 *************** *** 3,7 **** spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.2.0" s.author = "BioRuby project" --- 3,7 ---- spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.2.1" s.author = "BioRuby project" Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** ChangeLog 28 Dec 2007 14:31:06 -0000 1.78 --- ChangeLog 29 Dec 2007 19:19:06 -0000 1.79 *************** *** 1,34 **** 2007-12-28 Naohisa Goto * lib/bio/appl/blast/report/format0.rb ! Fixed parse error when compisition-based statistics were enabled. ! In addition, Bio::Blast::Default::Report#references and ! Bio::Blast::Default::Report::HSP#stat_method methods are added. ! In NCBI BLAST 2.2.17, default option of composition-based ! statistics for blastp or tblastn are changed to be enabled ! by default. * lib/bio/appl/blast/report/wublast.rb ! Changed to follow the above changes in format0.rb. * lib/bio/sequence/common.rb ! Ruby 1.9 compliant: in window_search method, a local variable name ! outside the iterator loop is changed not to be shadowed by the ! iterator variable. * lib/bio/db/pdb/pdb.rb ! Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit ! argument passing of super from method defined by define_method() ! is not supported. Specify all arguments explicitly." error. ! Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and ! Bio::PDB::Record.create_definition_hash (Note: they should only ! be internally used by PDB parser and users should not call them) ! are changed to follow the change of Module#constants which ! returns an array of Symbol instead of String. 2007-12-26 Naohisa Goto --- 1,40 ---- + 2007-12-30 Toshiaki Katayama + + * BioRuby 1.2.1 released + + This version is not Ruby 1.9 (released few days ago) compliant yet. + 2007-12-28 Naohisa Goto * lib/bio/appl/blast/report/format0.rb ! Fixed parse error when compisition-based statistics were enabled. ! In addition, Bio::Blast::Default::Report#references and ! Bio::Blast::Default::Report::HSP#stat_method methods are added. ! In NCBI BLAST 2.2.17, default option of composition-based ! statistics for blastp or tblastn are changed to be enabled ! by default. * lib/bio/appl/blast/report/wublast.rb ! Changed to follow the above changes in format0.rb. * lib/bio/sequence/common.rb ! Ruby 1.9 compliant: in window_search method, a local variable name ! outside the iterator loop is changed not to be shadowed by the ! iterator variable. * lib/bio/db/pdb/pdb.rb ! Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit ! argument passing of super from method defined by define_method() ! is not supported. Specify all arguments explicitly." error. ! Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and ! Bio::PDB::Record.create_definition_hash (Note: they should only ! be internally used by PDB parser and users should not call them) ! are changed to follow the change of Module#constants which ! returns an array of Symbol instead of String. 2007-12-26 Naohisa Goto *************** *** 62,80 **** * lib/bio/db/pdb/pdb.rb ! Bio::PDB#inspect is added to prevent memory exhaust problem. ! ([BioRuby] Parse big PDB use up all memory) * lib/bio/db/pdb/model.rb ! Bio::PDB::Model#inspect is added. * lib/bio/db/pdb/chain.rb ! Bio::PDB::Chain#inspect is added. * lib/bio/db/pdb/residue.rb ! Bio::PDB::Residue#inspect is added. ! This also affects Bio::PDB::Heterogen#inspect. 2007-12-15 Toshiaki Katayama --- 68,86 ---- * lib/bio/db/pdb/pdb.rb ! Bio::PDB#inspect is added to prevent memory exhaust problem. ! ([BioRuby] Parse big PDB use up all memory) * lib/bio/db/pdb/model.rb ! Bio::PDB::Model#inspect is added. * lib/bio/db/pdb/chain.rb ! Bio::PDB::Chain#inspect is added. * lib/bio/db/pdb/residue.rb ! Bio::PDB::Residue#inspect is added. ! This also affects Bio::PDB::Heterogen#inspect. 2007-12-15 Toshiaki Katayama From nakao at dev.open-bio.org Mon Dec 3 06:19:14 2007 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Mon, 03 Dec 2007 06:19:14 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/sequence test_aa.rb, 1.4, 1.5 test_common.rb, 1.4, 1.5 test_na.rb, 1.5, 1.6 Message-ID: <200712030619.lB36JEY8011532@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/sequence In directory dev.open-bio.org:/tmp/cvs-serv11507/test/unit/bio/sequence Modified Files: test_aa.rb test_common.rb test_na.rb Log Message: * Fixed Bio::Sequence::NA#concat bug reported by Dr. M. Matsuzaki. * Added tests for concat and << for Bio::Sequence::NA and AA. Index: test_common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/sequence/test_common.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_common.rb 5 Apr 2007 23:35:44 -0000 1.4 --- test_common.rb 3 Dec 2007 06:19:12 -0000 1.5 *************** *** 32,35 **** --- 32,39 ---- end + def test_to_str + assert_equal('atgcatgcatgcatgcaaaa', @obj.to_str) + end + def test_seq str = "atgcatgcatgcatgcaaaa" *************** *** 37,41 **** end - # <<(*arg) def test_push --- 41,44 ---- *************** *** 44,47 **** --- 47,56 ---- end + # concat(*arg) + def test_concat + str = "atgcatgcatgcatgcaaaaA" + assert_equal(str, @obj.concat("A")) + end + # +(*arg) def test_sum Index: test_na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/sequence/test_na.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_na.rb 5 Apr 2007 23:35:44 -0000 1.5 --- test_na.rb 3 Dec 2007 06:19:12 -0000 1.6 *************** *** 176,179 **** --- 176,241 ---- end + class TestSequenceCommon < Test::Unit::TestCase + + def setup + @obj = Bio::Sequence::NA.new('atgcatgcatgcatgcaaaa') + end + + def test_to_s + assert_equal('atgcatgcatgcatgcaaaa', @obj.to_s) + end + + def test_to_str + assert_equal('atgcatgcatgcatgcaaaa', @obj.to_str) + end + + def test_seq + str = "atgcatgcatgcatgcaaaa" + assert_equal(str, @obj.seq) + end + + # <<(*arg) + def test_push + str = "atgcatgcatgcatgcaaaaa" + assert_equal(str, @obj << "A") + end + + # concat(*arg) + def test_concat + str = "atgcatgcatgcatgcaaaaa" + assert_equal(str, @obj.concat("A")) + end + + # +(*arg) + def test_sum + str = "atgcatgcatgcatgcaaaaatgcatgcatgcatgcaaaa" + assert_equal(str, @obj + @obj) + end + + # window_search(window_size, step_size = 1) + def test_window_search + @obj.window_search(4) do |subseq| + assert_equal(20, @obj.size) + end + end + + #total(hash) + def test_total + hash = {'a' => 1, 'c' => 2, 'g' => 4, 't' => 3} + assert_equal(44.0, @obj.total(hash)) + end + + def test_composition + composition = {"a"=>8, "c"=>4, "g"=>4, "t"=>4} + assert_equal(composition, @obj.composition) + end + + def test_splicing + #(position) + assert_equal("atgcatgc", @obj.splicing("join(1..4, 13..16)")) + end + end + + class TestSequenceNATranslation < Test::Unit::TestCase def setup Index: test_aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/sequence/test_aa.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_aa.rb 14 Apr 2007 05:09:23 -0000 1.4 --- test_aa.rb 3 Dec 2007 06:19:12 -0000 1.5 *************** *** 20,25 **** module Bio - class TestSequenceAANew < Test::Unit::TestCase def test_new str = "RRLEHTFVFL RNFSLMLLRY" --- 20,25 ---- module Bio class TestSequenceAANew < Test::Unit::TestCase + def test_new str = "RRLEHTFVFL RNFSLMLLRY" *************** *** 87,90 **** --- 87,91 ---- assert_equal(ary, @obj.names) end + end From nakao at dev.open-bio.org Mon Dec 3 06:19:14 2007 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Mon, 03 Dec 2007 06:19:14 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/sequence common.rb,1.4,1.5 Message-ID: <200712030619.lB36JEQ7011529@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/sequence In directory dev.open-bio.org:/tmp/cvs-serv11507/lib/bio/sequence Modified Files: common.rb Log Message: * Fixed Bio::Sequence::NA#concat bug reported by Dr. M. Matsuzaki. * Added tests for concat and << for Bio::Sequence::NA and AA. Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence/common.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** common.rb 5 Apr 2007 23:35:41 -0000 1.4 --- common.rb 3 Dec 2007 06:19:12 -0000 1.5 *************** *** 92,99 **** # --- # *Returns*:: current Bio::Sequence::NA/AA object (modified) ! def <<(*arg) super(self.class.new(*arg)) end ! alias concat << # Create a new sequence by adding to an existing sequence. --- 92,102 ---- # --- # *Returns*:: current Bio::Sequence::NA/AA object (modified) ! def concat(*arg) super(self.class.new(*arg)) end ! ! def <<(*arg) ! concat(*arg) ! end # Create a new sequence by adding to an existing sequence. From k at dev.open-bio.org Fri Dec 7 02:00:44 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 07 Dec 2007 02:00:44 +0000 Subject: [BioRuby-cvs] bioruby README,1.16,1.17 Message-ID: <200712070200.lB720iVV000343@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv339 Modified Files: README Log Message: * procedure of the CVS is updated Index: README =================================================================== RCS file: /home/repository/bioruby/bioruby/README,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** README 23 Apr 2007 20:05:34 -0000 1.16 --- README 7 Dec 2007 02:00:42 -0000 1.17 *************** *** 1,5 **** $Id$ ! Copyright (C) 2001-2006 Toshiaki Katayama = BioRuby --- 1,5 ---- $Id$ ! Copyright (C) 2001-2007 Toshiaki Katayama = BioRuby *************** *** 52,58 **** and can be obtained by the following procedure. ! % cvs -d :pserver:anonymous at cvs.bioruby.org:/export/cvs login ! CVS password: (no password is required, just push return) ! % cvs -d :pserver:anonymous at cvs.bioruby.org:/export/cvs co bioruby --- RubyGems --- 52,58 ---- and can be obtained by the following procedure. ! % cvs -d :pserver:cvs at code.open-bio.org:/home/repository/bioruby login ! CVS password: cvs (login with a password 'cvs' for the first time) ! % cvs -d :pserver:cvs at code.open-bio.org:/home/repository/bioruby co bioruby --- RubyGems *************** *** 163,166 **** --- 163,167 ---- require_gem 'bio' + == LICENSE *************** *** 175,176 **** --- 176,178 ---- Current staffs of the BioRuby project can be reached by sending e-mail to . + From ngoto at dev.open-bio.org Tue Dec 11 15:13:35 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 11 Dec 2007 15:13:35 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io/flatfile indexer.rb,1.25,1.26 Message-ID: <200712111513.lBBFDZZi015988@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io/flatfile In directory dev.open-bio.org:/tmp/cvs-serv15968/lib/bio/io/flatfile Modified Files: indexer.rb Log Message: An mistake of variable name in Bio::FlatFileIndex.formatstring2class is corrected. Thanks to Dr. Frank Schwach for reporting the bug. Index: indexer.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile/indexer.rb,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** indexer.rb 5 Apr 2007 23:35:41 -0000 1.25 --- indexer.rb 11 Dec 2007 15:13:32 -0000 1.26 *************** *** 715,719 **** ############################################################## def self.formatstring2class(format_string) ! case format when /genbank/i dbclass = Bio::GenBank --- 715,719 ---- ############################################################## def self.formatstring2class(format_string) ! case format_string when /genbank/i dbclass = Bio::GenBank From k at dev.open-bio.org Wed Dec 12 13:53:28 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Wed, 12 Dec 2007 13:53:28 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io pubmed.rb,1.22,1.23 Message-ID: <200712121353.lBCDrSFH018851@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv18817/lib/bio/io Modified Files: pubmed.rb Log Message: * minor fix (from yonayona bar) Index: pubmed.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/pubmed.rb,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pubmed.rb 28 Nov 2007 06:34:33 -0000 1.22 --- pubmed.rb 12 Dec 2007 13:53:26 -0000 1.23 *************** *** 52,60 **** # # # If you don't know the pubmed ID: ! # Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)").each do |x| # p x # end # ! # Bio::PubMed.search("(genome AND analysis) OR bioinformatics)").each do |x| # p x # end --- 52,60 ---- # # # If you don't know the pubmed ID: ! # Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics").each do |x| # p x # end # ! # Bio::PubMed.search("(genome AND analysis) OR bioinformatics").each do |x| # p x # end *************** *** 274,284 **** opts = {"rettype" => "count"} puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! pubmed.esearch("(genome AND analysis) OR bioinformatics)").each do |x| puts x end --- 274,284 ---- opts = {"rettype" => "count"} puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts pubmed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! pubmed.esearch("(genome AND analysis) OR bioinformatics").each do |x| puts x end *************** *** 298,302 **** puts "--- Search PubMed by Entrez CGI ---" ! pubmed.search("(genome AND analysis) OR bioinformatics)").each do |x| p x end --- 298,302 ---- puts "--- Search PubMed by Entrez CGI ---" ! pubmed.search("(genome AND analysis) OR bioinformatics").each do |x| p x end *************** *** 316,326 **** opts = {"rettype" => "count"} puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)", opts) puts Time.now ! Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics)").each do |x| puts x end --- 316,326 ---- opts = {"rettype" => "count"} puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! puts Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics", opts) puts Time.now ! Bio::PubMed.esearch("(genome AND analysis) OR bioinformatics").each do |x| puts x end *************** *** 340,344 **** puts "--- Search PubMed by Entrez CGI ---" ! Bio::PubMed.search("(genome AND analysis) OR bioinformatics)").each do |x| p x end --- 340,344 ---- puts "--- Search PubMed by Entrez CGI ---" ! Bio::PubMed.search("(genome AND analysis) OR bioinformatics").each do |x| p x end From ngoto at dev.open-bio.org Wed Dec 12 16:06:24 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 12 Dec 2007 16:06:24 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.69,1.70 Message-ID: <200712121606.lBCG6OLR019336@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv19312 Modified Files: ChangeLog Log Message: * lib/bio/db/newick.rb: Changed to be compliant with the Gary Olsen's Interpretation of the "Newick's 8:45" Tree Format Standard. In addtion, RDoc is improved. * test/unit/bio/db/test_newick.rb More tests are added. * ChangeLog ChangeLog in 12/Dec/2007 are added. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ChangeLog 10 Nov 2007 08:28:50 -0000 1.69 --- ChangeLog 12 Dec 2007 16:06:22 -0000 1.70 *************** *** 1,2 **** --- 1,17 ---- + 2007-12-12 Naohisa Goto + + * lib/bio/db/newick.rb: + + Changed to be compliant with the Gary Olsen's Interpretation of + the "Newick's 8:45" Tree Format Standard. + + * test/unit/bio/db/test_newick.rb + + More tests are added. + + * lib/bio/io/flatfile/indexer.rb + + Fixed a misspelling in Bio::FlatFileIndex.formatstring2class. + 2007-11-10 Toshiaki Katayama From ngoto at dev.open-bio.org Wed Dec 12 16:06:24 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 12 Dec 2007 16:06:24 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db newick.rb,1.7,1.8 Message-ID: <200712121606.lBCG6Oxj019339@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv19312/lib/bio/db Modified Files: newick.rb Log Message: * lib/bio/db/newick.rb: Changed to be compliant with the Gary Olsen's Interpretation of the "Newick's 8:45" Tree Format Standard. In addtion, RDoc is improved. * test/unit/bio/db/test_newick.rb More tests are added. * ChangeLog ChangeLog in 12/Dec/2007 are added. Index: newick.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/newick.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** newick.rb 5 Apr 2007 23:35:40 -0000 1.7 --- newick.rb 12 Dec 2007 16:06:22 -0000 1.8 *************** *** 9,13 **** --- 9,23 ---- # $Id$ # + # == Description + # + # This file contains parser and formatter of Newick and NHX. + # + # == References + # + # * http://evolution.genetics.washington.edu/phylip/newick_doc.html + # * http://www.phylosoft.org/forester/NHX.html + # + require 'strscan' require 'bio/tree' *************** *** 19,22 **** --- 29,33 ---- #+++ + # default options DEFAULT_OPTIONS = { :indent => ' ' } *************** *** 33,40 **** private :__get_option # formats leaf def __to_newick_format_leaf(node, edge, options) ! label = get_node_name(node).to_s dist = get_edge_distance_string(edge) --- 44,67 ---- private :__get_option + + # formats Newick label (unquoted_label or quoted_label) + def __to_newick_format_label(str, options) + if __get_option(:parser, options) == :naive then + return str.to_s + end + str = str.to_s + if /([\(\)\,\:\[\]\_\'\x00-\x1f\x7f])/ =~ str then + # quoted_label + return "\'" + str.gsub(/\'/, "\'\'") + "\'" + end + # unquoted_label + return str.gsub(/ /, '_') + end + private :__to_newick_format_label + # formats leaf def __to_newick_format_leaf(node, edge, options) ! label = __to_newick_format_label(get_node_name(node), options) dist = get_edge_distance_string(edge) *************** *** 63,67 **** def __to_newick_format_leaf_NHX(node, edge, options) ! label = get_node_name(node).to_s dist = get_edge_distance_string(edge) --- 90,94 ---- def __to_newick_format_leaf_NHX(node, edge, options) ! label = __to_newick_format_label(get_node_name(node), options) dist = get_edge_distance_string(edge) *************** *** 166,174 **** # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # Description about options. ! # :indent : indent string; set false to disable (default: ' ') ! # :bootstrap_style : :disabled disables bootstrap representations ! # :traditional traditional style ! # :molphy Molphy style (default) def output_newick(options = {}, &block) #:yields: node1, node2 root = @root --- 193,204 ---- # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # ! # Available options: ! # :indent:: ! # indent string; set false to disable (default: ' ') ! # :bootstrap_style:: ! # :disabled disables bootstrap representations. ! # :traditional for traditional style. ! # :molphy for Molphy style (default). def output_newick(options = {}, &block) #:yields: node1, node2 root = @root *************** *** 186,191 **** # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # Description about options. ! # :indent : indent string; set false to disable (default: ' ') def output_nhx(options = {}, &block) #:yields: node1, node2 root = @root --- 216,224 ---- # If block is given, the order of the node is sorted # (as the same manner as Enumerable#sort). ! # ! # Available options: ! # :indent:: ! # indent string; set false to disable (default: ' ') ! # def output_nhx(options = {}, &block) #:yields: node1, node2 root = @root *************** *** 258,268 **** # _options_ for parsing can be set. # ! # Note: molphy-style bootstrap values may be parsed, even if ! # the options[:bootstrap_style] is set to :traditional or :disabled. ! # Note: By default, if all of the internal node's names are numeric # and there are no NHX and no molphy-style boostrap values, # the names of internal nodes are regarded as bootstrap values. ! # options[:bootstrap_style] = :disabled or :molphy to disable the feature ! # (or at least one NHX tag exists). def initialize(str, options = nil) str = str.sub(/\;(.*)/m, ';') --- 291,316 ---- # _options_ for parsing can be set. # ! # Available options: ! # :bootstrap_style:: ! # :traditional for traditional bootstrap style, ! # :molphy for molphy style, ! # :disabled to ignore bootstrap strings. ! # For details of default actions, please read the notes below. ! # :parser:: ! # :naive for using naive parser, compatible with ! # BioRuby 1.1.0, which ignores quoted strings and ! # do not convert underscores to spaces. ! # ! # Notes for bootstrap style: ! # Molphy-style bootstrap values may always be parsed, even if ! # the options[:bootstrap_style] is set to ! # :traditional or :disabled. ! # ! # Note for default or traditional bootstrap style: ! # By default, if all of the internal node's names are numeric # and there are no NHX and no molphy-style boostrap values, # the names of internal nodes are regarded as bootstrap values. ! # options[:bootstrap_style] = :disabled or :molphy ! # to disable the feature (or at least one NHX tag exists). def initialize(str, options = nil) str = str.sub(/\;(.*)/m, ';') *************** *** 309,354 **** # Parses newick formatted leaf (or internal node) name. ! def __parse_newick_leaf(str, node, edge, options) ! case str ! when /(.*)\:(.*)\[(.*)\]/ ! node.name = $1 ! edge.distance_string = $2 if $2 and !($2.strip.empty?) ! # bracketted string into bstr ! bstr = $3 ! when /(.*)\[(.*)\]/ ! node.name = $1 ! # bracketted string into bstr ! bstr = $2 ! when /(.*)\:(.*)/ ! node.name = $1 ! edge.distance_string = $2 if $2 and !($2.strip.empty?) ! else ! node.name = str end ! # determines NHX or Molphy-style bootstrap ! if bstr and !(bstr.strip.empty?) case __get_option(:original_format, options) when :nhx # regarded as NHX string which might be broken ! __parse_nhx(bstr, node, edge) when :traditional # simply ignored else ! case bstr when /\A\&\&NHX/ # NHX string # force to set NHX mode @options[:original_format] = :nhx ! __parse_nhx(bstr, node, edge) else # Molphy-style boostrap values # let molphy mode if nothing determined @options[:original_format] ||= :molphy node.bootstrap_string = bstr ! end #case bstr end end # returns true true --- 357,410 ---- # Parses newick formatted leaf (or internal node) name. ! def __parse_newick_leaf(leaf_tokens, node, edge, options) ! t = leaf_tokens.shift ! if !t.kind_of?(Symbol) then ! node.name = t ! t = leaf_tokens.shift end ! if t == :':' then ! t = leaf_tokens.shift ! if !t.kind_of?(Symbol) then ! edge.distance_string = t if t and !(t.strip.empty?) ! t = leaf_tokens.shift ! end ! end ! ! if t == :'[' then ! btokens = leaf_tokens case __get_option(:original_format, options) when :nhx # regarded as NHX string which might be broken ! __parse_nhx(btokens, node, edge) when :traditional # simply ignored else ! case btokens[0].to_s.strip ! when '' ! # not automatically determined when /\A\&\&NHX/ # NHX string # force to set NHX mode @options[:original_format] = :nhx ! __parse_nhx(btokens, node, edge) else # Molphy-style boostrap values # let molphy mode if nothing determined @options[:original_format] ||= :molphy + bstr = '' + while t = btokens.shift and t != :']' + bstr.concat t.to_s + end node.bootstrap_string = bstr ! end #case btokens[0] end end + if !btokens and !leaf_tokens.empty? then + # syntax error? + end + node.name ||= '' # compatibility for older BioRuby + # returns true true *************** *** 356,363 **** # Parses NHX (New Hampshire eXtended) string ! def __parse_nhx(bstr, node, edge) ! a = bstr.split(/\:/) ! a.shift if a[0] == '&&NHX' ! a.each do |str| tag, val = str.split(/\=/, 2) case tag --- 412,420 ---- # Parses NHX (New Hampshire eXtended) string ! def __parse_nhx(btokens, node, edge) ! btokens.shift if btokens[0] == '&&NHX' ! btokens.each do |str| ! break if str == :']' ! next if str.kind_of?(Symbol) tag, val = str.split(/\=/, 2) case tag *************** *** 392,395 **** --- 449,543 ---- end + # splits string to tokens + def __parse_newick_tokenize(str, options) + str = str.chop if str[-1..-1] == ';' + # http://evolution.genetics.washington.edu/phylip/newick_doc.html + # quoted_label ==> ' string_of_printing_characters ' + # single quote in quoted_label is '' (two single quotes) + # + + if __get_option(:parser, options) == :naive then + ary = str.split(/([\(\)\,\:\[\]])/) + ary.collect! { |x| x.strip!; x.empty? ? nil : x } + ary.compact! + ary.collect! do |x| + if /\A([\(\)\,\:\[\]])\z/ =~ x then + x.intern + else + x + end + end + return ary + end + + tokens = [] + ss = StringScanner.new(str) + + while !(ss.eos?) + if ss.scan(/\s+/) then + # do nothing + + elsif ss.scan(/[\(\)\,\:\[\]]/) then + # '(' or ')' or ',' or ':' or '[' or ']' + t = ss.matched + tokens.push t.intern + + elsif ss.scan(/\'/) then + # quoted_label + t = '' + while true + if ss.scan(/([^\']*)\'/) then + t.concat ss[1] + if ss.scan(/\'/) then + # single quote in quoted_label + t.concat ss.matched + else + break + end + else + # incomplete quoted_label? + break + end + end #while true + unless ss.match?(/\s*[\(\)\,\:\[\]]/) or ss.match?(/\s*\z/) then + # label continues? (illegal, but try to rescue) + if ss.scan(/[^\(\)\,\:\[\]]+/) then + t.concat ss.matched.lstrip + end + end + tokens.push t + + elsif ss.scan(/[^\(\)\,\:\[\]]+/) then + # unquoted_label + t = ss.matched.strip + t.gsub!(/[\r\n]/, '') + # unquoted underscore should be converted to blank + t.gsub!(/\_/, ' ') + tokens.push t unless t.empty? + + else + # unquoted_label in end of string + t = ss.rest.strip + t.gsub!(/[\r\n]/, '') + # unquoted underscore should be converted to blank + t.gsub!(/\_/, ' ') + tokens.push t unless t.empty? + ss.terminate + + end + end #while !(ss.eos?) + + tokens + end + + # get tokens for a leaf + def __parse_newick_get_tokens_for_leaf(ary) + r = [] + while t = ary[0] and t != :',' and t != :')' and t != :'(' + r.push ary.shift + end + r + end + # Parses newick formatted string. def __parse_newick(str, options = {}) *************** *** 402,409 **** node_stack = [] # preparation of tokens ! str = str.chop if str[-1..-1] == ';' ! ary = str.split(/([\(\)\,])/) ! ary.collect! { |x| x.strip!; x.empty? ? nil : x } ! ary.compact! previous_token = nil # main loop --- 550,554 ---- node_stack = [] # preparation of tokens ! ary = __parse_newick_tokenize(str, options) previous_token = nil # main loop *************** *** 411,416 **** #p token case token ! when ',' ! if previous_token == ',' or previous_token == '(' then # there is a leaf whose name is empty. ary.unshift(token) --- 556,561 ---- #p token case token ! when :',' ! if previous_token == :',' or previous_token == :'(' then # there is a leaf whose name is empty. ary.unshift(token) *************** *** 418,422 **** token = nil end ! when '(' node = Node.new nodes << node --- 563,567 ---- token = nil end ! when :'(' node = Node.new nodes << node *************** *** 424,429 **** node_stack.push(cur_node) cur_node = node ! when ')' ! if previous_token == ',' or previous_token == '(' then # there is a leaf whose name is empty. ary.unshift(token) --- 569,574 ---- node_stack.push(cur_node) cur_node = node ! when :')' ! if previous_token == :',' or previous_token == :'(' then # there is a leaf whose name is empty. ary.unshift(token) *************** *** 432,439 **** else edge = Edge.new ! next_token = ary[0] ! if next_token and next_token != ',' and next_token != ')' then ! __parse_newick_leaf(next_token, cur_node, edge, options) ! ary.shift end parent = node_stack.pop --- 577,584 ---- else edge = Edge.new ! leaf_tokens = __parse_newick_get_tokens_for_leaf(ary) ! token = nil ! if leaf_tokens.size > 0 then ! __parse_newick_leaf(leaf_tokens, cur_node, edge, options) end parent = node_stack.pop *************** *** 445,449 **** leaf = Node.new edge = Edge.new ! __parse_newick_leaf(token, leaf, edge, options) nodes << leaf edges << Bio::Relation.new(cur_node, leaf, edge) --- 590,597 ---- leaf = Node.new edge = Edge.new ! ary.unshift(token) ! leaf_tokens = __parse_newick_get_tokens_for_leaf(ary) ! token = nil ! __parse_newick_leaf(leaf_tokens, leaf, edge, options) nodes << leaf edges << Bio::Relation.new(cur_node, leaf, edge) From ngoto at dev.open-bio.org Wed Dec 12 16:06:24 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 12 Dec 2007 16:06:24 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_newick.rb,1.5,1.6 Message-ID: <200712121606.lBCG6OVv019342@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory dev.open-bio.org:/tmp/cvs-serv19312/test/unit/bio/db Modified Files: test_newick.rb Log Message: * lib/bio/db/newick.rb: Changed to be compliant with the Gary Olsen's Interpretation of the "Newick's 8:45" Tree Format Standard. In addtion, RDoc is improved. * test/unit/bio/db/test_newick.rb More tests are added. * ChangeLog ChangeLog in 12/Dec/2007 are added. Index: test_newick.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_newick.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_newick.rb 5 Apr 2007 23:35:43 -0000 1.5 --- test_newick.rb 12 Dec 2007 16:06:22 -0000 1.6 *************** *** 54,56 **** --- 54,293 ---- end #class TestNewick + + class TestNewick2 < Test::Unit::TestCase + + TREE_STRING = <<-END_OF_TREE_STRING + ( + ( + 'this is test':0.0625, + 'test2 (abc, def)':0.125 + ) 'internal node''s name' : 0.25, + ( + '''':0.03125, + ( + 'ABCAC_HUMAN [ABC superfamily]':0.015625, + hypothetical_protein:0.5 + ) ABC : 0.25 [99] + ) test3 :0.5 + )root; + END_OF_TREE_STRING + + def test_string_tree + newick = Bio::Newick.new(TREE_STRING) + tree = newick.tree + assert_equal('root', tree.root.name) + assert_equal([ + "this is test", + "test2 (abc, def)", + "internal node\'s name", + "\'", + "ABCAC_HUMAN [ABC superfamily]", + "hypothetical protein", + "ABC", + "test3", + "root" + ].sort, + tree.nodes.collect { |x| x.name }.sort) + + assert_equal(tree.children(tree.root).collect { |x| x.name }.sort, + [ "internal node\'s name", "test3" ]) + + node = tree.get_node_by_name('ABC') + assert_equal(99, node.bootstrap) + + assert_equal(1.5625, + tree.distance(tree.get_node_by_name('hypothetical protein'), + tree.get_node_by_name('this is test'))) + end + + end #class TestNewick2 + + class TestNewickPrivate < Test::Unit::TestCase + def setup + @newick = Bio::Newick.new('') # dummy data + end + + def test_parse_newick_leaf + leaf_tokens = [ "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]" ] + node = Bio::Tree::Node.new + edge = Bio::Tree::Edge.new + options = {} + + assert_equal(true, + @newick.instance_eval do + __parse_newick_leaf(leaf_tokens, node, edge, options) + end) + + assert_equal(:nhx, @newick.options[:original_format]) + assert_equal("A:B _C(D,E)F\'s G[H]", node.name) + assert_equal("human", node.scientific_name) + assert_equal("1.1.1.1", node.ec_number) + assert_equal(0.5, edge.distance) + end + + def test_parse_newick_get_tokens_for_leaf + input = [ "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]", + :",", :"(", "bbb", :":", "0.2", :")" ] + leaf_should_be = [ "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]" ] + rest_should_be = [ :",", :"(", "bbb", :":", "0.2", :")" ] + + assert_equal(leaf_should_be, + @newick.instance_eval do + __parse_newick_get_tokens_for_leaf(input) + end) + + assert_equal(rest_should_be, input) + end + + def test_parse_newick_tokenize + examples = + [ + [ + '(a,b);', # input + [ :"(", 'a', :",", 'b', :")" ], # normal parser result + [ :"(", 'a', :",", 'b', :")" ], # naive parser result + ], + [ + # input + "(\'A:B _C(D,E)F\'\'s G[H]\':0.5[&&NHX:S=human:E=1.1.1.1], \n(bbb:0.2, c_d_e[&&NHX:B=100]);", + # normal parser result + [ :"(", "A:B _C(D,E)F\'s G[H]", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]", + :",", :"(", "bbb", :":", "0.2", :",", + "c d e", :"[", "&&NHX", :":", "B=100", :"]", :")" ], + # naive parser result + [ :"(", "\'A", :":", "B _C", :"(", "D", :",", "E", + :")", "F\'\'s G", :"[", "H", :"]", "\'", :":", '0.5', :"[", + "&&NHX", :":", "S=human", :":", "E=1.1.1.1", :"]", + :",", :"(", "bbb", :":", "0.2", :",", + "c_d_e", :"[", "&&NHX", :":", "B=100", :"]", :")" ] + ] + ] + + examples.each do |a| + # normal parser + assert_equal(a[1], + @newick.instance_eval do + __parse_newick_tokenize(a[0], {}) + end) + + # naive parser + assert_equal(a[2], + @newick.instance_eval do + __parse_newick_tokenize(a[0], { :parser => :naive }) + end) + end + end + end #class TestNewickPrivate + + class TestBioTreeOutputPrivate < Test::Unit::TestCase + + def setup + @tree = Bio::Tree.new + end + + def test_to_newick_format_label + # unquoted_label + assert_equal('ABC', @tree.instance_eval do + __to_newick_format_label('ABC', {}) + end) + + # unquoted_label, replaces blank to underscore + assert_equal('A_B_C', @tree.instance_eval do + __to_newick_format_label('A B C', {}) + end) + + # quoted_label example 1 + assert_equal("\'A B_C\'", @tree.instance_eval do + __to_newick_format_label('A B_C', {}) + end) + + # quoted_label example 2 + assert_equal("\'A(B),C\'", @tree.instance_eval do + __to_newick_format_label('A(B),C', {}) + end) + + # normal formatter + assert_equal("\'A_B_C\'", @tree.instance_eval do + __to_newick_format_label('A_B_C', {}) + end) + # naive formatter + assert_equal("A_B_C", @tree.instance_eval do + __to_newick_format_label('A_B_C', + { :parser => :naive }) + end) + end + + + def test_to_newick_format_leaf + node = Bio::Tree::Node.new('ABC') + edge = Bio::Tree::Edge.new(0.5) + + assert_equal('ABC:0.5', @tree.instance_eval do + __to_newick_format_leaf(node, edge, {}) + end) + + # disable branch length + assert_equal('ABC', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :branch_length_style => + :disabled }) + end) + + node.bootstrap = 98 + # default: molphy style bootstrap + assert_equal('ABC:0.5[98]', @tree.instance_eval do + __to_newick_format_leaf(node, edge, {}) + end) + # force molphy style bootstrap + assert_equal('ABC:0.5[98]', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :bootstrap_style => :molphy }) + end) + # disable bootstrap output + assert_equal('ABC:0.5', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :bootstrap_style => + :disabled }) + end) + + # force traditional bootstrap style + assert_equal('ABC98:0.5', @tree.instance_eval do + __to_newick_format_leaf(node, edge, + { :bootstrap_style => + :traditional }) + end) + # normally, when traditional style, no node name allowed for the node + node2 = Bio::Tree::Node.new + node2.bootstrap = 98 + assert_equal('98:0.5', @tree.instance_eval do + __to_newick_format_leaf(node2, edge, + { :bootstrap_style => + :traditional }) + end) + + end + + def test_to_newick_format_leaf_NHX + node = Bio::Tree::Node.new('ADH') + edge = Bio::Tree::Edge.new(0.5) + node.bootstrap = 98 + node.ec_number = '1.1.1.1' + node.scientific_name = 'human' + node.taxonomy_id = '9606' + node.events.push :gene_duplication + edge.log_likelihood = 1.5 + edge.width = 3 + + str = 'ADH:0.5[&&NHX:B=98:D=Y:E=1.1.1.1:L=1.5:S=human:T=9606:W=3]' + assert_equal(str, @tree.instance_eval do + __to_newick_format_leaf_NHX(node, edge, {}) + end) + end + + end #class TestBioTreeOutputPrivate + end #module Bio From k at dev.open-bio.org Fri Dec 14 16:04:57 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:04:57 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.86,1.87 Message-ID: <200712141604.lBEG4uVu023020@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv23016/lib Modified Files: bio.rb Log Message: * updated for BioRuby 1.2.0 release Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** bio.rb 16 Jul 2007 12:26:28 -0000 1.86 --- bio.rb 14 Dec 2007 16:04:54 -0000 1.87 *************** *** 2,6 **** # = bio.rb - Loading all BioRuby modules # ! # Copyright:: Copyright (C) 2001-2006 # Toshiaki Katayama # License:: The Ruby License --- 2,6 ---- # = bio.rb - Loading all BioRuby modules # ! # Copyright:: Copyright (C) 2001-2007 # Toshiaki Katayama # License:: The Ruby License *************** *** 11,15 **** module Bio ! BIORUBY_VERSION = [1, 1, 0].extend(Comparable) ### Basic data types --- 11,15 ---- module Bio ! BIORUBY_VERSION = [1, 2, 0].extend(Comparable) ### Basic data types From k at dev.open-bio.org Fri Dec 14 16:09:39 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:09:39 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb,1.22,1.23 Message-ID: <200712141609.lBEG9dln023132@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv23128/lib/bio/appl/blast Modified Files: format0.rb Log Message: * added target_id for compatibility with other format parsers Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** format0.rb 21 Apr 2007 08:58:17 -0000 1.22 --- format0.rb 14 Dec 2007 16:09:36 -0000 1.23 *************** *** 861,867 **** def definition; parse_hitname; @definition; end #-- # Aliases to keep compatibility with Bio::Fasta::Report::Hit. - #alias target_id accession alias target_def definition alias target_len len --- 861,868 ---- def definition; parse_hitname; @definition; end + def target_id; definition[/^\s*(\S+)/]; end + #-- # Aliases to keep compatibility with Bio::Fasta::Report::Hit. alias target_def definition alias target_len len From k at dev.open-bio.org Fri Dec 14 16:12:19 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:12:19 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb,1.23,1.24 Message-ID: <200712141612.lBEGCJK4023154@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv23150/lib/bio/appl/blast Modified Files: format0.rb Log Message: * typo Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** format0.rb 14 Dec 2007 16:09:36 -0000 1.23 --- format0.rb 14 Dec 2007 16:12:17 -0000 1.24 *************** *** 861,865 **** def definition; parse_hitname; @definition; end ! def target_id; definition[/^\s*(\S+)/]; end #-- --- 861,865 ---- def definition; parse_hitname; @definition; end ! def target_id; definition[/^\s*(\S+)/, 1]; end #-- From k at dev.open-bio.org Fri Dec 14 16:15:22 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:15:22 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format8.rb,1.7,1.8 Message-ID: <200712141615.lBEGFMBG023196@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv23172/lib/bio/appl/blast Modified Files: format8.rb Log Message: * fixed a bug that two lines of same target with diffrent queries are come in continuously, the parser failed to create an new Hit object. Index: format8.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format8.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** format8.rb 5 Apr 2007 23:35:39 -0000 1.7 --- format8.rb 14 Dec 2007 16:15:20 -0000 1.8 *************** *** 2,6 **** # = bio/appl/blast/format8.rb - BLAST tab-delimited output (-m 8) parser # ! # Copyright:: Copyright (C) 2002, 2003 Toshiaki Katayama # License:: The Ruby License # --- 2,6 ---- # = bio/appl/blast/format8.rb - BLAST tab-delimited output (-m 8) parser # ! # Copyright:: Copyright (C) 2002, 2003, 2007 Toshiaki Katayama # License:: The Ruby License # *************** *** 23,26 **** --- 23,27 ---- @query_id = @query_def = data[/\S+/] + query_prev = '' target_prev = '' hit_num = 1 *************** *** 30,34 **** ary = line.chomp.split("\t") query_id, target_id, hsp = tab_parse_hsp(ary) ! if target_prev != target_id hit = Hit.new hit.num = hit_num --- 31,35 ---- ary = line.chomp.split("\t") query_id, target_id, hsp = tab_parse_hsp(ary) ! if query_prev != query_id or target_prev != target_id hit = Hit.new hit.num = hit_num *************** *** 42,45 **** --- 43,47 ---- hsp_num += 1 hit.hsps.push(hsp) + query_prev = query_id target_prev = target_id end From k at dev.open-bio.org Fri Dec 14 16:19:56 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:19:56 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg orthology.rb,1.9,1.10 Message-ID: <200712141619.lBEGJuhM023364@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv23360/lib/bio/db/kegg Modified Files: orthology.rb Log Message: * added dblinks_as_hash and genes_as_hash methods for convenience Index: orthology.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/orthology.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** orthology.rb 5 Apr 2007 15:42:59 -0000 1.9 --- orthology.rb 14 Dec 2007 16:19:54 -0000 1.10 *************** *** 68,72 **** end ! # Returns a Hash of Array of a database name and entry IDs in DBLINKS field. def dblinks unless @data['DBLINKS'] --- 68,72 ---- end ! # Returns an Array of a database name and entry IDs in DBLINKS field. def dblinks unless @data['DBLINKS'] *************** *** 76,80 **** end ! # Returns a Hash of Array of the organism ID and entry IDs in GENES field. def genes unless @data['GENES'] --- 76,91 ---- end ! # Returns a Hash of the DB name and an Array of entry IDs in DBLINKS field. ! def dblinks_as_hash ! hash = {} ! dblinks.each do |line| ! name, *list = line.split(/\s+/) ! db = name.downcase.sub(/:/, '') ! hash[db] = list ! end ! return hash ! end ! ! # Returns an Array of the organism ID and entry IDs in GENES field. def genes unless @data['GENES'] *************** *** 83,86 **** --- 94,110 ---- @data['GENES'] end + + # Returns a Hash of the organism ID and an Array of entry IDs in GENES field. + def genes_as_hash + hash = {} + genes.each do |line| + name, *list = line.split(/\s+/) + org = name.downcase.sub(/:/, '') + genes = list.map {|x| x.sub(/\(.*\)/, '')} + #names = list.map {|x| x.scan(/.*\((.*)\)/)} + hash[org] = genes + end + return hash + end end # ORTHOLOGY From k at dev.open-bio.org Fri Dec 14 16:20:40 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:20:40 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg enzyme.rb, 0.11, 0.12 genes.rb, 0.25, 0.26 glycan.rb, 1.6, 1.7 Message-ID: <200712141620.lBEGKe9l023386@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv23382/lib/bio/db/kegg Modified Files: enzyme.rb genes.rb glycan.rb Log Message: * ORTHOLOG field is fixed to ORTHOLOGY Index: genes.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/genes.rb,v retrieving revision 0.25 retrieving revision 0.26 diff -C2 -d -r0.25 -r0.26 *** genes.rb 5 Apr 2007 23:35:41 -0000 0.25 --- genes.rb 14 Dec 2007 16:20:38 -0000 0.26 *************** *** 138,142 **** def orthologs ! lines_fetch('ORTHOLOG') end --- 138,142 ---- def orthologs ! lines_fetch('ORTHOLOGY') end Index: enzyme.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/enzyme.rb,v retrieving revision 0.11 retrieving revision 0.12 diff -C2 -d -r0.11 -r0.12 *** enzyme.rb 5 Apr 2007 23:35:41 -0000 0.11 --- enzyme.rb 14 Dec 2007 16:20:38 -0000 0.12 *************** *** 107,113 **** end ! # ORTHOLOG def orthologs ! lines_fetch('ORTHOLOG') end --- 107,113 ---- end ! # ORTHOLOGY def orthologs ! lines_fetch('ORTHOLOGY') end Index: glycan.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/glycan.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** glycan.rb 28 Jun 2007 11:27:24 -0000 1.6 --- glycan.rb 14 Dec 2007 16:20:38 -0000 1.7 *************** *** 95,104 **** end ! # ORTHOLOG def orthologs ! unless @data['ORTHOLOG'] ! @data['ORTHOLOG'] = lines_fetch('ORTHOLOG') end ! @data['ORTHOLOG'] end --- 95,104 ---- end ! # ORTHOLOGY def orthologs ! unless @data['ORTHOLOGY'] ! @data['ORTHOLOGY'] = lines_fetch('ORTHOLOGY') end ! @data['ORTHOLOGY'] end From k at dev.open-bio.org Fri Dec 14 16:22:26 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:22:26 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.70,1.71 Message-ID: <200712141622.lBEGMQCP023447@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv23421 Modified Files: ChangeLog Log Message: * preparation for BioRuby 1.2 release Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** ChangeLog 12 Dec 2007 16:06:22 -0000 1.70 --- ChangeLog 14 Dec 2007 16:22:24 -0000 1.71 *************** *** 1,2 **** --- 1,21 ---- + 2007-12-15 Toshiaki Katayama + + * BioRuby 1.2.0 released + + * BioRuby shell is improved + * file save functionality is fixed + * deprecated require_gem is changed to gem to suppress warnings + * deprecated end_form_tag is rewrited to suppress warnings + * images for Rails shell are separated to the bioruby directory + * spinner is shown during the evaluation + * background image in the textarea is removed for the visibility + * Bio::Blast is fixed to parse -m 8 formatted result correctly + * Bio::PubMed is rewrited to enhance its functionality + * e.g. 'rettype' => 'count' and 'retmode' => 'xml' are available + * Bio::FlatFile is improved to accept recent MEDLINE format + * Bio::KEGG::COMPOUND is enhanced to utilize REMARK field + * Bio::KEGG::API is fixed to skip filter when the value is Fixnum + * A number of minor bug fixes + 2007-12-12 Naohisa Goto *************** *** 14,18 **** Fixed a misspelling in Bio::FlatFileIndex.formatstring2class. ! 2007-11-10 Toshiaki Katayama * lib/bio/io/pubmed.rb: --- 33,37 ---- Fixed a misspelling in Bio::FlatFileIndex.formatstring2class. ! 2007-11-28 Toshiaki Katayama * lib/bio/io/pubmed.rb: *************** *** 21,24 **** --- 40,54 ---- strongly recommended). + efetch method is enhanced to accept any PubMed search options + as a hash (to retrieve in XML format etc.) + + Changed to wait 3 seconds among each access by default to be + compliant with the NCBI terms (Make no more than one request + every 3 seconds). + + All Bio::PubMed.* class methods are changed to instance methods + (interface as the class methods are remained for the backward + compatibility). + 2007-07-19 Toshiaki Katayama From k at dev.open-bio.org Fri Dec 14 16:23:00 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 14 Dec 2007 16:23:00 +0000 Subject: [BioRuby-cvs] bioruby gemspec.rb,1.8,1.9 Message-ID: <200712141623.lBEGN0iS023484@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv23480 Modified Files: gemspec.rb Log Message: * prepare for BioRuby 1.2 release Index: gemspec.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/gemspec.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gemspec.rb 24 Dec 2006 14:55:53 -0000 1.8 --- gemspec.rb 14 Dec 2007 16:22:58 -0000 1.9 *************** *** 3,7 **** spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.1.0" s.author = "BioRuby project" --- 3,7 ---- spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.2.0" s.author = "BioRuby project" From ngoto at dev.open-bio.org Tue Dec 18 13:48:45 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 18 Dec 2007 13:48:45 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb chain.rb, 1.8, 1.9 model.rb, 1.9, 1.10 pdb.rb, 1.23, 1.24 residue.rb, 1.13, 1.14 Message-ID: <200712181348.lBIDmj6R011143@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv11123/lib/bio/db/pdb Modified Files: chain.rb model.rb pdb.rb residue.rb Log Message: * lib/bio/db/pdb/pdb.rb Bio::PDB#inspect is added to prevent memory exhaust problem. ([BioRuby] Parse big PDB use up all memory) * lib/bio/db/pdb/model.rb Added Bio::PDB::Model#inspect. * lib/bio/db/pdb/chain.rb Added Bio::PDB::Chain#inspect. * lib/bio/db/pdb/residue.rb Added Bio::PDB::Residue#inspect. This also affects Bio::PDB::Heterogen#inspect. Index: residue.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/residue.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** residue.rb 23 Apr 2007 16:03:25 -0000 1.13 --- residue.rb 18 Dec 2007 13:48:42 -0000 1.14 *************** *** 130,133 **** --- 130,139 ---- end + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} resName=#{resName.inspect} id=#{residue_id.inspect} chain.id=#{(chain ? chain.id : nil).inspect} resSeq=#{resSeq.inspect} iCode=#{iCode.inspect} atoms.size=#{atoms.size}>" + end + # Always returns false. # Index: model.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/model.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** model.rb 5 Apr 2007 23:35:41 -0000 1.9 --- model.rb 18 Dec 2007 13:48:42 -0000 1.10 *************** *** 135,138 **** --- 135,144 ---- return string end + + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} serial=#{serial.inspect} chains.size=#{chains.size}>" + end end #class Model Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** pdb.rb 10 Jul 2007 10:44:46 -0000 1.23 --- pdb.rb 18 Dec 2007 13:48:42 -0000 1.24 *************** *** 1877,1880 **** --- 1877,1886 ---- end + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} entry_id=#{entry_id.inspect}>" + end + end #class PDB Index: chain.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/chain.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** chain.rb 5 Apr 2007 23:35:41 -0000 1.8 --- chain.rb 18 Dec 2007 13:48:42 -0000 1.9 *************** *** 173,176 **** --- 173,182 ---- end + # returns a string containing human-readable representation + # of this object. + def inspect + "#<#{self.class.to_s} id=#{chain_id.inspect} model.serial=#{(model ? model.serial : nil).inspect} residues.size=#{residues.size} heterogens.size=#{heterogens.size} aaseq=#{aaseq.inspect}>" + end + # gets an amino acid sequence of this chain from ATOM records def aaseq From ngoto at dev.open-bio.org Tue Dec 18 13:54:58 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 18 Dec 2007 13:54:58 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.71,1.72 Message-ID: <200712181354.lBIDsw3C011195@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv11175 Modified Files: ChangeLog Log Message: ChangeLog added for changes of lib/bio/db/pdb/pdb.rb and so on. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** ChangeLog 14 Dec 2007 16:22:24 -0000 1.71 --- ChangeLog 18 Dec 2007 13:54:56 -0000 1.72 *************** *** 1,2 **** --- 1,22 ---- + 2007-12-18 Naohisa Goto + + * lib/bio/db/pdb/pdb.rb + + Bio::PDB#inspect is added to prevent memory exhaust problem. + ([BioRuby] Parse big PDB use up all memory) + + * lib/bio/db/pdb/model.rb + + Bio::PDB::Model#inspect is added. + + * lib/bio/db/pdb/chain.rb + + Bio::PDB::Chain#inspect is added. + + * lib/bio/db/pdb/residue.rb + + Bio::PDB::Residue#inspect is added. + This also affects Bio::PDB::Heterogen#inspect. + 2007-12-15 Toshiaki Katayama From k at dev.open-bio.org Fri Dec 21 05:12:44 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 21 Dec 2007 05:12:44 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db medline.rb,1.16,1.17 Message-ID: <200712210512.lBL5Ci1l022445@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv22441 Modified Files: medline.rb Log Message: * added doi and pii methods to extract DOI and PII number from AID field Index: medline.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/medline.rb,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** medline.rb 5 Apr 2007 23:35:40 -0000 1.16 --- medline.rb 21 Dec 2007 05:12:41 -0000 1.17 *************** *** 26,30 **** class MEDLINE < NCBIDB - # def initialize(entry) @pubmed = Hash.new('') --- 26,29 ---- *************** *** 38,41 **** --- 37,41 ---- end end + attr_reader :pubmed *************** *** 188,197 **** alias affiliations ad - - ### Other MEDLINE tags - # AID - Article Identifier # Article ID values may include the pii (controlled publisher identifier) # or doi (Digital Object Identifier). # CI - Copyright Information --- 188,203 ---- alias affiliations ad # AID - Article Identifier # Article ID values may include the pii (controlled publisher identifier) # or doi (Digital Object Identifier). + def doi + @pubmed['AID'][/(\S+) \[doi\]/, 1] + end + + def pii + @pubmed['AID'][/(\S+) \[pii\]/, 1] + end + + ### Other MEDLINE tags # CI - Copyright Information From k at dev.open-bio.org Fri Dec 21 05:14:46 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 21 Dec 2007 05:14:46 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.72,1.73 Message-ID: <200712210514.lBL5EkTl022483@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv22479 Modified Files: ChangeLog Log Message: * In Bio::MEDLINE, doi and pii methods are added to extract DOI and PII number from AID field Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** ChangeLog 18 Dec 2007 13:54:56 -0000 1.72 --- ChangeLog 21 Dec 2007 05:14:44 -0000 1.73 *************** *** 1,2 **** --- 1,8 ---- + 2007-12-21 Toshiaki Katayama + + * lib/bio/db/medline.rb + + Added doi and pii methods to extract DOI and PII number from AID field + 2007-12-18 Naohisa Goto From ngoto at dev.open-bio.org Wed Dec 26 13:55:44 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 13:55:44 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_alignment.rb,1.11,1.12 Message-ID: <200712261355.lBQDthqC017482@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory dev.open-bio.org:/tmp/cvs-serv17413/test/unit/bio Modified Files: test_alignment.rb Log Message: Ruby 1.9 compliant: The last comma in Array.[] is no longer allowed. (For example, class A < Array; end; A[ 1, 2, 3, ] raises error in Ruby 1.9.) Index: test_alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_alignment.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_alignment.rb 5 Apr 2007 23:35:42 -0000 1.11 --- test_alignment.rb 26 Dec 2007 13:55:40 -0000 1.12 *************** *** 427,431 **** Sequence::AA.new('MHTL'), Sequence::AA.new('MQNV'), ! Sequence::AA.new('MKKW'), ] assert_equal('*:. ', a.match_line) --- 427,431 ---- Sequence::AA.new('MHTL'), Sequence::AA.new('MQNV'), ! Sequence::AA.new('MKKW') ] assert_equal('*:. ', a.match_line) From ngoto at dev.open-bio.org Wed Dec 26 14:08:04 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 14:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.23,1.24 Message-ID: <200712261408.lBQE841o017751@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv17518/lib/bio Modified Files: alignment.rb Log Message: * Ruby 1.9 compliant: in EnumerableExtension#each_window and OriginalAlignment#index methods, local variable names outside the iterator loops are changed not to be shadowed by iterator variables. * Warning messages for uninitialized instance variables of @gap_regexp, @gap_char, @missing_char, and @seqclass are suppressed. Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** alignment.rb 16 Jul 2007 12:21:39 -0000 1.23 --- alignment.rb 26 Dec 2007 14:08:02 -0000 1.24 *************** *** 94,98 **** # Returns regular expression for checking gap. def gap_regexp ! @gap_regexp or GAP_REGEXP end # regular expression for checking gap --- 94,98 ---- # Returns regular expression for checking gap. def gap_regexp ! ((defined? @gap_regexp) ? @gap_regexp : nil) or GAP_REGEXP end # regular expression for checking gap *************** *** 101,105 **** # Gap character. def gap_char ! @gap_char or GAP_CHAR end # gap character --- 101,105 ---- # Gap character. def gap_char ! ((defined? @gap_char) ? @gap_char : nil) or GAP_CHAR end # gap character *************** *** 108,112 **** # Character if the site is missing or unknown. def missing_char ! @missing_char or MISSING_CHAR end # Character if the site is missing or unknown. --- 108,112 ---- # Character if the site is missing or unknown. def missing_char ! ((defined? @missing_char) ? @missing_char : nil) or MISSING_CHAR end # Character if the site is missing or unknown. *************** *** 119,123 **** # If no sequences are found, returns nil. def seqclass ! @seqclass or String end --- 119,123 ---- # If no sequences are found, returns nil. def seqclass ! ((defined? @seqclass) ? @seqclass : nil) or String end *************** *** 348,352 **** # If no sequences are found, returns nil. def seqclass ! if @seqclass then @seqclass else --- 348,352 ---- # If no sequences are found, returns nil. def seqclass ! if (defined? @seqclass) and @seqclass then @seqclass else *************** *** 482,490 **** return nil if window_size < 0 if step_size >= 0 then ! i = nil 0.step(alignment_length - window_size, step_size) do |i| yield alignment_window(i, window_size) end ! alignment_window((i+window_size)..-1) else i = alignment_length - window_size --- 482,491 ---- return nil if window_size < 0 if step_size >= 0 then ! last_step = nil 0.step(alignment_length - window_size, step_size) do |i| yield alignment_window(i, window_size) + last_step = i end ! alignment_window((last_step + window_size)..-1) else i = alignment_length - window_size *************** *** 1821,1826 **** def index(seq) #(Hash-like) ! k = nil self.each_pair do |k, s| if s.class == seq.class then r = (s == seq) --- 1822,1828 ---- def index(seq) #(Hash-like) ! last_key = nil self.each_pair do |k, s| + last_key = k if s.class == seq.class then r = (s == seq) *************** *** 1830,1834 **** break if r end ! k end --- 1832,1836 ---- break if r end ! last_key end From ngoto at dev.open-bio.org Wed Dec 26 14:14:43 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 14:14:43 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.73,1.74 Message-ID: <200712261414.lBQEEhAF017908@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv17878 Modified Files: ChangeLog Log Message: changelog for changes of lib/bio/alignment.rb and test/unit/bio/test_alignment.rb are added. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** ChangeLog 21 Dec 2007 05:14:44 -0000 1.73 --- ChangeLog 26 Dec 2007 14:14:41 -0000 1.74 *************** *** 1,2 **** --- 1,23 ---- + 2007-12-26 Naohisa Goto + + * lib/bio/alignment.rb + + Ruby 1.9 compliant: in EnumerableExtension#each_window and + OriginalAlignment#index methods, local variable names outside the + iterator loops are changed not to be shadowed by iterator + variables. + + Warning messages for uninitialized instance variables of + @gap_regexp, @gap_char, @missing_char, and @seqclass + are suppressed. + + * test/unit/bio/test_alignment.rb + + Ruby 1.9 compliant: Ruby 1.9 compliant: The last comma in Array.[] + is no longer allowed. (For example, + class A < Array; end; A[ 1, 2, 3, ] + raises syntax error in Ruby 1.9.) + + 2007-12-21 Toshiaki Katayama From ngoto at dev.open-bio.org Wed Dec 26 14:16:27 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Dec 2007 14:16:27 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.74,1.75 Message-ID: <200712261416.lBQEGRax017972@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv17926 Modified Files: ChangeLog Log Message: removed a void line in ChangeLog of 2007-12-26 Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** ChangeLog 26 Dec 2007 14:14:41 -0000 1.74 --- ChangeLog 26 Dec 2007 14:16:25 -0000 1.75 *************** *** 19,23 **** raises syntax error in Ruby 1.9.) - 2007-12-21 Toshiaki Katayama --- 19,22 ---- From ngoto at dev.open-bio.org Thu Dec 27 17:28:59 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Dec 2007 17:28:59 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb, 1.24, 1.25 wublast.rb, 1.11, 1.12 Message-ID: <200712271728.lBRHSxCt027589@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv27557/lib/bio/appl/blast Modified Files: format0.rb wublast.rb Log Message: Fixed parse error for NCBI BLAST 2.2.17. Added Default::Report#references and Default::Report::HSP#stat_method methods. Index: wublast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/wublast.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** wublast.rb 21 Apr 2007 08:58:17 -0000 1.11 --- wublast.rb 27 Dec 2007 17:28:57 -0000 1.12 *************** *** 71,78 **** def format0_split_headers(data) @f0header = data.shift while r = data.first case r when /^Reference\: / ! @f0reference = data.shift when /^Copyright / @f0copyright = data.shift --- 71,79 ---- def format0_split_headers(data) @f0header = data.shift + @f0references = [] while r = data.first case r when /^Reference\: / ! @f0references.push data.shift when /^Copyright / @f0copyright = data.shift Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** format0.rb 14 Dec 2007 16:12:17 -0000 1.24 --- format0.rb 27 Dec 2007 17:28:57 -0000 1.25 *************** *** 224,232 **** # Returns the bibliography reference of the BLAST software. def reference ! unless defined?(@reference) ! @reference = @f0reference.to_s.gsub(/\s+/, ' ').strip end #unless ! @reference end --- 224,243 ---- # Returns the bibliography reference of the BLAST software. + # Note that this method shows only the first reference. + # When you want to get additional references, + # you can use references method. def reference ! references[0] ! end ! ! # Returns the bibliography references of the BLAST software. ! # Returns an array of strings. ! def references ! unless defined?(@references) ! @references = @f0references.collect do |x| ! x.to_s.gsub(/\s+/, ' ').strip ! end end #unless ! @references end *************** *** 277,281 **** def format0_split_headers(data) @f0header = data.shift ! @f0reference = data.shift @f0query = data.shift @f0database = data.shift --- 288,295 ---- def format0_split_headers(data) @f0header = data.shift ! @f0references = [] ! while data[0] and /\AQuery\=/ !~ data[0] ! @f0references.push data.shift ! end @f0query = data.shift @f0database = data.shift *************** *** 1021,1024 **** --- 1035,1042 ---- pv = '1' + pv if pv[0] == ?e @pvalue = pv.to_f + elsif sc.skip(/Method\:\s*(.+)/) then + # signature of composition-based statistics method + # for example, "Method: Composition-based stats." + @stat_method = sc[1] else raise ScanError *************** *** 1090,1093 **** --- 1108,1118 ---- method_after_parse_score :hit_strand + # statistical method for calculating evalue and/or score + # (nil or a string) + # (note that composition-based statistics for blastp or tblastn + # were enabled by default after NCBI BLAST 2.2.17) + attr_reader :stat_method if false #dummy + method_after_parse_score :stat_method + # Parses alignments. def parse_alignment From ngoto at dev.open-bio.org Thu Dec 27 17:28:59 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Dec 2007 17:28:59 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.75,1.76 Message-ID: <200712271728.lBRHSxkH027586@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv27557 Modified Files: ChangeLog Log Message: Fixed parse error for NCBI BLAST 2.2.17. Added Default::Report#references and Default::Report::HSP#stat_method methods. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** ChangeLog 26 Dec 2007 14:16:25 -0000 1.75 --- ChangeLog 27 Dec 2007 17:28:57 -0000 1.76 *************** *** 1,2 **** --- 1,17 ---- + 2007-12-28 Naohisa Goto + + * lib/bio/appl/blast/report/format0.rb + + Fixed parse error when compisition-based statistics were enabled. + In addition, Bio::Blast::Default::Report#references and + Bio::Blast::Default::Report::HSP#stat_method methods are added. + In NCBI BLAST 2.2.17, default option of composition-based + statistics for blastp or tblastn are changed to be enabled + by default. + + * lib/bio/appl/blast/report/wublast.rb + + Changed to follow the above changes in format0.rb. + 2007-12-26 Naohisa Goto From ngoto at dev.open-bio.org Thu Dec 27 17:36:04 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Dec 2007 17:36:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/sequence common.rb,1.5,1.6 Message-ID: <200712271736.lBRHa4FS027742@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/sequence In directory dev.open-bio.org:/tmp/cvs-serv27687/lib/bio/sequence Modified Files: common.rb Log Message: (ruby 1.9 comliant) in window_search method, changed to avoid shadowing of local variable by loop local variable. Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence/common.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** common.rb 3 Dec 2007 06:19:12 -0000 1.5 --- common.rb 27 Dec 2007 17:36:02 -0000 1.6 *************** *** 178,186 **** # *Returns*:: new Bio::Sequence::NA/AA object def window_search(window_size, step_size = 1) ! i = 0 0.step(self.length - window_size, step_size) do |i| yield self[i, window_size] end ! return self[i + window_size .. -1] end --- 178,187 ---- # *Returns*:: new Bio::Sequence::NA/AA object def window_search(window_size, step_size = 1) ! last_step = 0 0.step(self.length - window_size, step_size) do |i| yield self[i, window_size] + last_step = i end ! return self[last_step + window_size .. -1] end From ngoto at dev.open-bio.org Fri Dec 28 13:35:33 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 13:35:33 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.24,1.25 Message-ID: <200712281335.lBSDZXLJ032744@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv32724/lib/bio/db/pdb Modified Files: pdb.rb Log Message: Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly." error. Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** pdb.rb 18 Dec 2007 13:48:42 -0000 1.24 --- pdb.rb 28 Dec 2007 13:35:30 -0000 1.25 *************** *** 234,238 **** klass.module_eval { symbolary.each do |x| ! define_method(x) { do_parse; super } end } --- 234,238 ---- klass.module_eval { symbolary.each do |x| ! define_method(x) { do_parse; super() } end } *************** *** 268,272 **** klass.module_eval { define_method(:initialize_from_string) { |str| ! r = super do_parse r --- 268,272 ---- klass.module_eval { define_method(:initialize_from_string) { |str| ! r = super(str) do_parse r From ngoto at dev.open-bio.org Fri Dec 28 13:36:10 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 13:36:10 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.76,1.77 Message-ID: <200712281336.lBSDaAOw000304@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv32752 Modified Files: ChangeLog Log Message: changes of lib/bio/sequence/common.rb and lib/bio/db/pdb/pdb.rb by ngoto Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** ChangeLog 27 Dec 2007 17:28:57 -0000 1.76 --- ChangeLog 28 Dec 2007 13:36:08 -0000 1.77 *************** *** 14,17 **** --- 14,29 ---- Changed to follow the above changes in format0.rb. + * lib/bio/sequence/common.rb + + Ruby 1.9 compliant: in window_search method, a local variable name + outside the iterator loop is changed not to be shadowed by the + iterator variable. + + * lib/bio/db/pdb/pdb.rb + + Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit + argument passing of super from method defined by define_method() + is not supported. Specify all arguments explicitly." error. + 2007-12-26 Naohisa Goto From ngoto at dev.open-bio.org Fri Dec 28 14:31:08 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 14:31:08 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.77,1.78 Message-ID: <200712281431.lBSEV8v7000425@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv400 Modified Files: ChangeLog Log Message: Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and Bio::PDB::Record.create_definition_hash (Note: they should only be internally used by PDB parser and users should not call them) are changed to follow the change of Module#constants which returns an array of Symbol instead of String. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** ChangeLog 28 Dec 2007 13:36:08 -0000 1.77 --- ChangeLog 28 Dec 2007 14:31:06 -0000 1.78 *************** *** 26,29 **** --- 26,35 ---- is not supported. Specify all arguments explicitly." error. + Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and + Bio::PDB::Record.create_definition_hash (Note: they should only + be internally used by PDB parser and users should not call them) + are changed to follow the change of Module#constants which + returns an array of Symbol instead of String. + 2007-12-26 Naohisa Goto From ngoto at dev.open-bio.org Fri Dec 28 14:31:08 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 14:31:08 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.25,1.26 Message-ID: <200712281431.lBSEV85x000422@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv400/lib/bio/db/pdb Modified Files: pdb.rb Log Message: Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and Bio::PDB::Record.create_definition_hash (Note: they should only be internally used by PDB parser and users should not call them) are changed to follow the change of Module#constants which returns an array of Symbol instead of String. Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** pdb.rb 28 Dec 2007 13:35:30 -0000 1.25 --- pdb.rb 28 Dec 2007 14:31:06 -0000 1.26 *************** *** 438,442 **** hash = {} constants.each do |x| ! hash[x] = const_get(x) if /\A[A-Z][A-Z0-9]+\z/ =~ x end if x = const_get(:Default) then --- 438,443 ---- hash = {} constants.each do |x| ! x = x.intern # keep compatibility both Ruby 1.8 and 1.9 ! hash[x] = const_get(x) if /\A[A-Z][A-Z0-9]+\z/ =~ x.to_s end if x = const_get(:Default) then *************** *** 1381,1385 **** def_rec([ 2, 1, Pdb_Integer, :serial ]) # dummy field (always 0) ! Definition['END'] = End # Basically just look up the class in Definition hash --- 1382,1386 ---- def_rec([ 2, 1, Pdb_Integer, :serial ]) # dummy field (always 0) ! Definition['END'.intern] = End # Basically just look up the class in Definition hash *************** *** 1387,1397 **** def self.get_record_class(str) t = fetch_record_name(str) if d = Definition[t] then return d end case t ! when 'JRNL' d = Jrnl::Definition[str[12..15].to_s.strip] ! when 'REMARK' case str[7..9].to_i when 1 --- 1388,1399 ---- def self.get_record_class(str) t = fetch_record_name(str) + t = t.intern unless t.empty? if d = Definition[t] then return d end case t ! when :JRNL d = Jrnl::Definition[str[12..15].to_s.strip] ! when :REMARK case str[7..9].to_i when 1 *************** *** 1418,1428 **** --- 1420,1438 ---- Coordinate_fileds = { 'MODEL' => true, + :MODEL => true, 'ENDMDL' => true, + :ENDMDL => true, 'ATOM' => true, + :ATOM => true, 'HETATM' => true, + :HETATM => true, 'SIGATM' => true, + :SIGATM => true, 'SIGUIJ' => true, + :SIGUIJ => true, 'ANISOU' => true, + :ANISOU => true, 'TER' => true, + :TER => true, } From ngoto at dev.open-bio.org Fri Dec 28 14:43:46 2007 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Fri, 28 Dec 2007 14:43:46 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.26,1.27 Message-ID: <200712281443.lBSEhkLR000523@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb In directory dev.open-bio.org:/tmp/cvs-serv503/lib/bio/db/pdb Modified Files: pdb.rb Log Message: changes made from 1.25 to 1.26 were still incomplete and additional changes are added Index: pdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** pdb.rb 28 Dec 2007 14:31:06 -0000 1.26 --- pdb.rb 28 Dec 2007 14:43:44 -0000 1.27 *************** *** 1394,1402 **** case t when :JRNL ! d = Jrnl::Definition[str[12..15].to_s.strip] when :REMARK case str[7..9].to_i when 1 ! d = Remark1::Definition[str[12..15].to_s.strip] when 2 if str[28..37] == 'ANGSTROMS.' then --- 1394,1406 ---- case t when :JRNL ! ts = str[12..15].to_s.strip ! ts = ts.intern unless ts.empty? ! d = Jrnl::Definition[ts] when :REMARK case str[7..9].to_i when 1 ! ts = str[12..15].to_s.strip ! ts = ts.intern unless ts.empty? ! d = Remark1::Definition[ts] when 2 if str[28..37] == 'ANGSTROMS.' then From k at dev.open-bio.org Sat Dec 29 19:19:09 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Sat, 29 Dec 2007 19:19:09 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.87,1.88 Message-ID: <200712291919.lBTJJ9ZT007982@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv7972/lib Modified Files: bio.rb Log Message: * preparation for BioRuby 1.2.1 release Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** bio.rb 14 Dec 2007 16:04:54 -0000 1.87 --- bio.rb 29 Dec 2007 19:19:07 -0000 1.88 *************** *** 11,15 **** module Bio ! BIORUBY_VERSION = [1, 2, 0].extend(Comparable) ### Basic data types --- 11,15 ---- module Bio ! BIORUBY_VERSION = [1, 2, 1].extend(Comparable) ### Basic data types From k at dev.open-bio.org Sat Dec 29 19:19:09 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Sat, 29 Dec 2007 19:19:09 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.78,1.79 gemspec.rb,1.9,1.10 Message-ID: <200712291919.lBTJJ9Yl007978@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv7972 Modified Files: ChangeLog gemspec.rb Log Message: * preparation for BioRuby 1.2.1 release Index: gemspec.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/gemspec.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gemspec.rb 14 Dec 2007 16:22:58 -0000 1.9 --- gemspec.rb 29 Dec 2007 19:19:06 -0000 1.10 *************** *** 3,7 **** spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.2.0" s.author = "BioRuby project" --- 3,7 ---- spec = Gem::Specification.new do |s| s.name = 'bio' ! s.version = "1.2.1" s.author = "BioRuby project" Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** ChangeLog 28 Dec 2007 14:31:06 -0000 1.78 --- ChangeLog 29 Dec 2007 19:19:06 -0000 1.79 *************** *** 1,34 **** 2007-12-28 Naohisa Goto * lib/bio/appl/blast/report/format0.rb ! Fixed parse error when compisition-based statistics were enabled. ! In addition, Bio::Blast::Default::Report#references and ! Bio::Blast::Default::Report::HSP#stat_method methods are added. ! In NCBI BLAST 2.2.17, default option of composition-based ! statistics for blastp or tblastn are changed to be enabled ! by default. * lib/bio/appl/blast/report/wublast.rb ! Changed to follow the above changes in format0.rb. * lib/bio/sequence/common.rb ! Ruby 1.9 compliant: in window_search method, a local variable name ! outside the iterator loop is changed not to be shadowed by the ! iterator variable. * lib/bio/db/pdb/pdb.rb ! Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit ! argument passing of super from method defined by define_method() ! is not supported. Specify all arguments explicitly." error. ! Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and ! Bio::PDB::Record.create_definition_hash (Note: they should only ! be internally used by PDB parser and users should not call them) ! are changed to follow the change of Module#constants which ! returns an array of Symbol instead of String. 2007-12-26 Naohisa Goto --- 1,40 ---- + 2007-12-30 Toshiaki Katayama + + * BioRuby 1.2.1 released + + This version is not Ruby 1.9 (released few days ago) compliant yet. + 2007-12-28 Naohisa Goto * lib/bio/appl/blast/report/format0.rb ! Fixed parse error when compisition-based statistics were enabled. ! In addition, Bio::Blast::Default::Report#references and ! Bio::Blast::Default::Report::HSP#stat_method methods are added. ! In NCBI BLAST 2.2.17, default option of composition-based ! statistics for blastp or tblastn are changed to be enabled ! by default. * lib/bio/appl/blast/report/wublast.rb ! Changed to follow the above changes in format0.rb. * lib/bio/sequence/common.rb ! Ruby 1.9 compliant: in window_search method, a local variable name ! outside the iterator loop is changed not to be shadowed by the ! iterator variable. * lib/bio/db/pdb/pdb.rb ! Ruby 1.9 compliant: changed to avoid "RuntimeError: implicit ! argument passing of super from method defined by define_method() ! is not supported. Specify all arguments explicitly." error. ! Ruby 1.9 compliant: Bio::PDB::Record.get_record_class and ! Bio::PDB::Record.create_definition_hash (Note: they should only ! be internally used by PDB parser and users should not call them) ! are changed to follow the change of Module#constants which ! returns an array of Symbol instead of String. 2007-12-26 Naohisa Goto *************** *** 62,80 **** * lib/bio/db/pdb/pdb.rb ! Bio::PDB#inspect is added to prevent memory exhaust problem. ! ([BioRuby] Parse big PDB use up all memory) * lib/bio/db/pdb/model.rb ! Bio::PDB::Model#inspect is added. * lib/bio/db/pdb/chain.rb ! Bio::PDB::Chain#inspect is added. * lib/bio/db/pdb/residue.rb ! Bio::PDB::Residue#inspect is added. ! This also affects Bio::PDB::Heterogen#inspect. 2007-12-15 Toshiaki Katayama --- 68,86 ---- * lib/bio/db/pdb/pdb.rb ! Bio::PDB#inspect is added to prevent memory exhaust problem. ! ([BioRuby] Parse big PDB use up all memory) * lib/bio/db/pdb/model.rb ! Bio::PDB::Model#inspect is added. * lib/bio/db/pdb/chain.rb ! Bio::PDB::Chain#inspect is added. * lib/bio/db/pdb/residue.rb ! Bio::PDB::Residue#inspect is added. ! This also affects Bio::PDB::Heterogen#inspect. 2007-12-15 Toshiaki Katayama