From ngoto at pub.open-bio.org Tue Nov 1 10:34:47 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:51:52 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io flatfile.rb,1.40,1.41 Message-ID: <200511011534.jA1FYlVL008186@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv8155 Modified Files: flatfile.rb Log Message: Format autodetection of EMBL data failed after EMBL release 76 (Sep. 2003). ( http://www.ebi.ac.uk/embl/Documentation/Release_notes/relnotes75/relnotes.html#2.3 ) Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile.rb,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** flatfile.rb 1 Nov 2005 05:32:24 -0000 1.40 --- flatfile.rb 1 Nov 2005 15:34:45 -0000 1.41 *************** *** 390,394 **** Bio::MEDLINE ! when /^ID .+\; *(DNA|RNA|XXX)\;/ Bio::EMBL when /^ID .+\; *PRT\;/ --- 390,394 ---- Bio::MEDLINE ! when /^ID .+\; .*(DNA|RNA|XXX)\;/ Bio::EMBL when /^ID .+\; *PRT\;/ From ngoto at pub.open-bio.org Tue Nov 1 00:32:26 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:51:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db nbrf.rb,1.5,1.6 Message-ID: <200511010532.jA15WQVL006802@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv6747/db Modified Files: nbrf.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: nbrf.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/nbrf.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** nbrf.rb 31 Oct 2005 23:58:19 -0000 1.5 --- nbrf.rb 1 Nov 2005 05:32:24 -0000 1.6 *************** *** 36,41 **** require 'bio/sequence' ! # Sequence data class for NBRF/PIR flatfile format. ! module Bio #:nodoc: class NBRF < DB #-- --- 36,42 ---- require 'bio/sequence' ! module Bio ! ! # Sequence data class for NBRF/PIR flatfile format. class NBRF < DB #-- From ngoto at pub.open-bio.org Tue Nov 1 00:32:26 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:51:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io flatfile.rb,1.39,1.40 Message-ID: <200511010532.jA15WQVL006806@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv6747/io Modified Files: flatfile.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile.rb,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** flatfile.rb 1 Nov 2005 03:15:33 -0000 1.39 --- flatfile.rb 1 Nov 2005 05:32:24 -0000 1.40 *************** *** 29,33 **** # ! module Bio #:nodoc: # Bio::FlatFile is a helper and wrapper class to read a biological data file. --- 29,33 ---- # ! module Bio # Bio::FlatFile is a helper and wrapper class to read a biological data file. From ngoto at pub.open-bio.org Tue Nov 1 00:32:25 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:51:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/sim4 report.rb,1.5,1.6 Message-ID: <200511010532.jA15WPVL006781@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/sim4 In directory pub.open-bio.org:/tmp/cvs-serv6747/d/sim4 Modified Files: report.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4/report.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** report.rb 31 Oct 2005 11:09:22 -0000 1.5 --- report.rb 1 Nov 2005 05:32:23 -0000 1.6 *************** *** 32,37 **** # ! module Bio #:nodoc: ! class Sim4 #:nodoc: # Bio::Sim4::Report is the sim4 report parser class. --- 32,37 ---- # ! module Bio ! class Sim4 # Bio::Sim4::Report is the sim4 report parser class. From ngoto at pub.open-bio.org Tue Nov 1 00:32:26 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:52:02 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blat report.rb,1.4,1.5 Message-ID: <200511010532.jA15WQVL006814@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blat In directory pub.open-bio.org:/tmp/cvs-serv6747/d/blat Modified Files: report.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blat/report.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** report.rb 31 Oct 2005 11:09:22 -0000 1.4 --- report.rb 1 Nov 2005 05:32:24 -0000 1.5 *************** *** 41,46 **** require 'bio' ! module Bio #:nodoc: ! class Blat #:nodoc: # Bio::Blat::Report is a BLAT report parser class. --- 41,46 ---- require 'bio' ! module Bio ! class Blat # Bio::Blat::Report is a BLAT report parser class. From ngoto at pub.open-bio.org Tue Nov 1 00:32:26 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:52:02 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/mafft report.rb,1.6,1.7 Message-ID: <200511010532.jA15WQVL006810@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/mafft In directory pub.open-bio.org:/tmp/cvs-serv6747/d/mafft Modified Files: report.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 31 Oct 2005 12:47:12 -0000 1.6 --- report.rb 1 Nov 2005 05:32:24 -0000 1.7 *************** *** 43,48 **** require 'bio/appl/mafft' ! module Bio #:nodoc: ! class MAFFT #:nodoc: # MAFFT result parser class. --- 43,48 ---- require 'bio/appl/mafft' ! module Bio ! class MAFFT # MAFFT result parser class. From nakao at pub.open-bio.org Tue Nov 1 00:15:17 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 1 16:52:02 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl psort.rb,1.7,1.8 Message-ID: <200511010515.jA15FHVL006674@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv6652/lib/bio/appl Modified Files: psort.rb Log Message: * Removed TAB. Index: psort.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** psort.rb 31 Oct 2005 10:26:58 -0000 1.7 --- psort.rb 1 Nov 2005 05:15:15 -0000 1.8 *************** *** 64,74 **** WWWServer = { 'IMSUT' => {'host' => 'psort.hgc.jp', #'psort.ims.u-tokyo.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'}, 'Okazaki' => {'host' => 'psort.nibb.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', 'PSORT2' => '/cgi-bin/runpsort.pl'}, 'Peking' => {'host' => 'srs.pku.edu.en:8088', ! 'PSORT1' => '/cgi-bin/okumura.pl', 'PSORT2' => '/cgi-bin/runpsort.pl'} } --- 64,74 ---- WWWServer = { 'IMSUT' => {'host' => 'psort.hgc.jp', #'psort.ims.u-tokyo.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'}, 'Okazaki' => {'host' => 'psort.nibb.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', 'PSORT2' => '/cgi-bin/runpsort.pl'}, 'Peking' => {'host' => 'srs.pku.edu.en:8088', ! 'PSORT1' => '/cgi-bin/okumura.pl', 'PSORT2' => '/cgi-bin/runpsort.pl'} } *************** *** 135,144 **** # Bio::CGIDriver#parse_report. An API skelton. def parse_report(result_body) ! # The routin should be provided in the inherited class end # Erases HTML tags def erase_html_tags(str) ! return str.gsub(/<\S.*?>/,'') end --- 135,144 ---- # Bio::CGIDriver#parse_report. An API skelton. def parse_report(result_body) ! # The routin should be provided in the inherited class end # Erases HTML tags def erase_html_tags(str) ! return str.gsub(/<\S.*?>/,'') end *************** *** 450,454 **** begin ! require 'psort/report.rb' rescue LoadError end --- 450,454 ---- begin ! require 'psort/report.rb' rescue LoadError end From ngoto at pub.open-bio.org Tue Nov 1 00:32:26 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:52:15 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/bl2seq report.rb,1.4,1.5 Message-ID: <200511010532.jA15WQVL006794@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq In directory pub.open-bio.org:/tmp/cvs-serv6747/d/bl2seq Modified Files: report.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq/report.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** report.rb 31 Oct 2005 14:37:30 -0000 1.4 --- report.rb 1 Nov 2005 05:32:23 -0000 1.5 *************** *** 34,41 **** require 'bio/appl/blast/format0' ! module Bio #:nodoc: ! class Blast #:nodoc: ! class Bl2seq #:nodoc: # Bio::Bl2seq::Report is a NCBI bl2seq (BLAST 2 sequences) output parser. --- 34,41 ---- require 'bio/appl/blast/format0' ! module Bio ! class Blast ! class Bl2seq # Bio::Bl2seq::Report is a NCBI bl2seq (BLAST 2 sequences) output parser. From ngoto at pub.open-bio.org Tue Nov 1 00:32:26 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:52:15 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/spidey report.rb,1.6,1.7 Message-ID: <200511010532.jA15WQVL006798@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/spidey In directory pub.open-bio.org:/tmp/cvs-serv6747/d/spidey Modified Files: report.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/spidey/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 31 Oct 2005 10:56:14 -0000 1.6 --- report.rb 1 Nov 2005 05:32:24 -0000 1.7 *************** *** 41,46 **** require 'bio' ! module Bio #:nodoc: ! class Spidey #:nodoc: # Spidey report parser class. --- 41,46 ---- require 'bio' ! module Bio ! class Spidey # Spidey report parser class. From ngoto at pub.open-bio.org Tue Nov 1 00:32:25 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:52:18 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/clustalw report.rb,1.7,1.8 Message-ID: <200511010532.jA15WPVL006779@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/clustalw In directory pub.open-bio.org:/tmp/cvs-serv6747/d/clustalw Modified Files: report.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 31 Oct 2005 13:56:09 -0000 1.7 --- report.rb 1 Nov 2005 05:32:23 -0000 1.8 *************** *** 42,47 **** require 'bio/appl/clustalw' ! module Bio #:nodoc: ! class ClustalW #:nodoc: # CLUSTAL W result data (*.aln file) parser class. --- 42,47 ---- require 'bio/appl/clustalw' ! module Bio ! class ClustalW # CLUSTAL W result data (*.aln file) parser class. From nakao at pub.open-bio.org Tue Nov 1 00:15:17 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 1 16:52:19 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/psort report.rb,1.10,1.11 Message-ID: <200511010515.jA15FHVL006666@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/psort In directory pub.open-bio.org:/tmp/cvs-serv6652/lib/bio/appl/psort Modified Files: report.rb Log Message: * Removed TAB. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort/report.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** report.rb 31 Oct 2005 13:13:35 -0000 1.10 --- report.rb 1 Nov 2005 05:15:15 -0000 1.11 *************** *** 300,304 **** report.prob = self.set_kNN_prob(ent[2]) ! report.set_prediction(ent[3]) return report --- 300,304 ---- report.prob = self.set_kNN_prob(ent[2]) ! report.set_prediction(ent[3]) return report *************** *** 379,389 **** end ! report.set_header_line(ent.shift) report.seq = Bio::Sequence::AA.new(ent.shift) fent, pent = self.divent(ent) ! report.set_features(fent) ! report.prob = self.set_kNN_prob(pent[0].strip) ! report.set_prediction(pent[1].strip) return report --- 379,389 ---- end ! report.set_header_line(ent.shift) report.seq = Bio::Sequence::AA.new(ent.shift) fent, pent = self.divent(ent) ! report.set_features(fent) ! report.prob = self.set_kNN_prob(pent[0].strip) ! report.set_prediction(pent[1].strip) return report From nakao at pub.open-bio.org Tue Nov 1 00:15:17 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 1 16:52:19 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/genscan report.rb,1.5,1.6 Message-ID: <200511010515.jA15FHVL006670@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/genscan In directory pub.open-bio.org:/tmp/cvs-serv6652/lib/bio/appl/genscan Modified Files: report.rb Log Message: * Removed TAB. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/genscan/report.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** report.rb 8 Sep 2005 01:22:09 -0000 1.5 --- report.rb 1 Nov 2005 05:15:15 -0000 1.6 *************** *** 126,130 **** @matrix = $1 else ! raise "Error: [#{line}]" end end --- 126,130 ---- @matrix = $1 else ! raise "Error: [#{line}]" end end From nakao at pub.open-bio.org Tue Nov 1 00:13:59 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 1 16:52:20 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl/tmhmm test_report.rb, NONE, 1.1 Message-ID: <200511010513.jA15DxVL006632@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/tmhmm In directory pub.open-bio.org:/tmp/cvs-serv6622/test/unit/bio/appl/tmhmm Added Files: test_report.rb Log Message: * Initial import. --- NEW FILE: test_report.rb --- # # test/unit/bio/appl/tmhmm/test_report.rb - Unit test for Bio::TMHMM::Report # # Copyright (C) 2005 Mitsuteru Nakao # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_report.rb,v 1.1 2005/11/01 05:13:57 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/appl/tmhmm/report' module Bio bioruby_root = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5)).cleanpath.to_s test_data = Pathname.new(File.join(bioruby_root, 'test', 'data', 'TMHMM')).cleanpath.to_s TMHMMReport = File.open(File.join(test_data, 'sample.report')).read class TestTMHMMReport_reports < Test::Unit::TestCase def test_reports assert(Bio::TMHMM.reports("")) end end class TestTMHMMReport < Test::Unit::TestCase def setup @obj = Bio::TMHMM::Report.new(TMHMMReport) end def test_entry_id assert_equal(@obj.entry_id, 'O42385') end def test_query_len assert_equal(@obj.query_len, 423) end def test_predicted_tmhs assert_equal(@obj.predicted_tmhs, 7) end def test_tmhs assert_equal(@obj.tmhs.class, Array) assert_equal(@obj.tmhs.size, 15) end def test_exp_aas_in_tmhs assert_equal(@obj.exp_aas_in_tmhs, 157.40784) end def test_exp_first_60aa assert_equal(@obj.exp_first_60aa, 13.85627) end def test_total_prob_of_N_in assert_equal(@obj.total_prob_of_N_in, 0.00993) end def test_helix assert_equal(@obj.helix.size, 7) assert_equal(@obj.helix[0].class, Bio::TMHMM::TMH) end def test_to_s str = ["# O42385\tLength:\t423", "# O42385\tNumber of predicted TMHs:\t7", "# O42385\tExp number of AAs in THMs:\t157.40784", "# O42385\tExp number, first 60 AAs:\t13.85627", "# O42385\tTotal prob of N-in:\t0.00993", "O42385\tTMHMM2.0\toutside\t1\t46", "O42385\tTMHMM2.0\tTMhelix\t47\t69", "O42385\tTMHMM2.0\tinside\t70\t81", "O42385\tTMHMM2.0\tTMhelix\t82\t104", "O42385\tTMHMM2.0\toutside\t105\t118", "O42385\tTMHMM2.0\tTMhelix\t119\t141", "O42385\tTMHMM2.0\tinside\t142\t161", "O42385\tTMHMM2.0\tTMhelix\t162\t184", "O42385\tTMHMM2.0\toutside\t185\t205", "O42385\tTMHMM2.0\tTMhelix\t206\t228", "O42385\tTMHMM2.0\tinside\t229\t348", "O42385\tTMHMM2.0\tTMhelix\t349\t371", "O42385\tTMHMM2.0\toutside\t372\t380", "O42385\tTMHMM2.0\tTMhelix\t381\t403", "O42385\tTMHMM2.0\tinside\t404\t423"].join("\n") assert_equal(@obj.to_s, str) end end # TestTMHMMReport class TestTMHMMTMH < Test::Unit::TestCase def setup @obj = Bio::TMHMM::Report.new(TMHMMReport).tmhs.first end def test_entry_id assert_equal(@obj.entry_id, 'O42385') end def test_version assert_equal(@obj.version, 'TMHMM2.0') end def test_status assert_equal(@obj.status, 'outside') end def test_range assert_equal(@obj.range, 1..46) end def test_pos assert_equal(@obj.pos, 1..46) end end # class TestTMHMMTMH end From ngoto at pub.open-bio.org Tue Nov 1 00:32:25 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:52:21 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb, 1.15, 1.16 wublast.rb, 1.3, 1.4 Message-ID: <200511010532.jA15WPVL006789@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory pub.open-bio.org:/tmp/cvs-serv6747/d/blast Modified Files: format0.rb wublast.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: wublast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/wublast.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wublast.rb 31 Oct 2005 19:24:14 -0000 1.3 --- wublast.rb 1 Nov 2005 05:32:23 -0000 1.4 *************** *** 37,42 **** require 'bio/appl/blast/format0' ! module Bio #:nodoc: ! class Blast #:nodoc: module WU #:nodoc: --- 37,42 ---- require 'bio/appl/blast/format0' ! module Bio ! class Blast module WU #:nodoc: Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** format0.rb 31 Oct 2005 19:22:27 -0000 1.15 --- format0.rb 1 Nov 2005 05:32:23 -0000 1.16 *************** *** 46,51 **** require 'bio/io/flatfile' ! module Bio #:nodoc: ! class Blast #:nodoc: module Default #:nodoc: --- 46,51 ---- require 'bio/io/flatfile' ! module Bio ! class Blast module Default #:nodoc: From ngoto at pub.open-bio.org Tue Nov 1 00:32:25 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Tue Nov 1 16:52:22 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl clustalw.rb, 1.8, 1.9 sim4.rb, 1.3, 1.4 mafft.rb, 1.7, 1.8 Message-ID: <200511010532.jA15WPVL006775@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv6747/d Modified Files: clustalw.rb sim4.rb mafft.rb Log Message: changed RDoc: removed many #:nodoc: fixed some RDoc syntax mistakes. Index: sim4.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sim4.rb 31 Oct 2005 20:03:41 -0000 1.3 --- sim4.rb 1 Nov 2005 05:32:23 -0000 1.4 *************** *** 35,39 **** require 'tempfile' ! module Bio #:nodoc: # The sim4 execution wrapper class. --- 35,39 ---- require 'tempfile' ! module Bio # The sim4 execution wrapper class. Index: clustalw.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** clustalw.rb 31 Oct 2005 19:46:19 -0000 1.8 --- clustalw.rb 1 Nov 2005 05:32:23 -0000 1.9 *************** *** 45,49 **** require 'bio/alignment' ! module Bio #:nodoc: # Bio::ClustalW is a CLUSTAL W execution wrapper class. --- 45,49 ---- require 'bio/alignment' ! module Bio # Bio::ClustalW is a CLUSTAL W execution wrapper class. Index: mafft.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mafft.rb 31 Oct 2005 13:17:18 -0000 1.7 --- mafft.rb 1 Nov 2005 05:32:23 -0000 1.8 *************** *** 48,52 **** require 'open3' ! module Bio #:nodoc: # Bio::MAFFT is a wrapper class to execute MAFFT. --- 48,52 ---- require 'open3' ! module Bio # Bio::MAFFT is a wrapper class to execute MAFFT. From nakao at pub.open-bio.org Wed Nov 2 02:30:16 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 2 02:28:06 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl common.rb, 1.7, 1.8 embl.rb, 1.24, 1.25 sptr.rb, 1.28, 1.29 Message-ID: <200511020730.jA27UGVL012435@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory pub.open-bio.org:/tmp/cvs-serv12425/lib/bio/db/embl Modified Files: common.rb embl.rb sptr.rb Log Message: * Removed TAB. Index: sptr.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/sptr.rb,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** sptr.rb 1 Nov 2005 02:16:06 -0000 1.28 --- sptr.rb 2 Nov 2005 07:30:14 -0000 1.29 *************** *** 69,75 **** if key ! @data['ID'][key] # String/Int else ! @data['ID'] # Hash end end --- 69,75 ---- if key ! @data['ID'][key] # String/Int else ! @data['ID'] # Hash end end *************** *** 517,521 **** when nil ! return @data['CC'] else --- 517,521 ---- when nil ! return @data['CC'] else Index: embl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/embl.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** embl.rb 1 Nov 2005 02:16:06 -0000 1.24 --- embl.rb 2 Nov 2005 07:30:14 -0000 1.25 *************** *** 242,251 **** next if line =~ /^FEATURES/ ! head = line[0,20].strip # feature key (source, CDS, ...) ! body = line[20,60].chomp # feature value (position, /qualifier=) if line =~ /^FT {3}(\S+)/ ! ary.push([ $1, body ]) # [ feature, position, /q="data", ... ] elsif body =~ /^ \// and not in_quote ! ary.last.push(body) # /q="data..., /q=data, /q if body =~ /=" / and body !~ /"$/ --- 242,251 ---- next if line =~ /^FEATURES/ ! head = line[0,20].strip # feature key (source, CDS, ...) ! body = line[20,60].chomp # feature value (position, /qualifier=) if line =~ /^FT {3}(\S+)/ ! ary.push([ $1, body ]) # [ feature, position, /q="data", ... ] elsif body =~ /^ \// and not in_quote ! ary.last.push(body) # /q="data..., /q=data, /q if body =~ /=" / and body !~ /"$/ *************** *** 254,258 **** else ! ary.last.last << body # ...data..., ...data..." if body =~ /"$/ --- 254,258 ---- else ! ary.last.last << body # ...data..., ...data..." if body =~ /"$/ Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/common.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** common.rb 1 Nov 2005 02:16:06 -0000 1.7 --- common.rb 2 Nov 2005 07:30:14 -0000 1.8 *************** *** 75,80 **** module Common ! DELIMITER = RS = "\n//\n" ! TAGSIZE = 5 def initialize(entry) --- 75,81 ---- module Common ! DELIMITER = "\n//\n" ! RS = DELIMITER ! TAGSIZE = 5 def initialize(entry) *************** *** 119,123 **** @data['DE'] end ! alias description de alias definition de # API --- 120,124 ---- @data['DE'] end ! alias description de alias definition de # API *************** *** 216,220 **** if get('KW').size > 0 tmp = fetch('KW').sub(/.$/,'') ! @data['KW'] = tmp.split(/;/).map {|e| e.strip } else @data['KW'] = [] --- 217,221 ---- if get('KW').size > 0 tmp = fetch('KW').sub(/.$/,'') ! @data['KW'] = tmp.split(/;/).map {|e| e.strip } else @data['KW'] = [] From nakao at pub.open-bio.org Thu Nov 3 05:51:01 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Thu Nov 3 05:48:43 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/psort report.rb,1.11,1.12 Message-ID: <200511031051.jA3Ap1VL019112@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/psort In directory pub.open-bio.org:/tmp/cvs-serv19102/lib/bio/appl/psort Modified Files: report.rb Log Message: * Fixed typo bugs. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort/report.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** report.rb 1 Nov 2005 05:15:15 -0000 1.11 --- report.rb 3 Nov 2005 10:50:58 -0000 1.12 *************** *** 53,61 **** rpt = self.new rpt.raw = output_report ! query_info = str.scan(/^Query Information\n\n(.+?)\n\n/m)[0][0].split(/\n/) ! result_info = str.scan(/^Result Information\n\n(.+?)\n\n\*/m)[0][0] ! step1 = str.scan(/^\*\*\* Reasoning Step: 1\n\n(.+?)\n\n/m)[0][0] ! step2 = str.scan(/^\*\*\* Reasoning Step: 2\n\n(.+?)\n\n/m)[0][0] ! final_result = str.scan(/\n\n----- Final Results -----\n\n(.+?)\n\n\n/m)[0][0] rpt.entry_id = query_info[2].scan(/^>(\S+) */).to_s --- 53,61 ---- rpt = self.new rpt.raw = output_report ! query_info = output_report.scan(/^Query Information\n\n(.+?)\n\n/m)[0][0].split(/\n/) ! result_info = output_report.scan(/^Result Information\n\n(.+?)\n\n\*/m)[0][0] ! step1 = output_report.scan(/^\*\*\* Reasoning Step: 1\n\n(.+?)\n\n/m)[0][0] ! step2 = output_report.scan(/^\*\*\* Reasoning Step: 2\n\n(.+?)\n\n/m)[0][0] ! final_result = output_report.scan(/\n\n----- Final Results -----\n\n(.+?)\n\n\n/m)[0][0] rpt.entry_id = query_info[2].scan(/^>(\S+) */).to_s *************** *** 408,412 **** def self.divent(entry) boundary = entry.index(BOUNDARY) ! return ent[0..(boundary - 1)], ent[(boundary + 2)..ent.length] end --- 408,412 ---- def self.divent(entry) boundary = entry.index(BOUNDARY) ! return entry[0..(boundary - 1)], entry[(boundary + 2)..(entry.length)] end From k at pub.open-bio.org Fri Nov 4 12:30:37 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:28:14 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.41,1.42 Message-ID: <200511041730.jA4HUbVL026308@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv26300 Modified Files: ChangeLog Log Message: * midi, colorscheme Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** ChangeLog 26 Sep 2005 06:59:40 -0000 1.41 --- ChangeLog 4 Nov 2005 17:30:35 -0000 1.42 *************** *** 1,2 **** --- 1,18 ---- + 2005-10-23 Toshiaki Katayama + + * lib/bio/util/color_scheme + + Newly contributed Bio::ColorScheme + + * lib/bio/db/kegg/kgml.rb + + Newly added KEGG KGML parser. + + 2005-10-05 Toshiaki Katayama + + * lib/bio/shell/plugin/midi.rb + + Sequcne to MIDI plugin is contributed by Natsuhiro Ichinose + 2005-09-25 Toshiaki Katayama From k at pub.open-bio.org Fri Nov 4 12:31:34 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:29:37 2005 Subject: [BioRuby-cvs] bioruby README.DEV,1.2,1.3 Message-ID: <200511041731.jA4HVYVL026385@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv26366 Modified Files: README.DEV Log Message: * sample header is changed to RDoc Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README.DEV 26 Sep 2005 02:07:02 -0000 1.2 --- README.DEV 4 Nov 2005 17:31:32 -0000 1.3 *************** *** 53,59 **** # ! # bio/foo/bar.rb - foo bar class # ! # Copyright (C) 2005 Ruby B. Hacker # # This library is free software; you can redistribute it and/or --- 53,75 ---- # ! # = bio/foo/bar.rb - foo bar class # ! # Copyright:: Copyright (C) 2005 ! # Bio R. Hacker , ! # Chem R. Hacker ! # Lisence:: LGPL ! # ! # $Id$ ! # ! # == Blah blah blah ! # ! # blah blah blah ... ! # ! # === Examples ! # ! # hoge = Bio::Foo::Bar.new ! # puts hoge.fuga ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 71,75 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # - # $Id$ # --- 87,90 ---- *************** *** 77,87 **** The RDoc format is becoming de facto standard for the Ruby documentation. ! ! So, we are now in transition from the RD format to the RDoc format ! as we had been written the API documentations in the RD format and ! put them at the end of each file. Additional tutorial documents and some working examples are also ! welcome when you contribute your codes. === Testing code should use 'test/unit' --- 92,102 ---- The RDoc format is becoming de facto standard for the Ruby documentation. ! So, we are now in transition from the RD format which we have been used ! to the RDoc format in API documentations. Additional tutorial documents and some working examples are also ! welcome when you contribute your codes. You may also able to use ! the header part of the file for this purpose as shown in the previous ! section. === Testing code should use 'test/unit' From k at pub.open-bio.org Fri Nov 4 12:33:31 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:31:05 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.2,1.3 Message-ID: <200511041733.jA4HXVVL026511@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv26493/doc Modified Files: Changes-0.7.rd Log Message: * kegg/microarray to kegg/expression, pathway, genbank.rb, embl.rb Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Changes-0.7.rd 26 Sep 2005 07:27:19 -0000 1.2 --- Changes-0.7.rd 4 Nov 2005 17:33:29 -0000 1.3 *************** *** 62,63 **** --- 62,105 ---- is ambiguous. + --- Bio::KEGG::Microarrays, Bio::KEGG::Microarray + + * lib/bio/db/kegg/microarray.rb is renamed to lib/bio/db/kegg/expression.rb + * Bio::KEGG::Microarray is renamed to Bio::KEGG::EXPRESSION + * Bio::KEGG::Microarrays is removed + + Bio::KEGG::Microarrays was intended to store a series of microarray + expressions as a Hash of Array -like data structure, + + gene1 => [exp1, exp2, exp3, ... ] + gene2 => [exp1, exp2, exp3, ... ] + + however, it is not utilized well and more suitable container class + can be proposed. Until then, this class is removed. + + --- Bio::Pathway + + * Bio::Pathway#nodes returns an Array of the node objects instead of + the number of the node objects. + * Bio::Pathway#edges returns an Array of the edge objects instead of + the number of the edge objects. + + === Deleted files + + : lib/bio/db/genbank.rb + : lib/bio/db/embl.rb + + These files are removed as we changed to use autoload. You can safely + replace + + require 'bio/db/genbank' + + or + + require 'bio/db/embl' + + in your code to + + require 'bio' + + and this change will also speeds up loading time if you only need + one of the sub classes under the genbank/ or embl/ directory. From k at pub.open-bio.org Fri Nov 4 12:34:44 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:32:18 2005 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.56,1.57 Message-ID: <200511041734.jA4HYiVL026607@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory pub.open-bio.org:/tmp/cvs-serv26577/lib Modified Files: bio.rb Log Message: * converted to RDoc * added bio/db/kegg/kgml * changed kegg/microarray to kegg/expression Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** bio.rb 23 Oct 2005 15:34:30 -0000 1.56 --- bio.rb 4 Nov 2005 17:34:42 -0000 1.57 *************** *** 1,6 **** # ! # bio.rb - Loading all BioRuby modules # ! # Copyright (C) 2001-2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio.rb - Loading all BioRuby modules # ! # Copyright:: Copyright (C) 2001-2005 ! # Toshiaki Katayama ! # License:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 40,44 **** autoload :Feature, 'bio/feature' ! autoload :Features, 'bio/feature' # to_gff ## References/Reference --- 46,50 ---- autoload :Feature, 'bio/feature' ! autoload :Features, 'bio/feature' ## References/Reference *************** *** 115,122 **** autoload :BRITE, 'bio/db/kegg/brite' autoload :CELL, 'bio/db/kegg/cell' ! autoload :Microarray, 'bio/db/kegg/microarray' ! autoload :Microarrays, 'bio/db/kegg/microarray' autoload :Keggtab, 'bio/db/kegg/keggtab' autoload :KO, 'bio/db/kegg/ko' end --- 121,128 ---- autoload :BRITE, 'bio/db/kegg/brite' autoload :CELL, 'bio/db/kegg/cell' ! autoload :EXPRESSION, 'bio/db/kegg/expression' autoload :Keggtab, 'bio/db/kegg/keggtab' autoload :KO, 'bio/db/kegg/ko' + autoload :KGML, 'bio/db/kegg/kgml' end From k at pub.open-bio.org Fri Nov 4 12:36:02 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:33:35 2005 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.2,1.3 Message-ID: <200511041736.jA4Ha2VL026712@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv26692/lib/bio Modified Files: command.rb Log Message: added , for name separater in copyright Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** command.rb 30 Oct 2005 16:41:37 -0000 1.2 --- command.rb 4 Nov 2005 17:36:00 -0000 1.3 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2003-2005 ! # Naohisa Goto # Toshiaki Katayama # License:: LGPL --- 3,7 ---- # # Copyright:: Copyright (C) 2003-2005 ! # Naohisa Goto , # Toshiaki Katayama # License:: LGPL From k at pub.open-bio.org Fri Nov 4 12:36:49 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:34:24 2005 Subject: [BioRuby-cvs] bioruby/lib/bio feature.rb,1.7,1.8 Message-ID: <200511041736.jA4HanVL026782@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv26766/lib/bio Modified Files: feature.rb Log Message: * Author:: is removed in RDoc * added todo Index: feature.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/feature.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** feature.rb 23 Oct 2005 07:21:00 -0000 1.7 --- feature.rb 4 Nov 2005 17:36:47 -0000 1.8 *************** *** 2,10 **** # = bio/feature.rb - Features/Feature class (GenBank Feature table) # ! # Author:: Toshiaki Katayama ! # Copyright:: Copyright (c) 2002, 2005 BioRuby project # License:: LGPL # # $Id$ # # == INSD Feature table definition --- 2,15 ---- # = bio/feature.rb - Features/Feature class (GenBank Feature table) # ! # Copyright:: Copyright (c) 2002, 2005 ! # Toshiaki Katayama # License:: LGPL # # $Id$ + # + #-- + # *TODO* + # add to_gff method + #++ # # == INSD Feature table definition From k at pub.open-bio.org Fri Nov 4 12:39:46 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:37:22 2005 Subject: [BioRuby-cvs] bioruby/lib/bio pathway.rb,1.32,1.33 Message-ID: <200511041739.jA4HdkVL026947@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv26844/lib/bio Modified Files: pathway.rb Log Message: * bug fix patch contributed by Moses Hohman which was kept in test/unit/bio/test_pathway.rb is ported. note that this module is broken by the previous changes (nodes/edges?) and still not pass the unit tests... Index: pathway.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/pathway.rb,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** pathway.rb 23 Oct 2005 09:48:58 -0000 1.32 --- pathway.rb 4 Nov 2005 17:39:44 -0000 1.33 *************** *** 2,9 **** # = bio/pathway.rb - Binary relations and Graph algorithms # ! # Author:: Toshiaki Katayama ! # Shuichi Kawashima # Nobuya Tanaka - # Copyright:: Copyright (c) 2001, 2005 BioRuby project # License:: LGPL # --- 2,9 ---- # = bio/pathway.rb - Binary relations and Graph algorithms # ! # Copyright:: Copyright (c) 2001, 2005 ! # Toshiaki Katayama , ! # Shuichi Kawashima , # Nobuya Tanaka # License:: LGPL # *************** *** 53,58 **** #-- ! #require 'chem' ! #include Chem::Graph #++ --- 53,58 ---- #-- ! # require 'chem' ! # include Chem::Graph #++ *************** *** 295,301 **** @graph.each do |from, hash| next unless @label[from] hash.each do |to, relation| next unless @label[to] ! sub_graph.append(Relation.new(from, to, relation)) end end --- 295,302 ---- @graph.each do |from, hash| next unless @label[from] + sub_graph.graph[from] = {} hash.each do |to, relation| next unless @label[to] ! sub_graph.graph[from][to] = relation end end *************** *** 322,337 **** # def cliquishness(node) neighbors = @graph[node].keys ! sg = subgraph(neighbors) ! if sg.graph.size != 0 ! edges = sg.edges.length / 2.0 ! nodes = sg.nodes.length ! complete = (nodes.length * (nodes.length - 1)) / 2.0 ! return edges/complete else ! return 0.0 end end # Returns frequency of the nodes having same number of edges as hash --- 323,348 ---- # def cliquishness(node) + if not undirected? + raise "Can't calculate cliquishness in directed graph" + end neighbors = @graph[node].keys ! case neighbors.size ! when 0 ! return Float::NaN ! when 1 ! return 1 else ! num_neighbor_edges = subgraph_adjacency_matrix(neighbors).flatten.sum / 2 ! num_complete_edges = neighbors.size * (neighbors.size - 1) / 2 ! return num_neighbor_edges.to_f / num_complete_edges.to_f end end + def subgraph_adjacency_matrix(nodes) + adjacency_matrix = to_matrix(0).to_a + node_indices = nodes.collect {|x| @index[x]} + subgraph = adjacency_matrix.values_at(*node_indices) + subgraph.collect!{|row| row.values_at(*node_indices)} + end # Returns frequency of the nodes having same number of edges as hash From k at pub.open-bio.org Fri Nov 4 12:40:35 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:38:08 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.3,1.4 Message-ID: <200511041740.jA4HeZVL027026@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv27016/lib/bio Modified Files: shell.rb Log Message: * converted to RDoc Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shell.rb 5 Oct 2005 08:58:33 -0000 1.3 --- shell.rb 4 Nov 2005 17:40:33 -0000 1.4 *************** *** 1,6 **** # ! # bio/shell.rb - Loading all BioRuby shell features # ! # Copyright (C) 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/shell.rb - Loading all BioRuby shell features # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 32,39 **** require 'bio/shell/core' require 'bio/shell/session' require 'bio/shell/plugin/seq' require 'bio/shell/plugin/flatfile' require 'bio/shell/plugin/obda' ! require 'bio/shell/plugin/midi' extend Core --- 38,49 ---- require 'bio/shell/core' require 'bio/shell/session' + #require 'bio/shell/help' require 'bio/shell/plugin/seq' + require 'bio/shell/plugin/midi' require 'bio/shell/plugin/flatfile' require 'bio/shell/plugin/obda' ! require 'bio/shell/plugin/keggapi' ! #require 'bio/shell/plugin/das' ! #require 'bio/shell/plugin/demo' extend Core From k at pub.open-bio.org Fri Nov 4 12:49:12 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 4 12:46:50 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.12,0.13 na.rb,0.14,0.15 Message-ID: <200511041749.jA4HnCVL027421@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv27389/lib/bio/data Modified Files: aa.rb na.rb Log Message: * converted to RDoc * weight method is changed to raise a RuntimeError when unsupported alphabet is given Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.12 retrieving revision 0.13 diff -C2 -d -r0.12 -r0.13 *** aa.rb 26 Sep 2005 13:00:06 -0000 0.12 --- aa.rb 4 Nov 2005 17:49:10 -0000 0.13 *************** *** 1,6 **** # ! # bio/data/aa.rb - Amino Acids # ! # Copyright (C) 2001, 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/data/aa.rb - Amino Acids # ! # Copyright:: Copyright (C) 2001, 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,273 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # module Bio ! class AminoAcid ! module Data ! # IUPAC code ! # * http://www.iupac.org/ ! # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! Names= { ! 'A' => 'Ala', ! 'C' => 'Cys', ! 'D' => 'Asp', ! 'E' => 'Glu', ! 'F' => 'Phe', ! 'G' => 'Gly', ! 'H' => 'His', ! 'I' => 'Ile', ! 'K' => 'Lys', ! 'L' => 'Leu', ! 'M' => 'Met', ! 'N' => 'Asn', ! 'P' => 'Pro', ! 'Q' => 'Gln', ! 'R' => 'Arg', ! 'S' => 'Ser', ! 'T' => 'Thr', ! 'V' => 'Val', ! 'W' => 'Trp', ! 'Y' => 'Tyr', ! 'B' => 'Asx', # D/N ! 'Z' => 'Glx', # E/Q ! 'U' => 'Sec', # 'uga' (stop) ! '?' => 'Pyl', # 'uag' (stop) ! ! 'Ala' => 'alanine', ! 'Cys' => 'cysteine', ! 'Asp' => 'aspartic acid', ! 'Glu' => 'glutamic acid', ! 'Phe' => 'phenylalanine', ! 'Gly' => 'glycine', ! 'His' => 'histidine', ! 'Ile' => 'isoleucine', ! 'Lys' => 'lysine', ! 'Leu' => 'leucine', ! 'Met' => 'methionine', ! 'Asn' => 'asparagine', ! 'Pro' => 'proline', ! 'Gln' => 'glutamine', ! 'Arg' => 'arginine', ! 'Ser' => 'serine', ! 'Thr' => 'threonine', ! 'Val' => 'valine', ! 'Trp' => 'tryptophan', ! 'Tyr' => 'tyrosine', ! 'Asx' => 'asparagine/aspartic acid', ! 'Glx' => 'glutamine/glutamic acid', ! 'Sec' => 'selenocysteine', ! 'Pyl' => 'pyrrolysine', ! } ! # AAindex FASG760101 - Molecular weight (Fasman, 1976) ! # Fasman, G.D., ed. ! # Handbook of Biochemistry and Molecular Biology", 3rd ed., ! # Proteins - Volume 1, CRC Press, Cleveland (1976) ! Weight = { ! 'A' => 89.09, ! 'C' => 121.15, # 121.16 according to the Wikipedia ! 'D' => 133.10, ! 'E' => 147.13, ! 'F' => 165.19, ! 'G' => 75.07, ! 'H' => 155.16, ! 'I' => 131.17, ! 'K' => 146.19, ! 'L' => 131.17, ! 'M' => 149.21, ! 'N' => 132.12, ! 'P' => 115.13, ! 'Q' => 146.15, ! 'R' => 174.20, ! 'S' => 105.09, ! 'T' => 119.12, ! 'U' => 168.06, ! 'V' => 117.15, ! 'W' => 204.23, ! 'Y' => 181.19, ! } ! def weight(x = nil) ! if x ! if x.length > 1 ! total = 0.0 ! x.each_byte do |byte| ! aa = byte.chr.upcase total += Weight[aa] end - total -= NucleicAcid.weight[:water] * (x.length - 1) - else - Weight[x] end else ! Weight end end ! def [](x) ! Names[x] ! end ! # backward compatibility ! def names ! Names ! end ! alias aa names ! def name(x) ! str = Names[x] ! if str and str.length == 3 ! Names[str] ! else ! str ! end end ! def to_1(x) ! case x.to_s.length ! when 1 ! x ! when 3 ! three2one(x) ! else ! name2one(x) ! end end ! alias one to_1 ! def to_3(x) ! case x.to_s.length ! when 1 ! one2three(x) ! when 3 ! x ! else ! name2three(x) ! end end ! alias three to_3 ! def one2three(x) ! if x and x.length != 1 ! raise ArgumentError ! else ! Names[x] ! end end ! def three2one(x) ! if x and x.length != 3 ! raise ArgumentError ! else ! reverse[x] ! end end ! def one2name(x) ! if x and x.length != 1 ! raise ArgumentError ! else ! three2name(Names[x]) ! end end ! def name2one(x) ! str = reverse[x.to_s.downcase] ! if str and str.length == 3 ! three2one(str) ! else ! str ! end end ! def three2name(x) ! if x and x.length != 3 ! raise ArgumentError ! else ! Names[x] ! end end ! def name2three(x) ! reverse[x.downcase] ! end ! def to_re(seq) ! str = seq.to_s.upcase ! str.gsub!(/[^BZACDEFGHIKLMNPQRSTVWYU]/, ".") ! str.gsub!("B", "[DN]") ! str.gsub!("Z", "[EQ]") ! Regexp.new(str) ! end ! private ! def reverse ! hash = Hash.new ! Names.each do |k, v| ! hash[v] = k ! end ! hash end ! end - # as instance methods - include Data ! # as class methods ! extend Data ! # backward compatibility ! Names = Data::Names ! Weight = Data::Weight ! private ! # override when used as an instance method to improve performance ! alias orig_reverse reverse ! def reverse ! unless @reverse ! @reverse = orig_reverse ! end ! @reverse end ! end end --- 24,283 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # module Bio ! class AminoAcid ! module Data ! # IUPAC code ! # * http://www.iupac.org/ ! # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! Names= { ! 'A' => 'Ala', ! 'C' => 'Cys', ! 'D' => 'Asp', ! 'E' => 'Glu', ! 'F' => 'Phe', ! 'G' => 'Gly', ! 'H' => 'His', ! 'I' => 'Ile', ! 'K' => 'Lys', ! 'L' => 'Leu', ! 'M' => 'Met', ! 'N' => 'Asn', ! 'P' => 'Pro', ! 'Q' => 'Gln', ! 'R' => 'Arg', ! 'S' => 'Ser', ! 'T' => 'Thr', ! 'V' => 'Val', ! 'W' => 'Trp', ! 'Y' => 'Tyr', ! 'B' => 'Asx', # D/N ! 'Z' => 'Glx', # E/Q ! 'U' => 'Sec', # 'uga' (stop) ! '?' => 'Pyl', # 'uag' (stop) ! ! 'Ala' => 'alanine', ! 'Cys' => 'cysteine', ! 'Asp' => 'aspartic acid', ! 'Glu' => 'glutamic acid', ! 'Phe' => 'phenylalanine', ! 'Gly' => 'glycine', ! 'His' => 'histidine', ! 'Ile' => 'isoleucine', ! 'Lys' => 'lysine', ! 'Leu' => 'leucine', ! 'Met' => 'methionine', ! 'Asn' => 'asparagine', ! 'Pro' => 'proline', ! 'Gln' => 'glutamine', ! 'Arg' => 'arginine', ! 'Ser' => 'serine', ! 'Thr' => 'threonine', ! 'Val' => 'valine', ! 'Trp' => 'tryptophan', ! 'Tyr' => 'tyrosine', ! 'Asx' => 'asparagine/aspartic acid', ! 'Glx' => 'glutamine/glutamic acid', ! 'Sec' => 'selenocysteine', ! 'Pyl' => 'pyrrolysine', ! } ! # AAindex FASG760101 - Molecular weight (Fasman, 1976) ! # Fasman, G.D., ed. ! # Handbook of Biochemistry and Molecular Biology", 3rd ed., ! # Proteins - Volume 1, CRC Press, Cleveland (1976) ! Weight = { ! 'A' => 89.09, ! 'C' => 121.15, # 121.16 according to the Wikipedia ! 'D' => 133.10, ! 'E' => 147.13, ! 'F' => 165.19, ! 'G' => 75.07, ! 'H' => 155.16, ! 'I' => 131.17, ! 'K' => 146.19, ! 'L' => 131.17, ! 'M' => 149.21, ! 'N' => 132.12, ! 'P' => 115.13, ! 'Q' => 146.15, ! 'R' => 174.20, ! 'S' => 105.09, ! 'T' => 119.12, ! 'U' => 168.06, ! 'V' => 117.15, ! 'W' => 204.23, ! 'Y' => 181.19, ! } ! def weight(x = nil) ! if x ! if x.length > 1 ! total = 0.0 ! x.each_byte do |byte| ! aa = byte.chr.upcase ! if Weight[aa] total += Weight[aa] + else + raise "Error: invalid amino acid '#{aa}'" end end + total -= NucleicAcid.weight[:water] * (x.length - 1) else ! Weight[x] end + else + Weight end + end ! def [](x) ! Names[x] ! end ! # backward compatibility ! def names ! Names ! end ! alias aa names ! def name(x) ! str = Names[x] ! if str and str.length == 3 ! Names[str] ! else ! str end + end ! def to_1(x) ! case x.to_s.length ! when 1 ! x ! when 3 ! three2one(x) ! else ! name2one(x) end ! end ! alias one to_1 ! def to_3(x) ! case x.to_s.length ! when 1 ! one2three(x) ! when 3 ! x ! else ! name2three(x) end ! end ! alias three to_3 ! def one2three(x) ! if x and x.length != 1 ! raise ArgumentError ! else ! Names[x] end + end ! def three2one(x) ! if x and x.length != 3 ! raise ArgumentError ! else ! reverse[x] end + end ! def one2name(x) ! if x and x.length != 1 ! raise ArgumentError ! else ! three2name(Names[x]) end + end ! def name2one(x) ! str = reverse[x.to_s.downcase] ! if str and str.length == 3 ! three2one(str) ! else ! str end + end ! def three2name(x) ! if x and x.length != 3 ! raise ArgumentError ! else ! Names[x] end + end ! def name2three(x) ! reverse[x.downcase] ! end ! def to_re(seq) ! str = seq.to_s.upcase ! str.gsub!(/[^BZACDEFGHIKLMNPQRSTVWYU]/, ".") ! str.gsub!("B", "[DN]") ! str.gsub!("Z", "[EQ]") ! Regexp.new(str) ! end ! private ! def reverse ! hash = Hash.new ! Names.each do |k, v| ! hash[v] = k end ! hash end + end ! # as instance methods ! include Data ! ! # as class methods ! extend Data ! # backward compatibility ! Names = Data::Names ! Weight = Data::Weight ! private ! # override when used as an instance method to improve performance ! alias orig_reverse reverse ! def reverse ! unless @reverse ! @reverse = orig_reverse end ! @reverse end end + + end # module Bio Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.14 retrieving revision 0.15 diff -C2 -d -r0.14 -r0.15 *** na.rb 26 Sep 2005 13:00:06 -0000 0.14 --- na.rb 4 Nov 2005 17:49:10 -0000 0.15 *************** *** 1,6 **** # ! # bio/data/na.rb - Nucleic Acids # ! # Copyright (C) 2001, 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/data/na.rb - Nucleic Acids # ! # Copyright:: Copyright (C) 2001, 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,160 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # module Bio ! class NucleicAcid ! module Data ! # IUPAC code ! # * Faisst and Meyer (Nucleic Acids Res. 20:3-26, 1992) ! # * http://www.ncbi.nlm.nih.gov/collab/FT/ ! Names = { ! 'y' => '[tc]', # pYrimidine ! 'r' => '[ag]', # puRine ! 'w' => '[at]', # Weak ! 's' => '[gc]', # Strong ! 'k' => '[tg]', # Keto ! 'm' => '[ac]', # aMino ! 'b' => '[tgc]', # not A ! 'd' => '[atg]', # not C ! 'h' => '[atc]', # not G ! 'v' => '[agc]', # not T ! 'n' => '[atgc]', ! 'a' => 'a', ! 't' => 't', ! 'g' => 'g', ! 'c' => 'c', ! 'u' => 'u', ! 'A' => 'adenine', ! 'T' => 'thymine', ! 'G' => 'guanine', ! 'C' => 'cytosine', ! 'U' => 'uracil', ! } ! Weight = { ! # Calculated by BioPerl's Bio::Tools::SeqStats.pm :-) ! 'a' => 135.15, ! 't' => 126.13, ! 'g' => 151.15, ! 'c' => 111.12, ! 'u' => 112.10, ! :adenine => 135.15, ! :thymine => 126.13, ! :guanine => 151.15, ! :cytosine => 111.12, ! :uracil => 112.10, ! :deoxyribose_phosphate => 196.11, ! :ribose_phosphate => 212.11, ! :hydrogen => 1.00794, ! :water => 18.015, ! } ! def weight(x = nil, rna = nil) ! if x ! if x.length > 1 ! if rna ! phosphate = Weight[:ribose_phosphate] ! else ! phosphate = Weight[:deoxyribose_phosphate] ! end ! hydrogen = Weight[:hydrogen] ! water = Weight[:water] ! total = 0.0 ! x.each_byte do |byte| ! base = byte.chr.downcase total += Weight[base] + phosphate - hydrogen * 2 end - total -= water * (x.length - 1) - else - Weight[x.to_s.downcase] end else ! Weight end end ! def [](x) ! Names[x] ! end ! # backward compatibility ! def names ! Names ! end ! alias na names ! def name(x) ! Names[x.to_s.upcase] ! end ! def to_re(seq, rna = false) ! str = "" ! seq.to_s.downcase.each_byte do |base| ! if re = Names[base.chr] ! str += re ! else ! str += "." ! end ! end ! if rna ! str.tr!("t", "u") end - Regexp.new(str) end ! end - # as instance methods - include Data ! # as class methods ! extend Data - # backward compatibility - Names = Data::Names - Weight = Data::Weight - end end --- 24,170 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # module Bio ! class NucleicAcid ! module Data ! # IUPAC code ! # * Faisst and Meyer (Nucleic Acids Res. 20:3-26, 1992) ! # * http://www.ncbi.nlm.nih.gov/collab/FT/ ! Names = { ! 'y' => '[tc]', # pYrimidine ! 'r' => '[ag]', # puRine ! 'w' => '[at]', # Weak ! 's' => '[gc]', # Strong ! 'k' => '[tg]', # Keto ! 'm' => '[ac]', # aMino ! 'b' => '[tgc]', # not A ! 'd' => '[atg]', # not C ! 'h' => '[atc]', # not G ! 'v' => '[agc]', # not T ! 'n' => '[atgc]', ! 'a' => 'a', ! 't' => 't', ! 'g' => 'g', ! 'c' => 'c', ! 'u' => 'u', ! 'A' => 'adenine', ! 'T' => 'thymine', ! 'G' => 'guanine', ! 'C' => 'cytosine', ! 'U' => 'uracil', ! } ! Weight = { ! # Calculated by BioPerl's Bio::Tools::SeqStats.pm :-) ! 'a' => 135.15, ! 't' => 126.13, ! 'g' => 151.15, ! 'c' => 111.12, ! 'u' => 112.10, ! :adenine => 135.15, ! :thymine => 126.13, ! :guanine => 151.15, ! :cytosine => 111.12, ! :uracil => 112.10, ! :deoxyribose_phosphate => 196.11, ! :ribose_phosphate => 212.11, ! :hydrogen => 1.00794, ! :water => 18.015, ! } ! def weight(x = nil, rna = nil) ! if x ! if x.length > 1 ! if rna ! phosphate = Weight[:ribose_phosphate] ! else ! phosphate = Weight[:deoxyribose_phosphate] ! end ! hydrogen = Weight[:hydrogen] ! water = Weight[:water] ! total = 0.0 ! x.each_byte do |byte| ! base = byte.chr.downcase ! if Weight[base] total += Weight[base] + phosphate - hydrogen * 2 + else + raise "Error: invalid nucleic acid '#{base}'" end end + total -= water * (x.length - 1) else ! Weight[x.to_s.downcase] end + else + Weight end + end ! def [](x) ! Names[x] ! end ! # backward compatibility ! def names ! Names ! end ! alias na names ! def name(x) ! Names[x.to_s.upcase] ! end ! def to_re(seq, rna = false) ! str = "" ! seq.to_s.downcase.each_byte do |base| ! if re = Names[base.chr] ! str += re ! else ! str += "." end end ! if rna ! str.tr!("t", "u") ! end ! Regexp.new(str) end + end ! # as instance methods ! include Data + # as class methods + extend Data + # backward compatibility + Names = Data::Names + Weight = Data::Weight end + + end # module Bio From k at pub.open-bio.org Sat Nov 5 03:22:55 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:20:26 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.44,0.45 Message-ID: <200511050822.jA58MsVL029292@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv29278/lib/bio Modified Files: sequence.rb Log Message: * Bio::Sequence.auto method is added * Bio::Sequence#blast and Bio::Sequence#fasta methods are removed Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.44 retrieving revision 0.45 diff -C2 -d -r0.44 -r0.45 *** sequence.rb 26 Sep 2005 13:00:04 -0000 0.44 --- sequence.rb 5 Nov 2005 08:22:52 -0000 0.45 *************** *** 34,37 **** --- 34,65 ---- class Sequence < String + def self.auto(str) + moltype = guess(str) + if moltype == NA + NA.new(str) + else + AA.new(str) + end + end + + def guess(threshold = 0.9) + cmp = self.composition + + bases = cmp['A'] + cmp['T'] + cmp['G'] + cmp['C'] + + cmp['a'] + cmp['t'] + cmp['g'] + cmp['c'] + + total = self.length - cmp['N'] - cmp['n'] + + if bases.to_f / total > threshold + return NA + else + return AA + end + end + + def self.guess(str, *args) + self.new(str).guess(*args) + end + def to_s String.new(self) *************** *** 75,86 **** end - def fasta(factory, header = nil) - factory.query(self.to_fasta(header)) - end - - def blast(factory, header = nil) - factory.query(self.to_fasta(header)) - end - def window_search(window_size, step_size = 1) i = 0 --- 103,106 ---- *************** *** 108,130 **** end return count - end - - def guess(threshold = 0.9) - cmp = self.composition - - bases = cmp['A'] + cmp['T'] + cmp['G'] + cmp['C'] + - cmp['a'] + cmp['t'] + cmp['g'] + cmp['c'] - - total = self.length - cmp['N'] - cmp['n'] - - if bases.to_f / total > threshold - return NA - else - return AA - end - end - - def self.guess(str, *args) - self.new(str).guess(*args) end --- 128,131 ---- From k at pub.open-bio.org Sat Nov 5 03:24:25 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:21:55 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.4,1.5 Message-ID: <200511050824.jA58OPVL029384@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv29378/lib/bio Modified Files: shell.rb Log Message: * plugin to use codon table is added Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** shell.rb 4 Nov 2005 17:40:33 -0000 1.4 --- shell.rb 5 Nov 2005 08:24:23 -0000 1.5 *************** *** 41,44 **** --- 41,45 ---- require 'bio/shell/plugin/seq' require 'bio/shell/plugin/midi' + require 'bio/shell/plugin/codon' require 'bio/shell/plugin/flatfile' require 'bio/shell/plugin/obda' From k at pub.open-bio.org Sat Nov 5 03:24:26 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:21:59 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,NONE,1.1 Message-ID: <200511050824.jA58OQVL029388@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv29378/lib/bio/shell/plugin Added Files: codon.rb Log Message: * plugin to use codon table is added --- NEW FILE: codon.rb --- # # = bio/shell/plugin/codon.rb - plugin for the codon table # # Copyright:: Copyright (C) 2005 # Toshiaki Katayama # Lisence:: LGPL # # $Id: codon.rb,v 1.1 2005/11/05 08:24:24 k Exp $ # #-- # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #++ # require 'bio/data/codontable' require 'bio/data/aa' module Bio::Shell class ColoredCodonTable Color = Bio::Shell::Core::ESC_SEQ @@colors = { :text => Color[:none], :aa => Color[:green], :start => Color[:red], :stop => Color[:red], :basic => Color[:cyan], :polar => Color[:blue], :acidic => Color[:magenta], :nonpolar => Color[:yellow], } @@properties = { :basic => %w( H K R ), :polar => %w( S T Y Q N S ), :acidic => %w( D E ), :nonpolar => %w( F L I M V P A C W G ), :stop => %w( * ), } def initialize(number, color = true) @aacode = Bio::AminoAcid.names @table = Bio::CodonTable[number] @number = number if color generate_colored_text else generate_mono_text end end attr_reader :table def generate_mono_text @table.each do |codon, aa| if aa == '*' code = "STOP" aa = '' else code = @aacode[aa] end eval("@#{codon} = ' #{code} #{aa} '") end @hydrophilic = [ @@properties[:basic].join(" "), "(basic),", @@properties[:polar].join(" "), "(polar),", @@properties[:acidic].join(" "), "(acidic)", ].join(" ") @hydrophobic = @@properties[:nonpolar].join(" ") + " (nonpolar)" end def generate_colored_text @table.each do |codon, aa| property, = @@properties.detect {|key, list| list.include?(aa)} if aa == '*' color_code = "#{@@colors[:stop]}STOP" color_aa = "" else color_code = "#{@@colors[property]}#{@aacode[aa]}" if @table.start_codon?(codon) color_aa = "#{@@colors[:start]}#{aa}" else color_aa = "#{@@colors[:aa]}#{aa}" end end eval("@#{codon} = ' #{color_code} #{color_aa}#{@@colors[:text]} '") end @hydrophilic = [ "#{@@colors[:basic]}basic#{@@colors[:text]},", "#{@@colors[:polar]}polar#{@@colors[:text]},", "#{@@colors[:acidic]}acidic#{@@colors[:text]}" ].join(" ") @hydrophobic = "#{@@colors[:nonpolar]}nonpolar" end def output text = <<-END # # = Codon table #{@number} : #{@table.definition} # # hydrophilic: #{@hydrophilic} # hydrophobic: #{@hydrophobic} # # *---------------------------------------------* # | | 2nd | | # | 1st |-------------------------------| 3rd | # | | U | C | A | G | | # |-------+-------+-------+-------+-------+-----| # | U U |#{@ttt}|#{@tct}|#{@tat}|#{@tgt}| u | # | U U |#{@ttc}|#{@tcc}|#{@tac}|#{@tgc}| c | # | U U |#{@tta}|#{@tca}|#{@taa}|#{@tga}| a | # | UUU |#{@ttg}|#{@tcg}|#{@tag}|#{@tgg}| g | # |-------+-------+-------+-------+-------+-----| # | CCCC |#{@ctt}|#{@cct}|#{@cat}|#{@cgt}| u | # | C |#{@ctc}|#{@ccc}|#{@cac}|#{@cgc}| c | # | C |#{@cta}|#{@cca}|#{@caa}|#{@cga}| a | # | CCCC |#{@ctg}|#{@ccg}|#{@cag}|#{@cgg}| g | # |-------+-------+-------+-------+-------+-----| # | A |#{@att}|#{@act}|#{@aat}|#{@agt}| u | # | A A |#{@atc}|#{@acc}|#{@aac}|#{@agc}| c | # | AAAAA |#{@ata}|#{@aca}|#{@aaa}|#{@aga}| a | # | A A |#{@atg}|#{@acg}|#{@aag}|#{@agg}| g | # |-------+-------+-------+-------+-------+-----| # | GGGG |#{@gtt}|#{@gct}|#{@gat}|#{@ggt}| u | # | G |#{@gtc}|#{@gcc}|#{@gac}|#{@ggc}| c | # | G GGG |#{@gta}|#{@gca}|#{@gaa}|#{@gga}| a | # | GG G |#{@gtg}|#{@gcg}|#{@gag}|#{@ggg}| g | # *---------------------------------------------* # END text.gsub(/^\s+#/, @@colors[:text]) end end private def codontable(num = 1) cct = ColoredCodonTable.new(num, $bioruby_config[:COLOR]) display cct.output return cct.table end def codontables Bio::CodonTable::Definitions.sort.each do |i, definition| puts "#{i}\t#{definition}" end end end From k at pub.open-bio.org Sat Nov 5 03:25:49 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:23:22 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data codontable.rb,0.13,0.14 Message-ID: <200511050825.jA58PnVL029438@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv29434/lib/bio/data Modified Files: codontable.rb Log Message: * converted to RDoc * ColoredCodonTable in sample code is moved to the BioRuby shell (lib/bio/shell/plugin/codon.rb) Index: codontable.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/codontable.rb,v retrieving revision 0.13 retrieving revision 0.14 diff -C2 -d -r0.13 -r0.14 *** codontable.rb 26 Sep 2005 13:00:06 -0000 0.13 --- codontable.rb 5 Nov 2005 08:25:47 -0000 0.14 *************** *** 1,6 **** # ! # bio/data/codontable.rb - Codon Table # ! # Copyright (C) 2001, 2004 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,47 ---- # ! # = bio/data/codontable.rb - Codon Table # ! # Copyright:: Copyright (C) 2001, 2004 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! # == Data source ! # ! # Data in this class is converted from the NCBI's genetic codes page. ! # ! # * (()) ! # ! # === Examples ! # ! # Obtain a codon table No.1 -- Standard (Eukaryote) ! # ! # table = Bio::CodonTable[1] ! # ! # Obtain a copy of the codon table No.1 to modify. In this example, ! # reassign a seleno cystein ('U') to the 'tga' codon. ! # ! # table = Bio::CodonTable.copy(1) ! # table['tga'] = 'U' ! # ! # Create a new codon table by your own from the Hash which contains ! # pairs of codon and amino acid. You can also define the table name ! # in the second argument. ! # ! # hash = { 'ttt' => 'F', 'ttc' => 'ttc', ... } ! # table = Bio::CodonTable.new(hash, "my codon table") ! # ! # Obtain a translated amino acid by codon. ! # ! # table = Bio::CodonTable[1] ! # table['ttt'] # => F ! # ! # Reverse translation of a amino acid into a list of relevant codons. ! # ! # table = Bio::CodonTable[1] ! # table.revtrans("A") # => ["gcg", "gct", "gca", "gcc"] ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 59,63 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 25,28 **** --- 66,71 ---- class CodonTable + # Select a codon table by number. This method will return one of the + # hard coded codon tables in this class as a Bio::CodonTable object. def self.[](i) hash = Tables[i] *************** *** 34,37 **** --- 77,82 ---- end + # Similar to Bio::CodonTable[num] but returns a copied codon table. + # You can modify the codon table without influencing hard coded tables. def self.copy(i) ct = self[i] *************** *** 39,42 **** --- 84,93 ---- end + # Create your own codon table by giving a Hash table of codons and relevant + # amino acids. You can also able to define the table's name as a second + # argument. + # + # Two Arrays 'start' and 'stop' can be specified which contains a list of + # start and stop codons used by 'start_codon?' and 'stop_codon?' methods. def initialize(hash, definition = nil, start = [], stop = []) @table = hash *************** *** 45,62 **** @stop = stop.empty? ? generate_stop : stop end - attr_accessor :table, :definition, :start, :stop def [](codon) @table[codon] end def []=(codon, aa) @table[codon] = aa end def each(&block) @table.each(&block) end def revtrans(aa) unless @reverse --- 96,148 ---- @stop = stop.empty? ? generate_stop : stop end + # Accessor methods for a Hash of the currently selected codon table. + attr_accessor :table + + # Accessor methods for the name of the currently selected table. + attr_accessor :definition + + # Accessor methods for an Array which contains a list of start or stop + # codons respectively. + attr_accessor :start, :stop + + # Translate a codon into a relevant amino acid. This method is used for + # translating a DNA sequence into amino acid sequence. def [](codon) @table[codon] end + # Modify the codon table. Use with caution as it may break hard coded + # tables. If you want to modify existing table, you should use copy + # method instead of [] method to generate CodonTable object to be modified. + # + # # This is OK. + # table = Bio::CodonTable.copy(1) + # table['tga'] = 'U' + # + # # Not recommended as it overrides the hard coded table + # table = Bio::CodonTable[1] + # table['tga'] = 'U' + # def []=(codon, aa) @table[codon] = aa end + # Iterates on codon table hash. + # + # table = Bio::CodonTable[1] + # table.each do |codon, aa| + # puts "#{codon} -- #{aa}" + # end + # def each(&block) @table.each(&block) end + # Reverse translation of a amino acid into a list of relevant codons. + # + # table = Bio::CodonTable[1] + # table.revtrans("A") # => ["gcg", "gct", "gca", "gcc"] + # def revtrans(aa) unless @reverse *************** *** 70,77 **** --- 156,167 ---- end + # Returns true if the codon is a start codon in the currently selected + # codon table, otherwise false. def start_codon?(codon) @start.include?(codon.downcase) end + # Returns true if the codon is a stop codon in the currently selected + # codon table, otherwise false. def stop_codon?(codon) @stop.include?(codon.downcase) *************** *** 558,877 **** if __FILE__ == $0 ! class ColoredCodonTable ! ! @@colors = { ! :text => "\e[30m", # black ! :aa => "\e[32m", # green ! :start => "\e[31m", # red ! :stop => "\e[31m", # red ! :basic => "\e[36m", # cyan ! :polar => "\e[34m", # blue ! :acidic => "\e[35m", # magenta ! :nonpolar => "\e[33m", # yellow ! } ! ! @@properties = { ! :basic => %w( H K R ), ! :polar => %w( S T Y Q N S ), ! :acidic => %w( D E ), ! :nonpolar => %w( F L I M V P A C W G ), ! :stop => %w( * ), ! } ! ! def initialize(number) ! require 'bio/data/aa' ! @aacode = Bio::AminoAcid.names ! @ctable = Bio::CodonTable[number] ! @number = number ! table_number_check ! generate_colored_text ! end ! ! def table_number_check ! unless @ctable.definition ! puts "ERROR: Codon table No.#{@number} not found." ! Bio::CodonTable::Definitions.sort.each do |i, definition| ! puts "#{i}\t#{definition}" ! end ! exit 1 ! end ! end ! ! def generate_colored_text ! @ctable.table.each do |codon, aa| ! property, = @@properties.detect {|key, list| list.include?(aa)} ! if aa == '*' ! color_code = "#{@@colors[:stop]}STOP" ! color_aa = "" ! else ! color_code = "#{@@colors[property]}#{@aacode[aa]}" ! if @ctable.start_codon?(codon) ! color_aa = "#{@@colors[:start]}#{aa}" ! else ! color_aa = "#{@@colors[:aa]}#{aa}" ! end ! end ! eval("@#{codon} = ' #{color_code} #{color_aa}#{@@colors[:text]} '") ! end ! ! @hydrophilic = [ ! "#{@@colors[:basic]}basic#{@@colors[:text]},", ! "#{@@colors[:polar]}polar#{@@colors[:text]},", ! "#{@@colors[:acidic]}acidic#{@@colors[:text]}" ! ].join(" ") ! @hydrophobic = "#{@@colors[:nonpolar]}nonpolar" ! end ! ! def output ! text = <<-END ! # ! #= Codon table #{@number} : #{@ctable.definition} ! # ! # hydrophilic: #{@hydrophilic} ! # hydrophobic: #{@hydrophobic} ! # ! #*---------------------------------------------* ! #| | 2nd | | ! #| 1st |-------------------------------| 3rd | ! #| | U | C | A | G | | ! #|-------+-------+-------+-------+-------+-----| ! #| U U |#{@ttt}|#{@tct}|#{@tat}|#{@tgt}| u | ! #| U U |#{@ttc}|#{@tcc}|#{@tac}|#{@tgc}| c | ! #| U U |#{@tta}|#{@tca}|#{@taa}|#{@tga}| a | ! #| UUU |#{@ttg}|#{@tcg}|#{@tag}|#{@tgg}| g | ! #|-------+-------+-------+-------+-------+-----| ! #| CCCC |#{@ctt}|#{@cct}|#{@cat}|#{@cgt}| u | ! #| C |#{@ctc}|#{@ccc}|#{@cac}|#{@cgc}| c | ! #| C |#{@cta}|#{@cca}|#{@caa}|#{@cga}| a | ! #| CCCC |#{@ctg}|#{@ccg}|#{@cag}|#{@cgg}| g | ! #|-------+-------+-------+-------+-------+-----| ! #| A |#{@att}|#{@act}|#{@aat}|#{@agt}| u | ! #| A A |#{@atc}|#{@acc}|#{@aac}|#{@agc}| c | ! #| AAAAA |#{@ata}|#{@aca}|#{@aaa}|#{@aga}| a | ! #| A A |#{@atg}|#{@acg}|#{@aag}|#{@agg}| g | ! #|-------+-------+-------+-------+-------+-----| ! #| GGGG |#{@gtt}|#{@gct}|#{@gat}|#{@ggt}| u | ! #| G |#{@gtc}|#{@gcc}|#{@gac}|#{@ggc}| c | ! #| G GGG |#{@gta}|#{@gca}|#{@gaa}|#{@gga}| a | ! #| GG G |#{@gtg}|#{@gcg}|#{@gag}|#{@ggg}| g | ! #*---------------------------------------------* ! # ! END ! text.gsub(/^\s+#/, @@colors[:text]) ! end ! end ! if ARGV.size > 0 ! ! number = ARGV.shift.to_i ! cct = ColoredCodonTable.new(number) ! puts cct.output ! ! else ! ! begin ! require 'pp' ! alias p pp ! rescue LoadError ! end ! ! puts "### Bio::CodonTable[1]" ! p ct1 = Bio::CodonTable[1] ! ! puts ">>> Bio::CodonTable#table" ! p ct1.table ! ! puts ">>> Bio::CodonTable#each" ! ct1.each do |codon, aa| ! puts "#{codon} -- #{aa}" ! end ! ! puts ">>> Bio::CodonTable#definition" ! p ct1.definition ! ! puts ">>> Bio::CodonTable#['atg']" ! p ct1['atg'] ! ! puts ">>> Bio::CodonTable#revtrans('A')" ! p ct1.revtrans('A') ! ! puts ">>> Bio::CodonTable#start_codon?('atg')" ! p ct1.start_codon?('atg') ! ! puts ">>> Bio::CodonTable#start_codon?('aaa')" ! p ct1.start_codon?('aaa') ! ! puts ">>> Bio::CodonTable#stop_codon?('tag')" ! p ct1.stop_codon?('tag') ! ! puts ">>> Bio::CodonTable#stop_codon?('aaa')" ! p ct1.stop_codon?('aaa') ! ! puts ">>> ct1_copy = Bio::CodonTable.copy(1)" ! p ct1_copy = Bio::CodonTable.copy(1) ! puts ">>> ct1_copy['tga'] = 'U'" ! p ct1_copy['tga'] = 'U' ! puts " orig : #{ct1['tga']}" ! puts " copy : #{ct1_copy['tga']}" ! ! ! puts "### ct = Bio::CodonTable.new(hash, definition)" ! hash = { ! 'ttt' => 'F', 'tct' => 'S', 'tat' => 'Y', 'tgt' => 'C', ! 'ttc' => 'F', 'tcc' => 'S', 'tac' => 'Y', 'tgc' => 'C', ! 'tta' => 'L', 'tca' => 'S', 'taa' => '*', 'tga' => 'U', ! 'ttg' => 'L', 'tcg' => 'S', 'tag' => '*', 'tgg' => 'W', ! ! 'ctt' => 'L', 'cct' => 'P', 'cat' => 'H', 'cgt' => 'R', ! 'ctc' => 'L', 'ccc' => 'P', 'cac' => 'H', 'cgc' => 'R', ! 'cta' => 'L', 'cca' => 'P', 'caa' => 'Q', 'cga' => 'R', ! 'ctg' => 'L', 'ccg' => 'P', 'cag' => 'Q', 'cgg' => 'R', ! ! 'att' => 'I', 'act' => 'T', 'aat' => 'N', 'agt' => 'S', ! 'atc' => 'I', 'acc' => 'T', 'aac' => 'N', 'agc' => 'S', ! 'ata' => 'I', 'aca' => 'T', 'aaa' => 'K', 'aga' => 'R', ! 'atg' => 'M', 'acg' => 'T', 'aag' => 'K', 'agg' => 'R', ! ! 'gtt' => 'V', 'gct' => 'A', 'gat' => 'D', 'ggt' => 'G', ! 'gtc' => 'V', 'gcc' => 'A', 'gac' => 'D', 'ggc' => 'G', ! 'gta' => 'V', 'gca' => 'A', 'gaa' => 'E', 'gga' => 'G', ! 'gtg' => 'V', 'gcg' => 'A', 'gag' => 'E', 'ggg' => 'G', ! } ! my_ct = Bio::CodonTable.new(hash, "my codon table") ! ! puts ">>> ct.definition" ! puts my_ct.definition ! ! puts ">>> ct.definition=(str)" ! my_ct.definition = "selenoproteins (Eukaryote)" ! puts my_ct.definition ! ! puts ">>> ct['tga']" ! puts my_ct['tga'] ! ! puts ">>> ct.revtrans('U')" ! puts my_ct.revtrans('U') ! ! puts ">>> ct.stop_codon?('tga')" ! puts my_ct.stop_codon?('tga') ! ! puts ">>> ct.stop_codon?('tag')" ! puts my_ct.stop_codon?('tag') ! ! puts "#" ! puts "# Example (try to run this module with a codon table number)" ! puts "# % ruby codontable.rb 1" ! puts "#" ! cct = ColoredCodonTable.new(1) ! puts cct.output end ! end ! ! ! ! =begin ! ! = Bio::CodonTable ! ! Data in this class is converted from the NCBI's genetic codes page. ! ! * (()) ! ! --- Bio::CodonTable[num] ! ! Select a codon table by number. You can use this class method to ! obtain hard coded codon table as a Bio::CodonTable object. ! ! table = Bio::CodonTable[1] ! ! --- Bio::CodonTable.copy(num) ! ! Similar to Bio::CodonTable[num] but returns copied codon table. ! You can modify the codon table without influencing hard coded tables. ! ! table = Bio::CodonTable.copy(1) ! table['tga'] = 'U' ! ! --- Bio::CodonTable.new(hash, definition = nil, start = [], stop = []) ! ! Create your own codon table by passing a Hash table of codons and relevant ! amino acids. You can give table's name as a definition. ! ! hash = { 'ttt' => 'F', 'ttc' => 'ttc', ... } ! table = Bio::CodonTable.new(hash, "my codon table") ! ! Two Arrays 'start' and 'stop' can be specified which contains a list of ! start and stop codons used by 'start_codon?' and 'stop_codon?' methods. ! ! --- Bio::CodonTable#[codon] ! ! Translate a codon into a relevant amino acid. This method is used for ! translating a DNA sequence into amino acid sequence. ! ! table = Bio::CodonTable[1] ! table['ttt'] # => F ! ! --- Bio::CodonTable#[codon]=(aa) ! ! Modify the codon table. Use with caution as it may break hard coded ! tables. If you want to modify existing table, you should use copy ! method instead of [] method to generate CodonTable object to modify. ! ! table = Bio::CodonTable.copy(1) ! table['tga'] = 'U' # This is OK. ! ! table = Bio::CodonTable.new(hash, definition, ... ) ! table['tga'] = 'U' # This is also OK. ! table = Bio::CodonTable[1] ! table['tga'] = 'U' # not recommended as it rewrites a hard coded table ! --- Bio::CodonTable#each ! Iterates on codon table hash. ! table = Bio::CodonTable[1] ! table.each do |codon, aa| ! puts "#{codon} -- #{aa}" ! end ! --- Bio::CodonTable#revtrans(aa) - Reverse translation of a amino acid into a list of relevant codons. ! table = Bio::CodonTable[1] ! table.revtrans("A") # => ["gcg", "gct", "gca", "gcc"] ! --- Bio::CodonTable#start_codon?(codon) ! Returns true if the codon is a start codon in the currently selected ! codon table, otherwise false. ! --- Bio::CodonTable#stop_codon?(codon) ! Returns true if the codon is a stop codon in the currently selected ! codon table, otherwise false. ! --- Bio::CodonTable#table ! --- Bio::CodonTable#table=(hash) ! Accessor methods for a Hash of the currently selected codon table. ! --- Bio::CodonTable#definition ! --- Bio::CodonTable#definition=(string) ! Accessor methods for the name of the currently selected table. ! --- Bio::CodonTable#start ! --- Bio::CodonTable#start=(array) ! --- Bio::CodonTable#stop ! --- Bio::CodonTable#stop=(array) ! Accessor methods for an Array which contains a list of start or stop ! codons respectively. - =end --- 648,740 ---- if __FILE__ == $0 ! begin ! require 'pp' ! alias p pp ! rescue LoadError end ! puts "### Bio::CodonTable[1]" ! p ct1 = Bio::CodonTable[1] ! puts ">>> Bio::CodonTable#table" ! p ct1.table + puts ">>> Bio::CodonTable#each" + ct1.each do |codon, aa| + puts "#{codon} -- #{aa}" end ! puts ">>> Bio::CodonTable#definition" ! p ct1.definition ! puts ">>> Bio::CodonTable#['atg']" ! p ct1['atg'] ! puts ">>> Bio::CodonTable#revtrans('A')" ! p ct1.revtrans('A') ! puts ">>> Bio::CodonTable#start_codon?('atg')" ! p ct1.start_codon?('atg') ! ! puts ">>> Bio::CodonTable#start_codon?('aaa')" ! p ct1.start_codon?('aaa') ! puts ">>> Bio::CodonTable#stop_codon?('tag')" ! p ct1.stop_codon?('tag') ! ! puts ">>> Bio::CodonTable#stop_codon?('aaa')" ! p ct1.stop_codon?('aaa') ! puts ">>> ct1_copy = Bio::CodonTable.copy(1)" ! p ct1_copy = Bio::CodonTable.copy(1) ! puts ">>> ct1_copy['tga'] = 'U'" ! p ct1_copy['tga'] = 'U' ! puts " orig : #{ct1['tga']}" ! puts " copy : #{ct1_copy['tga']}" ! puts "### ct = Bio::CodonTable.new(hash, definition)" ! hash = { ! 'ttt' => 'F', 'tct' => 'S', 'tat' => 'Y', 'tgt' => 'C', ! 'ttc' => 'F', 'tcc' => 'S', 'tac' => 'Y', 'tgc' => 'C', ! 'tta' => 'L', 'tca' => 'S', 'taa' => '*', 'tga' => 'U', ! 'ttg' => 'L', 'tcg' => 'S', 'tag' => '*', 'tgg' => 'W', ! 'ctt' => 'L', 'cct' => 'P', 'cat' => 'H', 'cgt' => 'R', ! 'ctc' => 'L', 'ccc' => 'P', 'cac' => 'H', 'cgc' => 'R', ! 'cta' => 'L', 'cca' => 'P', 'caa' => 'Q', 'cga' => 'R', ! 'ctg' => 'L', 'ccg' => 'P', 'cag' => 'Q', 'cgg' => 'R', ! 'att' => 'I', 'act' => 'T', 'aat' => 'N', 'agt' => 'S', ! 'atc' => 'I', 'acc' => 'T', 'aac' => 'N', 'agc' => 'S', ! 'ata' => 'I', 'aca' => 'T', 'aaa' => 'K', 'aga' => 'R', ! 'atg' => 'M', 'acg' => 'T', 'aag' => 'K', 'agg' => 'R', ! 'gtt' => 'V', 'gct' => 'A', 'gat' => 'D', 'ggt' => 'G', ! 'gtc' => 'V', 'gcc' => 'A', 'gac' => 'D', 'ggc' => 'G', ! 'gta' => 'V', 'gca' => 'A', 'gaa' => 'E', 'gga' => 'G', ! 'gtg' => 'V', 'gcg' => 'A', 'gag' => 'E', 'ggg' => 'G', ! } ! my_ct = Bio::CodonTable.new(hash, "my codon table") ! puts ">>> ct.definition" ! puts my_ct.definition ! puts ">>> ct.definition=(str)" ! my_ct.definition = "selenoproteins (Eukaryote)" ! puts my_ct.definition ! puts ">>> ct['tga']" ! puts my_ct['tga'] ! puts ">>> ct.revtrans('U')" ! puts my_ct.revtrans('U') ! puts ">>> ct.stop_codon?('tga')" ! puts my_ct.stop_codon?('tga') ! puts ">>> ct.stop_codon?('tag')" ! puts my_ct.stop_codon?('tag') ! end From k at pub.open-bio.org Sat Nov 5 03:27:28 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:25:00 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg expression.rb,1.8,1.9 Message-ID: <200511050827.jA58RSVL029507@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv29503/lib/bio/db/kegg Modified Files: expression.rb Log Message: * removed Bio::KEGG::Microarrays class * renamed Bio::KEGG::Microarray class to Bio::KEGG::EXPRESSION * header is converted to RDoc Index: expression.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/expression.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** expression.rb 25 Jun 2003 04:26:24 -0000 1.8 --- expression.rb 5 Nov 2005 08:27:26 -0000 1.9 *************** *** 1,6 **** # ! # bio/db/kegg/microarray.rb - KEGG/Microarray database class # ! # Copyright (C) 2001-2003 KAWASHIMA Shuichi # # This library is free software; you can redistribute it and/or --- 1,13 ---- # ! # = bio/db/kegg/expression.rb - KEGG EXPRESSION database class # ! # Copyright:: Copyright (C) 2001-2003, 2005 ! # Shuichi Kawashima , ! # Toshiaki Katayama ! # License:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 25,29 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 24,186 **** module Bio ! class KEGG ! ! class Microarrays ! def initialize(ary) # ary = [ Microarray, Microarray, ... ] ! @orf2val = Hash.new('') ! ary.each do |x| ! x.orf2val.each do |k, v| ! if !@orf2val.key?(k) ! @orf2val[k] = v ! else ! @orf2val[k].concat(v) ! end ! end ! end end - attr_reader :orf2val - end ! class Microarray ! ! def initialize(entry) ! @orf2val = Hash.new('') ! @orf2rgb = Hash.new('') ! @orf2ratio = Hash.new('') ! @max_intensity = 10000 ! entry.split("\n").each do |line| ! unless /^#/ =~ line ! ary = line.split("\t") ! orf = ary.shift ! val = ary[2, 4].collect {|x| x.to_f} ! @orf2val[orf] = val ! end ! end ! end ! attr_reader :orf2val ! attr_reader :orf2rgb ! attr_reader :orf2ratio ! attr_reader :max_intensity ! def control_avg ! sum = 0.0 ! @orf2val.values.each do |v| ! sum += v[0] - v[1] ! end ! sum/orf2val.size ! end ! def target_avg ! sum = 0.0 ! @orf2val.values.each do |v| ! sum += v[2] - v[3] ! end ! sum/orf2val.size ! end ! def control_var ! sum = 0.0 ! avg = self.control_avg ! @orf2val.values.each do |v| ! tmp = v[0] - v[1] ! sum += (tmp - avg)*(tmp - avg) ! end ! sum/orf2val.size ! end ! def target_var ! sum = 0.0 ! avg = self.target_avg ! @orf2val.values.each do |v| ! tmp = v[2] - v[3] ! sum += (tmp - avg)*(tmp - avg) ! end ! sum/orf2val.size ! end ! def control_sd ! var = self.control_var ! Math.sqrt(var) ! end ! def target_sd ! var = self.target_var ! Math.sqrt(var) end ! def up_regulated(num=20, threshold=nil) ! logy_minus_logx ! ary = @orf2ratio.to_a.sort{|a, b| b[1] <=> a[1]} ! if threshold != nil ! i = 0 ! while ary[i][1] > threshold ! i += 1 ! end ! return ary[0..i] ! else ! return ary[0..num-1] ! end end ! def down_regulated(num=20, threshold=nil) ! logy_minus_logx ! ary = @orf2ratio.to_a.sort{|a, b| a[1] <=> b[1]} ! if threshold != nil ! i = 0 ! while ary[i][1] < threshold ! i += 1 ! end ! return ary[0..i] ! else ! return ary[0..num-1] ! end end ! def regulated(num=20, threshold=nil) ! logy_minus_logx ! ary = @orf2ratio.to_a.sort{|a, b| b[1].abs <=> a[1].abs} ! if threshold != nil ! i = 0 ! while ary[i][1].abs > threshold ! i += 1 ! end ! return ary[0..i] ! else ! return ary[0..num-1] ! end ! end ! def logy_minus_logx ! @orf2val.each do |k, v| ! @orf2ratio[k] = (1.0/Math.log10(2))*(Math.log10(v[2]-v[3]) - Math.log10(v[0]-v[1])) ! end end ! ! def val2rgb ! col_unit = @max_intensity/255 ! @orf2val.each do |k, v| ! tmp_val = ((v[0] - v[1])/col_unit).to_i ! if tmp_val > 255 ! g = "ff" ! else ! g = format("%02x", tmp_val) ! end ! tmp_val = ((v[2] - v[3])/col_unit).to_i ! if tmp_val > 255 ! r = "ff" ! else ! r = format("%02x", tmp_val) ! end ! @orf2rgb[k] = r + g + "00" ! end ! end ! end ! end ! end --- 31,173 ---- module Bio + class KEGG ! class EXPRESSION ! def initialize(entry) ! @orf2val = Hash.new('') ! @orf2rgb = Hash.new('') ! @orf2ratio = Hash.new('') ! @max_intensity = 10000 ! entry.split("\n").each do |line| ! unless /^#/ =~ line ! ary = line.split("\t") ! orf = ary.shift ! val = ary[2, 4].collect {|x| x.to_f} ! @orf2val[orf] = val end end + end + attr_reader :orf2val + attr_reader :orf2rgb + attr_reader :orf2ratio + attr_reader :max_intensity ! def control_avg ! sum = 0.0 ! @orf2val.values.each do |v| ! sum += v[0] - v[1] ! end ! sum/orf2val.size ! end ! def target_avg ! sum = 0.0 ! @orf2val.values.each do |v| ! sum += v[2] - v[3] ! end ! sum/orf2val.size ! end ! def control_var ! sum = 0.0 ! avg = self.control_avg ! @orf2val.values.each do |v| ! tmp = v[0] - v[1] ! sum += (tmp - avg)*(tmp - avg) ! end ! sum/orf2val.size ! end ! def target_var ! sum = 0.0 ! avg = self.target_avg ! @orf2val.values.each do |v| ! tmp = v[2] - v[3] ! sum += (tmp - avg)*(tmp - avg) ! end ! sum/orf2val.size ! end ! def control_sd ! var = self.control_var ! Math.sqrt(var) ! end ! def target_sd ! var = self.target_var ! Math.sqrt(var) ! end ! def up_regulated(num=20, threshold=nil) ! logy_minus_logx ! ary = @orf2ratio.to_a.sort{|a, b| b[1] <=> a[1]} ! if threshold != nil ! i = 0 ! while ary[i][1] > threshold ! i += 1 end + return ary[0..i] + else + return ary[0..num-1] + end + end ! def down_regulated(num=20, threshold=nil) ! logy_minus_logx ! ary = @orf2ratio.to_a.sort{|a, b| a[1] <=> b[1]} ! if threshold != nil ! i = 0 ! while ary[i][1] < threshold ! i += 1 end + return ary[0..i] + else + return ary[0..num-1] + end + end ! def regulated(num=20, threshold=nil) ! logy_minus_logx ! ary = @orf2ratio.to_a.sort{|a, b| b[1].abs <=> a[1].abs} ! if threshold != nil ! i = 0 ! while ary[i][1].abs > threshold ! i += 1 end + return ary[0..i] + else + return ary[0..num-1] + end + end ! def logy_minus_logx ! @orf2val.each do |k, v| ! @orf2ratio[k] = (1.0/Math.log10(2))*(Math.log10(v[2]-v[3]) - Math.log10(v[0]-v[1])) ! end ! end ! def val2rgb ! col_unit = @max_intensity/255 ! @orf2val.each do |k, v| ! tmp_val = ((v[0] - v[1])/col_unit).to_i ! if tmp_val > 255 ! g = "ff" ! else ! g = format("%02x", tmp_val) end ! tmp_val = ((v[2] - v[3])/col_unit).to_i ! if tmp_val > 255 ! r = "ff" ! else ! r = format("%02x", tmp_val) end ! @orf2rgb[k] = r + g + "00" end ! end ! end # class EXPRESSION ! ! end # class KEGG ! end # module Bio From k at pub.open-bio.org Sat Nov 5 03:29:55 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:27:25 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg kgml.rb,1.1,1.2 Message-ID: <200511050829.jA58TtVL029597@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv29593/lib/bio/db/kegg Modified Files: kgml.rb Log Message: * entry ids are converted to int (to_i) Index: kgml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/kgml.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** kgml.rb 23 Oct 2005 08:27:22 -0000 1.1 --- kgml.rb 5 Nov 2005 08:29:53 -0000 1.2 *************** *** 2,7 **** # = bio/db/kegg/kgml.rb - KEGG KGML parser class # ! # Author:: Toshiaki Katayama ! # Copyright:: Copyright (C) 2005 BioRuby project # License:: LGPL # --- 2,7 ---- # = bio/db/kegg/kgml.rb - KEGG KGML parser class # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama # License:: LGPL # *************** *** 29,32 **** --- 29,33 ---- # puts entry.id # puts entry.name + # puts entry.names # puts entry.type # puts entry.link *************** *** 50,53 **** --- 51,57 ---- # puts relation.type # # attributes + # puts relation.name + # puts relation.value + # # or # relation.subtype.each do |value, name| # puts value, name *************** *** 116,120 **** class Entry ! attr_accessor :id, :name, :type, :link, :reaction, :map attr_accessor :label, :x, :y, :type, :width, :height, :fgcolor, :bgcolor end --- 120,124 ---- class Entry ! attr_accessor :id, :name, :names, :type, :link, :reaction, :map attr_accessor :label, :x, :y, :type, :width, :height, :fgcolor, :bgcolor end *************** *** 122,125 **** --- 126,130 ---- class Relation attr_accessor :entry1, :entry2, :type + attr_accessor :name, :value attr_accessor :subtype # Hash end *************** *** 150,153 **** --- 155,159 ---- entry.map = attr["map"] entry.name = attr["name"] + entry.names = entry.name.split(/\s+/) entry.type = attr["type"] entry.link = attr["link"] *************** *** 175,180 **** attr = node.attributes relation = Relation.new ! relation.entry1 = attr["entry1"] ! relation.entry2 = attr["entry2"] relation.type = attr["type"] --- 181,186 ---- attr = node.attributes relation = Relation.new ! relation.entry1 = attr["entry1"].to_i ! relation.entry2 = attr["entry2"].to_i relation.type = attr["type"] *************** *** 182,190 **** node.elements.each("subtype") { |subtype| attr = subtype.attributes ! name = attr["name"] ! e_id = attr["value"].to_i ! hash[e_id] = name } relation.subtype = hash } end --- 188,197 ---- node.elements.each("subtype") { |subtype| attr = subtype.attributes ! relation.name = name = attr["name"] ! relation.value = value = attr["value"].to_i ! hash[value] = name } relation.subtype = hash + @relations << relation } end *************** *** 223,226 **** --- 230,235 ---- reaction.products = products reaction.alt = hash + + @reactions << reaction } end From k at pub.open-bio.org Sat Nov 5 03:31:28 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:29:45 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io das.rb,1.9,1.10 Message-ID: <200511050831.jA58VSVL029692@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv29688/lib/bio/io Modified Files: das.rb Log Message: * converted to RDoc Index: das.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/das.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** das.rb 26 Sep 2005 13:00:08 -0000 1.9 --- das.rb 5 Nov 2005 08:31:26 -0000 1.10 *************** *** 1,7 **** # ! # bio/io/das.rb - BioDAS access module # ! # Copyright (C) 2003, 2004 KATAYAMA Toshiaki ! # Copyright (C) 2003 KAWASHIMA Shuichi # # This library is free software; you can redistribute it and/or --- 1,20 ---- # ! # = bio/io/das.rb - BioDAS access module # ! # Copyright:: Copyright (C) 2003, 2004 ! # Shuichi Kawashima , ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- ! # == TODO ! # ! # link, stylesheet ! # ! #++ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 19,23 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 32,36 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 30,394 **** require 'bio/sequence' module Bio ! class DAS ! def initialize(url = 'http://www.wormbase.org:80/db/') ! schema, user, host, port, reg, path, = URI.split(url) ! @server = Net::HTTP.new(host, port) ! @prefix = path ? path.chomp('/') : '' ! end ! def get_dsn ! ary = [] ! result, = @server.get(@prefix + '/das/dsn') ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::DSN') do |e| ! dsn = DSN.new ! e.elements.each do |e| ! case e.name ! when 'SOURCE' ! dsn.source = e.text ! dsn.source_id = e.attributes['id'] ! dsn.source_version = e.attributes['version'] ! when 'MAPMASTER' ! dsn.mapmaster = e.name ! when 'DESCRIPTION' ! dsn.description = e.text ! dsn.description_href = e.attributes['href'] ! end end - ary << dsn end ! ary end ! def get_entry_point(dsn) ! entry_point = ENTRY_POINT.new ! dsn = dsn.source if dsn.instance_of?(Bio::DAS::DSN) ! result, = @server.get(@prefix + '/das/' + dsn + '/entry_points') ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::ENTRY_POINTS') do |e| ! entry_point.href = e.attributes['href'] ! entry_point.version = e.attributes['version'] ! e.elements.each do |e| ! segment = SEGMENT.new ! segment.entry_id = e.attributes['id'] ! segment.start = e.attributes['start'] ! segment.stop = e.attributes['stop'] ! segment.stop = e.attributes['orientation'] ! segment.subparts = e.attributes['subparts'] ! segment.description = e.text ! entry_point.segments << segment ! end end - entry_point end ! def get_dna(dsn, segments) ! ary = [] ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/dna?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::SEQUENCE') do |e| ! sequence = DNA.new ! sequence.entry_id = e.attributes['id'] ! sequence.start = e.attributes['start'] ! sequence.stop = e.attributes['stop'] ! sequence.version = e.attributes['version'] ! e.elements.each do |e| ! sequence.sequence = Bio::Sequence::NA.new(e.text) ! sequence.length = e.attributes['length'].to_i ! end ! ary << sequence end ! ary end ! def get_sequence(dsn, segments) ! ary = [] ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/sequence?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::SEQUENCE') do |e| ! sequence = SEQUENCE.new ! sequence.entry_id = e.attributes['id'] ! sequence.start = e.attributes['start'] ! sequence.stop = e.attributes['stop'] ! sequence.moltype = e.attributes['moltype'] ! sequence.version = e.attributes['version'] ! case sequence.moltype ! when /dna|rna/i # 'DNA', 'ssRNA', 'dsRNA' ! sequence.sequence = Bio::Sequence::NA.new(e.text) ! when /protein/i # 'Protein ! sequence.sequence = Bio::Sequence::AA.new(e.text) ! else ! sequence.sequence = e.text ! end ! ary << sequence end ! ary end ! def get_types(dsn, segments = []) # argument 'type' is deprecated ! types = TYPES.new ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/types?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::GFF') do |e| ! types.version = e.attributes['version'] ! types.href = e.attributes['href'] e.elements.each do |e| ! segment = SEGMENT.new ! segment.entry_id = e.attributes['id'] ! segment.start = e.attributes['start'] ! segment.stop = e.attributes['stop'] ! segment.version = e.attributes['version'] ! segment.label = e.attributes['label'] ! e.elements.each do |e| ! t = TYPE.new ! t.entry_id = e.attributes['id'] ! t.method = e.attributes['method'] ! t.category = e.attributes['category'] ! t.count = e.text.to_i ! segment.types << t ! end ! types.segments << segment end end - types end ! def get_features(dsn, segments = [], categorize = false, feature_ids = [], group_ids = []) ! # arguments 'type' and 'category' are deprecated ! gff = GFF.new ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! if categorize ! opts << "categorize=yes" # default is 'no' ! end ! feature_ids.each do |fid| ! opts << "feature_id=#{fid}" ! end ! group_ids.each do |gid| ! opts << "group_id=#{gid}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/features?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::GFF') do |e| ! gff.version = e.attributes['version'] ! gff.href = e.attributes['href'] ! e.elements.each('SEGMENT') do |e| ! segment = SEGMENT.new ! segment.entry_id = e.attributes['id'] ! segment.start = e.attributes['start'] ! segment.stop = e.attributes['stop'] ! segment.version = e.attributes['version'] ! segment.label = e.attributes['label'] e.elements.each do |e| ! feature = FEATURE.new ! feature.entry_id = e.attributes['id'] ! feature.label = e.attributes['label'] ! e.elements.each do |e| ! case e.name ! when 'TYPE' ! type = TYPE.new ! type.entry_id = e.attributes['id'] ! type.category = e.attributes['category'] ! type.reference = e.attributes['referrence'] ! type.label = e.text ! feature.types << type ! when 'METHOD' ! feature.method_id = e.attributes['id'] ! feature.method = e.text ! when 'START' ! feature.start = e.text ! when 'STOP', 'END' ! feature.stop = e.text ! when 'SCORE' ! feature.score = e.text ! when 'ORIENTATION' ! feature.orientation = e.text ! when 'PHASE' ! feature.phase = e.text ! when 'NOTE' ! feature.notes << e.text ! when 'LINK' ! link = LINK.new ! link.href = e.attributes['href'] ! link.text = e.text ! feature.links << link ! when 'TARGET' ! target = TARGET.new ! target.entry_id = e.attributes['id'] ! target.start = e.attributes['start'] ! target.stop = e.attributes['stop'] ! target.name = e.text ! feature.targets << target ! when 'GROUP' ! group = GROUP.new ! group.entry_id = e.attributes['id'] ! group.label = e.attributes['label'] ! group.type = e.attributes['type'] ! e.elements.each do |e| ! case e.name ! when 'NOTE' # in GROUP ! group.notes << e.text ! when 'LINK' # in GROUP ! link = LINK.new ! link.href = e.attributes['href'] ! link.text = e.text ! group.links << link ! when 'TARGET' # in GROUP ! target = TARGET.new ! target.entry_id = e.attributes['id'] ! target.start = e.attributes['start'] ! target.stop = e.attributes['stop'] ! target.name = e.text ! group.targets << target ! end end - feature.groups << group end end - segment.features << feature end ! gff.segments << segment end end - gff end ! class DSN ! attr_accessor :source, :source_id, :source_version, ! :mapmaster, :description, :description_href ! end ! ! class ENTRY_POINT ! def initialize ! @segments = Array.new ! end ! attr_reader :segments ! attr_accessor :href, :version ! def each ! @segments.each do |x| ! yield x ! end ! end end ! class SEGMENT ! def self.region(entry_id, start, stop) ! segment = self.new ! segment.entry_id = entry_id ! segment.start = start ! segment.stop = stop ! return segment ! end ! ! def initialize ! @features = Array.new # for FEATURE ! @types = Array.new # for TYPE end - attr_accessor :entry_id, :start, :stop, :orientation, :description, - :subparts, # optional - :features, :version, :label, # for FEATURE - :types # for TYPE end ! class DNA ! attr_accessor :entry_id, :start, :stop, :version, :sequence, :length end ! class SEQUENCE ! attr_accessor :entry_id, :start, :stop, :moltype, :version, :sequence end ! class TYPES < ENTRY_POINT; end ! class TYPE ! attr_accessor :entry_id, :method, :category, :count, ! :reference, :label # for FEATURE ! end ! class GFF ! def initialize ! @segments = Array.new ! end ! attr_reader :segments ! attr_accessor :version, :href ! end ! class FEATURE ! def initialize ! @notes = Array.new ! @links = Array.new ! @types = Array.new ! @targets = Array.new ! @groups = Array.new ! end ! attr_accessor :entry_id, :label, ! :method_id, :method, :start, :stop, :score, :orientation, :phase ! attr_reader :notes, :links, :types, :targets, :groups ! end ! class LINK ! attr_accessor :href, :text end ! class TARGET ! attr_accessor :entry_id, :start, :stop, :name end ! class GROUP ! def initialize ! @notes = Array.new ! @links = Array.new ! @targets = Array.new ! end ! attr_accessor :entry_id, :label, :type ! attr_reader :notes, :links, :targets ! end end end if __FILE__ == $0 --- 43,429 ---- require 'bio/sequence' + module Bio ! class DAS ! # Specify DAS server to connect ! def initialize(url = 'http://www.wormbase.org:80/db/') ! schema, user, host, port, reg, path, = URI.split(url) ! @server = Net::HTTP.new(host, port) ! @prefix = path ? path.chomp('/') : '' ! end ! # Returns an Array of Bio::DAS::DSN ! def get_dsn ! ary = [] ! result, = @server.get(@prefix + '/das/dsn') ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::DSN') do |e| ! dsn = DSN.new ! e.elements.each do |e| ! case e.name ! when 'SOURCE' ! dsn.source = e.text ! dsn.source_id = e.attributes['id'] ! dsn.source_version = e.attributes['version'] ! when 'MAPMASTER' ! dsn.mapmaster = e.name ! when 'DESCRIPTION' ! dsn.description = e.text ! dsn.description_href = e.attributes['href'] end end ! ary << dsn end + ary + end ! # Returns Bio::DAS::ENTRY_POINT. ! # The 'dsn' can be a String or a Bio::DAS::DSN object. ! def get_entry_point(dsn) ! entry_point = ENTRY_POINT.new ! dsn = dsn.source if dsn.instance_of?(Bio::DAS::DSN) ! result, = @server.get(@prefix + '/das/' + dsn + '/entry_points') ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::ENTRY_POINTS') do |e| ! entry_point.href = e.attributes['href'] ! entry_point.version = e.attributes['version'] ! e.elements.each do |e| ! segment = SEGMENT.new ! segment.entry_id = e.attributes['id'] ! segment.start = e.attributes['start'] ! segment.stop = e.attributes['stop'] ! segment.stop = e.attributes['orientation'] ! segment.subparts = e.attributes['subparts'] ! segment.description = e.text ! entry_point.segments << segment end end + entry_point + end ! # Returns an Array of Bio::DAS::DNA. ! # The 'dsn' can be a String or a Bio::DAS::DSN object. ! # The 'segments' can be a Bio::DAS::SEGMENT object or an Array of ! # Bio::DAS::SEGMENT ! def get_dna(dsn, segments) ! ary = [] ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/dna?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::SEQUENCE') do |e| ! sequence = DNA.new ! sequence.entry_id = e.attributes['id'] ! sequence.start = e.attributes['start'] ! sequence.stop = e.attributes['stop'] ! sequence.version = e.attributes['version'] ! e.elements.each do |e| ! sequence.sequence = Bio::Sequence::NA.new(e.text) ! sequence.length = e.attributes['length'].to_i end ! ary << sequence end + ary + end ! # Returns an Array of Bio::DAS::SEQUENCE. ! # The 'dsn' can be a String or a Bio::DAS::DSN object. ! # The 'segments' can be a Bio::DAS::SEGMENT object or an Array of ! # Bio::DAS::SEGMENT ! def get_sequence(dsn, segments) ! ary = [] ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/sequence?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::SEQUENCE') do |e| ! sequence = SEQUENCE.new ! sequence.entry_id = e.attributes['id'] ! sequence.start = e.attributes['start'] ! sequence.stop = e.attributes['stop'] ! sequence.moltype = e.attributes['moltype'] ! sequence.version = e.attributes['version'] ! case sequence.moltype ! when /dna|rna/i # 'DNA', 'ssRNA', 'dsRNA' ! sequence.sequence = Bio::Sequence::NA.new(e.text) ! when /protein/i # 'Protein ! sequence.sequence = Bio::Sequence::AA.new(e.text) ! else ! sequence.sequence = e.text end ! ary << sequence end + ary + end ! # Returns a Bio::DAS::TYPES object. ! # The 'dsn' can be a String or a Bio::DAS::DSN object. ! # The 'segments' is optional and can be a Bio::DAS::SEGMENT object or ! # an Array of Bio::DAS::SEGMENT ! def get_types(dsn, segments = []) # argument 'type' is deprecated ! types = TYPES.new ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/types?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::GFF') do |e| ! types.version = e.attributes['version'] ! types.href = e.attributes['href'] ! e.elements.each do |e| ! segment = SEGMENT.new ! segment.entry_id = e.attributes['id'] ! segment.start = e.attributes['start'] ! segment.stop = e.attributes['stop'] ! segment.version = e.attributes['version'] ! segment.label = e.attributes['label'] e.elements.each do |e| ! t = TYPE.new ! t.entry_id = e.attributes['id'] ! t.method = e.attributes['method'] ! t.category = e.attributes['category'] ! t.count = e.text.to_i ! segment.types << t end + types.segments << segment end end + types + end ! # Returns a Bio::DAS::GFF object. ! # The 'dsn' can be a String or a Bio::DAS::DSN object. ! # The 'segments' is optional and can be a Bio::DAS::SEGMENT object or ! # an Array of Bio::DAS::SEGMENT ! def get_features(dsn, segments = [], categorize = false, feature_ids = [], group_ids = []) ! # arguments 'type' and 'category' are deprecated ! gff = GFF.new ! dsn = dsn.source if dsn.instance_of?(DSN) ! segments = [segments] if segments.instance_of?(SEGMENT) ! opts = [] ! segments.each do |s| ! opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" ! end ! if categorize ! opts << "categorize=yes" # default is 'no' ! end ! feature_ids.each do |fid| ! opts << "feature_id=#{fid}" ! end ! group_ids.each do |gid| ! opts << "group_id=#{gid}" ! end ! query = opts.join(';') ! result, = @server.get(@prefix + '/das/' + dsn + '/features?' + query) ! doc = REXML::Document.new(result.body) ! doc.elements.each('/descendant::GFF') do |e| ! gff.version = e.attributes['version'] ! gff.href = e.attributes['href'] ! e.elements.each('SEGMENT') do |e| ! segment = SEGMENT.new ! segment.entry_id = e.attributes['id'] ! segment.start = e.attributes['start'] ! segment.stop = e.attributes['stop'] ! segment.version = e.attributes['version'] ! segment.label = e.attributes['label'] ! e.elements.each do |e| ! feature = FEATURE.new ! feature.entry_id = e.attributes['id'] ! feature.label = e.attributes['label'] e.elements.each do |e| ! case e.name ! when 'TYPE' ! type = TYPE.new ! type.entry_id = e.attributes['id'] ! type.category = e.attributes['category'] ! type.reference = e.attributes['referrence'] ! type.label = e.text ! feature.types << type ! when 'METHOD' ! feature.method_id = e.attributes['id'] ! feature.method = e.text ! when 'START' ! feature.start = e.text ! when 'STOP', 'END' ! feature.stop = e.text ! when 'SCORE' ! feature.score = e.text ! when 'ORIENTATION' ! feature.orientation = e.text ! when 'PHASE' ! feature.phase = e.text ! when 'NOTE' ! feature.notes << e.text ! when 'LINK' ! link = LINK.new ! link.href = e.attributes['href'] ! link.text = e.text ! feature.links << link ! when 'TARGET' ! target = TARGET.new ! target.entry_id = e.attributes['id'] ! target.start = e.attributes['start'] ! target.stop = e.attributes['stop'] ! target.name = e.text ! feature.targets << target ! when 'GROUP' ! group = GROUP.new ! group.entry_id = e.attributes['id'] ! group.label = e.attributes['label'] ! group.type = e.attributes['type'] ! e.elements.each do |e| ! case e.name ! when 'NOTE' # in GROUP ! group.notes << e.text ! when 'LINK' # in GROUP ! link = LINK.new ! link.href = e.attributes['href'] ! link.text = e.text ! group.links << link ! when 'TARGET' # in GROUP ! target = TARGET.new ! target.entry_id = e.attributes['id'] ! target.start = e.attributes['start'] ! target.stop = e.attributes['stop'] ! target.name = e.text ! group.targets << target end end + feature.groups << group end end ! segment.features << feature end + gff.segments << segment end end + gff + end ! class DSN ! attr_accessor :source, :source_id, :source_version, ! :mapmaster, :description, :description_href ! end ! class ENTRY_POINT ! def initialize ! @segments = Array.new end + attr_reader :segments + attr_accessor :href, :version ! def each ! @segments.each do |x| ! yield x end end + end ! class SEGMENT ! def self.region(entry_id, start, stop) ! segment = self.new ! segment.entry_id = entry_id ! segment.start = start ! segment.stop = stop ! return segment end ! def initialize ! @features = Array.new # for FEATURE ! @types = Array.new # for TYPE end + attr_accessor :entry_id, :start, :stop, :orientation, :description, + :subparts, # optional + :features, :version, :label, # for FEATURE + :types # for TYPE + end ! class DNA ! attr_accessor :entry_id, :start, :stop, :version, :sequence, :length ! end ! class SEQUENCE ! attr_accessor :entry_id, :start, :stop, :moltype, :version, :sequence ! end ! class TYPES < ENTRY_POINT; end ! class TYPE ! attr_accessor :entry_id, :method, :category, :count, ! :reference, :label # for FEATURE ! end ! class GFF ! def initialize ! @segments = Array.new end + attr_reader :segments + attr_accessor :version, :href + end ! class FEATURE ! def initialize ! @notes = Array.new ! @links = Array.new ! @types = Array.new ! @targets = Array.new ! @groups = Array.new end + attr_accessor :entry_id, :label, + :method_id, :method, :start, :stop, :score, :orientation, :phase + attr_reader :notes, :links, :types, :targets, :groups + end ! class LINK ! attr_accessor :href, :text ! end + class TARGET + attr_accessor :entry_id, :start, :stop, :name end + + class GROUP + def initialize + @notes = Array.new + @links = Array.new + @targets = Array.new + end + attr_accessor :entry_id, :label, :type + attr_reader :notes, :links, :targets + end + end + end # module Bio + if __FILE__ == $0 *************** *** 435,470 **** - =begin - - = Bio::DAS - - --- Bio::DAS.new(url) - --- Bio::DAS#get_dsn # -> Array of Bio::DAS::DSN - --- Bio::DAS#get_entry_point(dsn) # -> Bio::DAS::ENTRY_POINT - dsn can be String or Bio::DAS::DSN - --- Bio::DAS#get_dna(dsn, segments) # -> Array of Bio::DAS::DNA - segments can be Bio::DAS::SEGMENT or Array of Bio::DAS::SEGMENT - --- Bio::DAS#get_sequence(dsn, segments) # -> Array of Bio::DAS::SEQUENCE - --- Bio::DAS#get_types(dsn, segments = []) # -> Bio::DAS::TYPES - segments is option - --- Bio::DAS#get_features(dsn, segments = [], categorize = false, feature_ids = [], group_ids = []) # -> Bio::DAS::GFF - - == Bio::DAS::DSN - == Bio::DAS::ENTRY_POINT - == Bio::DAS::SEGMENT - == Bio::DAS::DNA - == Bio::DAS::SEQUENCE - == Bio::DAS::TYPES - == Bio::DAS::TYPE - == Bio::DAS::GFF - == Bio::DAS::FEATURE - == Bio::DAS::LINK - == Bio::DAS::TARGET - == Bio::DAS::GROUP - - - == TODO - - link, stylesheet - - =end --- 470,471 ---- From k at pub.open-bio.org Sat Nov 5 03:32:28 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:30:02 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io dbget.rb,1.10,1.11 Message-ID: <200511050832.jA58WSVL029761@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv29757/lib/bio/io Modified Files: dbget.rb Log Message: * converted to RDoc Index: dbget.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/dbget.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** dbget.rb 8 Sep 2005 01:22:11 -0000 1.10 --- dbget.rb 5 Nov 2005 08:32:26 -0000 1.11 *************** *** 1,7 **** # ! # bio/io/dbget.rb - GenomeNet/DBGET client module # ! # Copyright (C) 2000 Mitsuteru C. Nakao ! # Copyright (C) 2000, 2001 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,18 ---- # ! # = bio/io/dbget.rb - GenomeNet/DBGET client module # ! # Copyright:: Copyright (C) 2000, 2001 ! # Mitsuteru C. Nakao , ! # Toshiaki Katayama ! # License:: LGPL ! # ! # $Id$ ! # ! # == DBGET ! # ! # Accessing the GenomeNet/DBGET data retrieval system ! # http://www.genome.jp/dbget/ within the intranet. ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 19,23 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 30,34 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 26,135 **** module Bio ! class DBGET ! # SERV = "dbgetserv.genome.jp" # default DBGET server address ! SERV = "dbget.genome.jp" # default DBGET server address ! PORT = "3266" # default DBGET port number ! def DBGET.dbget(com, arg, serv = nil, port = nil) ! unless serv or port # if both of serv and port are nil ! if ENV["DBGET"] =~ /:/ # and ENV["DBGET"] exists ! serv, port = ENV["DBGET"].split(':') ! end end ! serv = serv ? serv : SERV ! port = port ? port : PORT ! if arg.empty? ! arg = "-h" # DBGET help message ! end ! query = "#{com} #{arg}\n" # DBGET query string ! sock = TCPSocket.open("#{serv}", "#{port}") ! sock.write(query) # submit query ! sock.flush # buffer flush ! sock.gets # skip "+Helo DBgetServ ..." ! sock.gets # skip "#If you see this message, ..." ! sock.gets # skip "*Request-IDent" ! result = sock.read # DBGET result ! sock.close ! return result ! end ! def DBGET.version ! dbget("bget", "-V") ! end ! ### Individual DBGET functions (in alphabetical order) ! # alink("db entry") - print relations ! def DBGET.alink(arg) ! dbget("alink", arg) ! end ! # bacc("db entry") - not supported : get accession(s) ! # bent("db entry") - not supported : get entry name ! # bfind("db keyword") - search entries by keyword ! def DBGET.bfind(arg) ! dbget("bfind", arg) ! end ! # bget("db entry") - get entry by the entry name ! def DBGET.bget(arg) ! dbget("bget", arg) ! end ! def DBGET.seq(arg) ! dbget("bget", "-f -n 1 #{arg}") ! end ! def DBGET.seq2(arg) ! dbget("bget", "-f -n 2 #{arg}") ! end ! # binfo("db") - get database information ! def DBGET.binfo(arg) ! dbget("binfo", arg) ! end ! # blink("db entry") - print link informations ! def DBGET.blink(arg) ! dbget("blink", arg) ! end ! # bman ("db entry") - print manual page ! def DBGET.bman(arg) ! dbget("bman", arg) ! end ! # bref("db entry") - get references and authors ! def DBGET.bref(arg) ! dbget("bref", arg) ! end ! # btab ("db entry") - get/generate database alias table ! def DBGET.btab(arg) ! dbget("btab", arg) ! end ! # btit("db entry ..") - get entry definition ! def DBGET.btit(arg) ! dbget("btit", arg) ! end ! # lmarge("db entry") - not supported end end if __FILE__ == $0 --- 37,199 ---- module Bio ! class DBGET ! # default DBGET server address ! # SERV = "dbgetserv.genome.jp" ! SERV = "dbget.genome.jp" ! # default DBGET port number ! PORT = "3266" ! # Main class method to access DBGET server. Optionally, this method ! # can be called with the alternative DBGET server address and the ! # TCP/IP port number. ! # ! # 'com' should be one of the following DBGET commands: ! # ! # * alink, bfind, bget, binfo, blink, bman, bref, btab, btit ! # ! # These methods are shortcut for the dbget commands. Actually, ! # Bio::DBGET.((|com|))(arg) internally calls Bio::DBGET.dbget(com, arg). ! # Most of these methods accept the argument "-h" for help. ! # ! # 'arg' should be one of the following formats : ! # ! # * [options] db ! # * specify the database name only for binfo, bman etc. ! # * [options] db:entry ! # * specify the database name and the entry name to retrieve. ! # * [options] db entry1 entry2 ... ! # * specify the database name and the list of entries to retrieve. ! # ! # Note that options in the above example can be omitted. If 'arg' is ! # empty, the help message with a list of options for 'com' will be ! # shown by default. Supported database names will be found at the ! # GenomeNet DBGET web page http://www.genome.jp/dbget/. ! # ! def DBGET.dbget(com, arg, serv = nil, port = nil) ! unless serv or port # if both of serv and port are nil ! if ENV["DBGET"] =~ /:/ # and ENV["DBGET"] exists ! serv, port = ENV["DBGET"].split(':') end ! end ! serv = serv ? serv : SERV ! port = port ? port : PORT ! if arg.empty? ! arg = "-h" # DBGET help message ! end ! query = "#{com} #{arg}\n" # DBGET query string ! sock = TCPSocket.open("#{serv}", "#{port}") ! sock.write(query) # submit query ! sock.flush # buffer flush ! sock.gets # skip "+Helo DBgetServ ..." ! sock.gets # skip "#If you see this message, ..." ! sock.gets # skip "*Request-IDent" ! result = sock.read # DBGET result ! sock.close ! return result ! end ! # Show the version information of the DBGET server. ! def DBGET.version ! dbget("bget", "-V") ! end ! #-- ! # bacc("db entry") - not supported : get accession(s) ! # bent("db entry") - not supported : get entry name ! # lmarge("db entry") - not supported ! #++ ! # alink("db entry") method returns relations ! def DBGET.alink(arg) ! dbget("alink", arg) ! end ! # bfind("db keyword") method searches entries by keyword ! def DBGET.bfind(arg) ! dbget("bfind", arg) ! end ! # bget("db entry") method retrieves entries specified by the entry names ! def DBGET.bget(arg) ! dbget("bget", arg) ! end ! # seq("db entry") method retrieves the first sequence of the entry ! # ! # Shortcut to retrieve the sequence of the entry in FASTA format. ! # This method is equivalent to Bio::DBGET.bget("-f -n 1 #{arg}") and ! # 'arg' should be the "db:entry" or "db entry1 entry2 ..." format. ! def DBGET.seq(arg) ! dbget("bget", "-f -n 1 #{arg}") ! end ! # seq2("db entry") method retrieves the second sequence of the entry if any ! # ! # Shortcut to retrieve the second sequence of the entry in FASTA format. ! # This method is equivalent to Bio::DBGET.bget("-f -n 2 #{arg}"). ! # Only useful when treating the KEGG GENES database entries which have ! # both AASEQ and NTSEQ fields. This method is obsolete and it is ! # recommended to use 'naseq' and 'aaseq' instead. ! def DBGET.seq2(arg) ! dbget("bget", "-f -n 2 #{arg}") ! end ! # naseq("db entry") method retrieves the nucleic acid sequence of the ! # entry if any. ! def DBGET.naseq(arg) ! dbget("bget", "-f -n n #{arg}") ! end ! # aaseq("db entry") method retrieves the amino acid sequence of the ! # entry if any. ! def DBGET.aaseq(arg) ! dbget("bget", "-f -n a #{arg}") ! end ! # binfo("db") method retrieves the database information ! def DBGET.binfo(arg) ! dbget("binfo", arg) ! end ! # blink("db entry") method retrieves the link information ! def DBGET.blink(arg) ! dbget("blink", arg) ! end ! # bman ("db entry") method shows the manual page ! def DBGET.bman(arg) ! dbget("bman", arg) ! end ! # bref("db entry") method retrieves the references and authors ! def DBGET.bref(arg) ! dbget("bref", arg) ! end ! # btab ("db entry") method retrives (and generates) the database alias table ! def DBGET.btab(arg) ! dbget("btab", arg) ! end + # btit("db entry ..") method retrieves the entry definition + def DBGET.btit(arg) + dbget("btit", arg) end end + end # module Bio + if __FILE__ == $0 *************** *** 145,213 **** puts Bio::DBGET.binfo('dbget') end - - - =begin - - = Bio::DBGET - - Accessing the GenomeNet/DBGET data retrieval system - (()). - - --- Bio::DBGET.dbget(com, arg, serv = nil, port = nil) - - Main class method to access DBGET server. Optionally, this method - can be called with the alternative DBGET server address and the - TCP/IP port number. - - 'com' should be one of the following DBGET commands : - - * alink, bfind, bget, binfo, blink, bman, bref, btab, btit - - 'arg' should be one of the following formats : - - * [options] db - * specify the database name only for binfo, bman etc. - * [options] db:entry - * specify the database name and the entry name to retrieve. - * [options] db entry1 entry2 ... - * specify the database name and the list of entries to retrieve. - - Note that options in the above example can be omitted. If 'arg' is - empty, the help message with a list of options for 'com' will be - shown by default. Supported database names will be found at the - GenomeNet DBGET web page (()). - - --- BIO::DBGET.alink(arg) - --- Bio::DBGET.bfind(arg) - --- Bio::DBGET.bget(arg) - --- Bio::DBGET.binfo(arg) - --- Bio::DBGET.blink(arg) - --- Bio::DBGET.bman(arg) - --- Bio::DBGET.bref(arg) - --- Bio::DBGET.btab(arg) - --- Bio::DBGET.btit(arg) - - These class methods are shortcut for the dbget commands. Actually, - Bio::DBGET.((|com|))(arg) internally calls Bio::DBGET.dbget(com, arg). - Most of these methods accept the argument "-h" for help. - - --- Bio::DBGET.version - - Show the version information of the DBGET server. - - --- Bio::DBGET.seq(arg) - - Shortcut to retrieve the sequence of the entry in FASTA format. - This method is equivalent to Bio::DBGET.bget("-f -n 1 #{arg}") and - 'arg' should be the "db:entry" or "db entry1 entry2 ..." format. - - --- Bio::DBGET.seq2(arg) - - Shortcut to retrieve the second sequence of the entry in FASTA format. - This method is equivalent to Bio::DBGET.bget("-f -n 2 #{arg}"). - Only useful when treating the KEGG/GENES database entries which have - both AASEQ and NTSEQ fields. - - =end --- 209,212 ---- From k at pub.open-bio.org Sat Nov 5 03:33:03 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:30:32 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io ddbjxml.rb,1.6,1.7 Message-ID: <200511050833.jA58X3VL029809@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv29805/lib/bio/io Modified Files: ddbjxml.rb Log Message: * converted to RDoc Index: ddbjxml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ddbjxml.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ddbjxml.rb 26 Sep 2005 13:00:08 -0000 1.6 --- ddbjxml.rb 5 Nov 2005 08:33:01 -0000 1.7 *************** *** 1,6 **** # ! # bio/io/ddbjxml.rb - DDBJ SOAP server access class # ! # Copyright (C) 2003, 2004 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/io/ddbjxml.rb - DDBJ SOAP server access class # ! # Copyright:: Copyright (C) 2003, 2004 ! # KATAYAMA Toshiaki ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # From k at pub.open-bio.org Sat Nov 5 03:33:55 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:31:24 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.3,1.4 Message-ID: <200511050833.jA58XtVL029859@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv29853/lib/bio/shell Modified Files: core.rb Log Message: * converted to RDoc * opening, closing methods are renamed to open and close Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** core.rb 24 Sep 2005 12:33:07 -0000 1.3 --- core.rb 5 Nov 2005 08:33:53 -0000 1.4 *************** *** 1,6 **** # ! # bio/shell/core.rb - internal methods for BioRuby shell # ! # Copyright (C) 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/shell/core.rb - internal methods for BioRuby shell # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 65,69 **** end ! def opening load_object load_history --- 71,75 ---- end ! def open load_object load_history *************** *** 71,75 **** end ! def closing closing_splash save_history --- 77,81 ---- end ! def close closing_splash save_history From k at pub.open-bio.org Sat Nov 5 03:33:55 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:31:25 2005 Subject: [BioRuby-cvs] bioruby/bin bioruby,1.3,1.4 Message-ID: <200511050833.jA58XtVL029863@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/bin In directory pub.open-bio.org:/tmp/cvs-serv29853/bin Modified Files: bioruby Log Message: * converted to RDoc * opening, closing methods are renamed to open and close Index: bioruby =================================================================== RCS file: /home/repository/bioruby/bioruby/bin/bioruby,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bioruby 27 Oct 2005 11:55:58 -0000 1.3 --- bioruby 5 Nov 2005 08:33:53 -0000 1.4 *************** *** 1,7 **** #!/usr/bin/env ruby # ! # BioRuby shell - command line interface for the BioRuby library # ! # Copyright (C) 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,13 ---- #!/usr/bin/env ruby # ! # = BioRuby shell - command line interface for the BioRuby library # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 19,26 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # ! $: << File.dirname(__FILE__)+'/../lib' require 'bio/shell' --- 25,38 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # ! # $: << File.dirname(__FILE__)+'/../lib' ! ! begin ! require 'rubygems' ! require_gem 'bio', '~> 0.7' ! rescue LoadError ! end require 'bio/shell' *************** *** 80,84 **** # loading workspace and command history ! Bio::Shell.opening Signal.trap("SIGINT") do --- 92,96 ---- # loading workspace and command history ! Bio::Shell.open Signal.trap("SIGINT") do *************** *** 91,93 **** # saving workspace, command history and configuration before exit ! Bio::Shell.closing --- 103,105 ---- # saving workspace, command history and configuration before exit ! Bio::Shell.close From k at pub.open-bio.org Sat Nov 5 03:34:51 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:32:24 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell session.rb,1.1,1.2 Message-ID: <200511050834.jA58YpVL029932@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv29928/lib/bio/shell Modified Files: session.rb Log Message: * converted to RDoc * changed to private methods Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** session.rb 23 Sep 2005 13:57:08 -0000 1.1 --- session.rb 5 Nov 2005 08:34:49 -0000 1.2 *************** *** 1,6 **** # ! # bio/shell/session.rb - core user interface of the BioRuby shell # ! # Copyright (C) 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/shell/session.rb - core user interface of the BioRuby shell # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,26 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # module Bio::Shell ### work space --- 24,34 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # module Bio::Shell + private + ### work space *************** *** 29,32 **** --- 37,44 ---- end + def rm(name) # name = :hoge + eval("#{name} = nil", conf.workspace.binding) + end + ### config *************** *** 49,52 **** --- 61,67 ---- ### pager + # + # mysql> pager less + # def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html From k at pub.open-bio.org Sat Nov 5 03:36:26 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:33:55 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin flatfile.rb,1.3,1.4 Message-ID: <200511050836.jA58aQVL029982@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv29978/lib/bio/shell/plugin Modified Files: flatfile.rb Log Message: * converted to RDoc * changed to private methods * convert_to_fasta method is renamed to save_fasta * bioflat_index method is renamed to flatindex * bioflat_search method is renamed to flatsearch Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** flatfile.rb 5 Oct 2005 08:56:14 -0000 1.3 --- flatfile.rb 5 Nov 2005 08:36:24 -0000 1.4 *************** *** 1,6 **** # ! # bio/shell/plugin/flatfile.rb - plugin for flatfile database # ! # Copyright (C) 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/shell/plugin/flatfile.rb - plugin for flatfile database # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 25,28 **** --- 31,36 ---- module Bio::Shell + private + def flatauto(filename) if block_given? *************** *** 40,44 **** end ! def convert_to_fasta(fastafile, *flatfiles) puts "Saving fasta file (#{fastafile}) ... " File.open(fastafile, "w") do |fasta| --- 48,52 ---- end ! def save_fasta(fastafile, *flatfiles) puts "Saving fasta file (#{fastafile}) ... " File.open(fastafile, "w") do |fasta| *************** *** 56,60 **** end ! def bioflat_index(dbname, *flatfiles) prefix = Core::SAVEDIR + Core::BIOFLAT unless File.directory?(prefix) --- 64,68 ---- end ! def flatindex(dbname, *flatfiles) prefix = Core::SAVEDIR + Core::BIOFLAT unless File.directory?(prefix) *************** *** 72,76 **** end ! def bioflat_search(dbname, keyword) dir = Core::SAVEDIR + Core::BIOFLAT + dbname.to_s Bio::FlatFileIndex.open(dir) do |db| --- 80,84 ---- end ! def flatsearch(dbname, keyword) dir = Core::SAVEDIR + Core::BIOFLAT + dbname.to_s Bio::FlatFileIndex.open(dir) do |db| *************** *** 85,88 **** --- 93,97 ---- end + =begin def bioflat_namespaces(dbname) dir = Core::SAVEDIR + Core::BIOFLAT + dbname.to_s *************** *** 91,94 **** --- 100,104 ---- db.close end + =end end From k at pub.open-bio.org Sat Nov 5 03:38:15 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 03:35:49 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin midi.rb,1.2,1.3 Message-ID: <200511050838.jA58cFVL030061@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv30047/lib/bio/shell/plugin Modified Files: midi.rb Log Message: * converted to RDoc * mechanism to select musical styles are incorpolated (scales are also contributed by Natsuhiro Ichinose) Index: midi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/midi.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** midi.rb 5 Oct 2005 08:58:33 -0000 1.2 --- midi.rb 5 Nov 2005 08:38:13 -0000 1.3 *************** *** 1,6 **** # ! # bio/shell/plugin/midi.rb - Sequence to MIDI converter # ! # Copyright (C) 2003 Natsuhiro Ichinose # # This library is free software; you can redistribute it and/or --- 1,13 ---- # ! # = bio/shell/plugin/midi.rb - Sequence to MIDI converter # ! # Copyright:: Copyright (C) 2003, 2005 ! # Natsuhiro Ichinose , ! # Toshiaki Katayama ! # License:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,183 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # ! class Bio::Sequence::NA ! ! class MidiTrack ! ! def initialize(channel = 0, program = nil, base = nil, range = nil, scale = nil) ! @channel = channel & 0xff ! @program = program || 0 ! @base = base || 60 ! @range = range || 2 ! @scale = scale || [0, 2, 4, 5, 7, 9, 11] ! @tunes = [] ! @tune = 0 ! @code = [] ! @time = 0 ! @range.times do |i| ! @scale.each do |c| ! @tunes.push c + i * 12 ! end ! end ! @ttype = { ! 'aa' => 1, 'at' => 0, 'ac' => 3, 'ag' => -1, ! 'ta' => 0, 'tt' => -1, 'tc' => 1, 'tg' => -2, ! 'ca' => 2, 'ct' => 1, 'cc' => 2, 'cg' => 6, ! 'ga' => -1, 'gt' => -3, 'gc' => 0, 'gg' => -2, ! } ! @dtype = [ ! { 'aa' => 2, 'at' => 4, 'ac' => 4, 'ag' => 2, ! 'ta' => 2, 'tt' => 4, 'tc' => 4, 'tg' => 2, ! 'ca' => 2, 'ct' => 3, 'cc' => 1, 'cg' => 2, ! 'ga' => 1, 'gt' => 2, 'gc' => 2, 'gg' => 3, ! }, ! { 'aa' => 3, 'at' => 3, 'ac' => 2, 'ag' => 3, ! 'ta' => 3, 'tt' => 3, 'tc' => 2, 'tg' => 2, ! 'ca' => 3, 'ct' => 2, 'cc' => 1, 'cg' => 1, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, ! }, ! { 'aa' => 2, 'at' => 2, 'ac' => 2, 'ag' => 2, ! 'ta' => 1, 'tt' => 1, 'tc' => 2, 'tg' => 2, ! 'ca' => 2, 'ct' => 2, 'cc' => 2, 'cg' => 3, ! 'ga' => 2, 'gt' => 2, 'gc' => 3, 'gg' => 1, ! }, ! { 'aa' => 1, 'at' => 1, 'ac' => 1, 'ag' => 1, ! 'ta' => 1, 'tt' => 1, 'tc' => 1, 'tg' => 1, ! 'ca' => 1, 'ct' => 1, 'cc' => 1, 'cg' => 3, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, ! }, ] ! @code.concat [0x00, 0xc0 | (@channel & 0xff)] ! @code.concat icode(@program & 0xff, 1) ! end ! def icode(num, n) ! code = [] ! n.times do |i| ! code.push num & 0xff ! num >>= 8 end - code.reverse end ! def rcode(num) ! code = [] ! code.push num & 0x7f ! while num > 0x7f ! num >>= 7 ! code.push num & 0x7f | 0x80 ! end ! code.reverse end ! def c2s(code) ! ans = "" ! code.each do |c| ! ans += c.chr ! end ! ans end ! def push(s) ! tt = @time % 4 ! t = @ttype[s[0, 2]] ! d = @dtype[tt][s[2, 2]] ! if !t.nil? && !d.nil? ! @tune += t ! @tune %= @tunes.length ! if tt == 0 ! vel = 90 ! elsif tt == 1 && d > 1 ! vel = 100 ! elsif tt == 2 ! vel = 60 ! else ! vel = 50 ! end ! @code.concat rcode(1) ! @code.concat [0x90 | @channel, @tunes[@tune] + @base, vel] ! @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, @tunes[@tune] + @base, 0] ! @time += d ! end end ! def push_silent(d) @code.concat rcode(1) ! @code.concat [0x90 | @channel, 0, 0] @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, 0, 0] ! @time += d; end ! def get_time ! @time ! end ! def encode ! ans ="MTrk" ! ans += c2s(icode(@code.length + 4, 4)) ! ans += c2s(@code) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end ! def header(num, tempo = 120) ! ans = "MThd" ! ans += c2s(icode(6, 4)) ! ans += c2s(icode(1, 2)) ! ans += c2s(icode(num + 1, 2)) ! ans += c2s(icode(480, 2)) ! ans += "MTrk" ! ans += c2s(icode(11, 4)) ! ans += c2s([0x00, 0xff, 0x51, 0x03]) ! ans += c2s(icode(60000000 / tempo, 3)) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end ! end # MidiTrack ! # drum: ! # true (with rhythm part), false (without rhythm part) # scale: # C C# D D# E F F# G G# A A# B # 0 1 2 3 4 5 6 7 8 9 10 11 ! def to_midi(tempo = 120, drum = true, scale = nil, track_info = nil) ! scale ||= [0, 2, 4, 5, 7, 9, 11] ! track_info ||= [[9, 60, 2], [13, 48, 2], [41, 48, 2], [44, 36, 2]] track = [] ! track_info.each_with_index do |i, j| ! k = j ! k += 1 if j >= 9 ! track.push MidiTrack.new(k, i[0], i[1], i[2], scale) end --- 25,385 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # ! #-- ! # *TODO* ! # - add "Ohno" style ! # - add a accessor to drum pattern ! # - add a new feature to select music style (pop, trans, ryukyu, ...) ! # - what is the base? ! #++ ! class MidiTrack ! MidiProg = [ ! "Acoustic Grand Piano", ! "Bright Acoustic Piano", ! "Electric grand Piano", ! "Honky Tonk Piano", ! "Eiectric Piano 1", ! "Electric Piano 2", ! "Harpsichord", ! "Clavinet", ! "Celesra", ! "Glockenspiel", ! "Music Box", ! "Vibraphone", ! "Marimba", ! "Xylophone", ! "Tubular bells", ! "Dulcimer", ! "Drawbar Organ", ! "Percussive Organ", ! "Rock Organ", ! "Church Organ", ! "Reed Organ", ! "Accordion", ! "Harmonica", ! "Tango Accordion", ! "Nylon Accustic Guitar", ! "Steel Acoustic Guitar", ! "Jazz Electric Guitar", ! "Ciean Electric Guitar", ! "Muted Electric Guitar", ! "Overdrive Guitar", ! "Distorted Guitar", ! "Guitar Harmonics", ! "Acoustic Bass", ! "Electric Fingered Bass", ! "Electric Picked Bass", ! "Fretless Bass", ! "Slap Bass 1", ! "Slap Bass 2", ! "Syn Bass 1", ! "Syn Bass 2", ! "Violin", ! "Viola", ! "Cello", ! "Contrabass", ! "Tremolo Strings", ! "Pizzicato Strings", ! "Orchestral Harp", ! "Timpani", ! "String Ensemble 1", ! "String Ensemble 2 (Slow)", ! "Syn Strings 1", ! "Syn Strings 2", ! "Choir Aahs", ! "Voice Oohs", ! "Syn Choir", ! "Orchestral Hit", ! "Trumpet", ! "Trombone", ! "Tuba", ! "Muted Trumpet", ! "French Horn", ! "Brass Section", ! "Syn Brass 1", ! "Syn Brass 2", ! "Soprano Sax", ! "Alto Sax", ! "Tenor Sax", ! "Baritone Sax", ! "Oboe", ! "English Horn", ! "Bassoon", ! "Clarinet", ! "Piccolo", ! "Flute", ! "Recorder", ! "Pan Flute", ! "Bottle Blow", ! "Shakuhachi", ! "Whistle", ! "Ocarina", ! "Syn Square Wave", ! "Syn Sawtooth Wave", ! "Syn Calliope", ! "Syn Chiff", ! "Syn Charang", ! "Syn Voice", ! "Syn Fifths Sawtooth Wave", ! "Syn Brass & Lead", ! "New Age Syn Pad", ! "Warm Syn Pad", ! "Polysynth Syn Pad", ! "Choir Syn Pad", ! "Bowed Syn Pad", ! "Metal Syn Pad", ! "Halo Syn Pad", ! "Sweep Syn Pad", ! "SFX Rain", ! "SFX Soundtrack", ! "SFX Crystal", ! "SFX Atmosphere", ! "SFX Brightness", ! "SFX Goblins", ! "SFX Echoes", ! "SFX Sci-fi", ! "Sitar", ! "Banjo", ! "Shamisen", ! "Koto", ! "Kalimba", ! "Bag Pipe", ! "Fiddle", ! "Shanai", ! "Tinkle Bell", ! "Agogo", ! "Steel Drums", ! "Woodblock", ! "Taiko Drum", ! "Melodic Tom", ! "Syn Drum", ! "Reverse Cymbal", ! "Guitar Fret Noise", ! "Breath Noise", ! "Seashore", ! "Bird Tweet", ! "Telephone Ring", ! "Helicopter", ! "Applause", ! "Gun Shot" ! ] ! Styles = { ! # "Ohno" => { ! # # http://home.hiroshima-u.ac.jp/cato/bunkakoryuron.html ! # }, ! "Ichinose" => { ! :tempo => 120, ! :scale => [0, 2, 4, 5, 7, 9, 11], ! :tones => [ ! {:prog => 9, :base => 60, :range => 2}, ! {:prog => 13, :base => 48, :range => 2}, ! {:prog => 41, :base => 48, :range => 2}, ! {:prog => 44, :base => 36, :range => 2}, ! ] ! }, ! "Okinawan" => { ! :tempo => 180, ! :scale => [0,4,5,7,11], ! :tones => [ ! {:prog => MidiProg.index("Harpsichord"), :base => 60, :range => 2}, ! {:prog => MidiProg.index("Dulcimer"), :base => 48, :range => 2}, ! {:prog => MidiProg.index("Fretless Base"), :base => 36, :range => 1}, ] + }, + "Major" => { + :scale => [0,2,4,5,7,9,11], + }, + "Minor" => { + :scale => [0,2,3,5,7,9,10], + }, + "Harmonic minor" => { + :scale => [0,2,3,5,7,9,11], + }, + "Whole tone" => { + :scale => [0,2,4,6,8,10], + }, + "Half tone" => { + :scale => [0,1,2,3,4,5,6,7,8,9,10,11], + }, + "Indian" => { + :scale => [0,1,4,5,7,8,11], + }, + "Arabic" => { + :scale => [0,2,3,6,7,8,11], + }, + "Spanish" => { + :scale => [0,1,3,4,5,7,8,10], + }, + "Japanese" => { + :scale => [0,2,5,7,9], + }, + } ! def initialize(channel = 0, program = nil, base = nil, range = nil, scale = nil) ! @channel = channel & 0xff ! @program = program || 0 ! @base = base || 60 ! @range = range || 2 ! @scale = scale || [0, 2, 4, 5, 7, 9, 11] ! @tunes = [] ! @tune = 0 ! @code = [] ! @time = 0 ! ! @range.times do |i| ! @scale.each do |c| ! @tunes.push c + i * 12 end end ! @ttype = { ! 'aa' => 1, 'at' => 0, 'ac' => 3, 'ag' => -1, ! 'ta' => 0, 'tt' => -1, 'tc' => 1, 'tg' => -2, ! 'ca' => 2, 'ct' => 1, 'cc' => 2, 'cg' => 6, ! 'ga' => -1, 'gt' => -3, 'gc' => 0, 'gg' => -2, ! } ! @dtype = [ ! { 'aa' => 2, 'at' => 4, 'ac' => 4, 'ag' => 2, ! 'ta' => 2, 'tt' => 4, 'tc' => 4, 'tg' => 2, ! 'ca' => 2, 'ct' => 3, 'cc' => 1, 'cg' => 2, ! 'ga' => 1, 'gt' => 2, 'gc' => 2, 'gg' => 3, ! }, ! { 'aa' => 3, 'at' => 3, 'ac' => 2, 'ag' => 3, ! 'ta' => 3, 'tt' => 3, 'tc' => 2, 'tg' => 2, ! 'ca' => 3, 'ct' => 2, 'cc' => 1, 'cg' => 1, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, ! }, ! { 'aa' => 2, 'at' => 2, 'ac' => 2, 'ag' => 2, ! 'ta' => 1, 'tt' => 1, 'tc' => 2, 'tg' => 2, ! 'ca' => 2, 'ct' => 2, 'cc' => 2, 'cg' => 3, ! 'ga' => 2, 'gt' => 2, 'gc' => 3, 'gg' => 1, ! }, ! { 'aa' => 1, 'at' => 1, 'ac' => 1, 'ag' => 1, ! 'ta' => 1, 'tt' => 1, 'tc' => 1, 'tg' => 1, ! 'ca' => 1, 'ct' => 1, 'cc' => 1, 'cg' => 3, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, ! }, ! ] ! ! @code.concat [0x00, 0xc0 | (@channel & 0xff)] ! @code.concat icode(@program & 0xff, 1) ! end ! ! def icode(num, n) ! code = [] ! n.times do |i| ! code.push num & 0xff ! num >>= 8 end + code.reverse + end ! def rcode(num) ! code = [] ! code.push num & 0x7f ! while num > 0x7f ! num >>= 7 ! code.push num & 0x7f | 0x80 end + code.reverse + end ! def c2s(code) ! ans = "" ! code.each do |c| ! ans += c.chr end + ans + end ! def push(s) ! tt = @time % 4 ! t = @ttype[s[0, 2]] ! d = @dtype[tt][s[2, 2]] ! if !t.nil? && !d.nil? ! @tune += t ! @tune %= @tunes.length ! if tt == 0 ! vel = 90 ! elsif tt == 1 && d > 1 ! vel = 100 ! elsif tt == 2 ! vel = 60 ! else ! vel = 50 ! end @code.concat rcode(1) ! @code.concat [0x90 | @channel, @tunes[@tune] + @base, vel] @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, @tunes[@tune] + @base, 0] ! @time += d end + end ! def push_silent(d) ! @code.concat rcode(1) ! @code.concat [0x90 | @channel, 0, 0] ! @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, 0, 0] ! @time += d; ! end ! def encode ! ans ="MTrk" ! ans += c2s(icode(@code.length + 4, 4)) ! ans += c2s(@code) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end ! def header(num, tempo = 120) ! ans = "MThd" ! ans += c2s(icode(6, 4)) ! ans += c2s(icode(1, 2)) ! ans += c2s(icode(num + 1, 2)) ! ans += c2s(icode(480, 2)) ! ans += "MTrk" ! ans += c2s(icode(11, 4)) ! ans += c2s([0x00, 0xff, 0x51, 0x03]) ! ans += c2s(icode(60000000 / tempo, 3)) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end ! end # MidiTrack + class Bio::Sequence::NA ! # style: ! # Hash of :tempo, :scale, :tones # scale: # C C# D D# E F F# G G# A A# B # 0 1 2 3 4 5 6 7 8 9 10 11 ! # tones: ! # Hash of :prog, :base, :range -- tone, vol? or len?, octaves ! # drum: ! # true (with rhythm part), false (without rhythm part) ! def to_midi(style = {}, drum = true) ! default = MidiTrack::Styles["Ichinose"] ! if style.is_a?(String) ! style = MidiTrack::Styles[style] || default ! end ! tempo = style[:tempo] || default[:tempo] ! scale = style[:scale] || default[:scale] ! tones = style[:tones] || default[:tones] track = [] ! tones.each_with_index do |tone, i| ! ch = i ! ch += 1 if i >= 9 # skip rythm track ! track.push MidiTrack.new(ch, tone[:prog], tone[:base], tone[:range], scale) end *************** *** 209,212 **** --- 411,416 ---- module Bio::Shell + private + def midi(seq, filename, *args) begin *************** *** 225,236 **** if $0 == __FILE__ include Bio::Shell seq_file = ARGV.shift mid_file = ARGV.shift ! ff = Bio::FlatFile.auto(seq_file) ! ff.each do |f| ! midi(f.naseq[1..1000], save_file) end end --- 429,448 ---- if $0 == __FILE__ + + # % for i in file* + # do + # ruby -r bio bio/shell/plugin/midi.rb $i ${i}.mid + # done + include Bio::Shell seq_file = ARGV.shift mid_file = ARGV.shift + style = ARGV.shift ! Bio::FlatFile.auto(seq_file) do |ff| ! ff.each do |f| ! midi(f.naseq[0..1000], mid_file, style) ! end end end From k at pub.open-bio.org Sat Nov 5 04:06:52 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 04:04:22 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin obda.rb,1.1,1.2 Message-ID: <200511050906.jA596qVL030514@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv30510/lib/bio/shell/plugin Modified Files: obda.rb Log Message: * converted to RDoc * changed to private method Index: obda.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** obda.rb 23 Sep 2005 13:57:08 -0000 1.1 --- obda.rb 5 Nov 2005 09:06:49 -0000 1.2 *************** *** 1,6 **** # ! # bio/shell/plugin/obda.rb - plugin for OBDA # ! # Copyright (C) 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/shell/plugin/obda.rb - plugin for OBDA # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 25,34 **** module Bio::Shell ! def bioregistry ! @obda = Bio::Registry.new end ! def getentry(dbname, entry_id) ! bioregistry unless @obda db = @obda.get_database(dbname) entry = db.get_by_id(entry_id) --- 31,44 ---- module Bio::Shell ! private ! ! def setup_obda ! unless @obda ! @obda = Bio::Registry.new ! end end ! def obda_get_entry(dbname, entry_id) ! setup_obda db = @obda.get_database(dbname) entry = db.get_by_id(entry_id) From k at pub.open-bio.org Sat Nov 5 05:19:10 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 05:16:42 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.4,1.5 Message-ID: <200511051019.jA5AJAVL031283@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv31115/lib/bio/shell/plugin Modified Files: seq.rb Log Message: * seq method is added * naseq and aaseq methods are removed (functionality migrated to seq method) * revseq and translate methods are removed (use seq.complemnet, seq.translate) * seq_report, na_report, aa_report methods are changed to seqstat method * double_helix method is renamed to doublehelix and changed to use seq method internally. * converted to RDoc * changed to private methods Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** seq.rb 28 Oct 2005 02:08:10 -0000 1.4 --- seq.rb 5 Nov 2005 10:19:07 -0000 1.5 *************** *** 1,6 **** # ! # bio/shell/plugin/seq.rb - plugin for biological sequence manipulations # ! # Copyright (C) 2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/shell/plugin/seq.rb - plugin for biological sequence manipulations # ! # Copyright:: Copyright (C) 2005 ! # Toshiaki Katayama ! # Lisence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 25,122 **** module Bio::Shell ! def naseq(str) ! Bio::Sequence::NA.new(str) ! end ! ! def aaseq(str) ! Bio::Sequence::AA.new(str) ! end ! ! def revseq(str) ! seq = Bio::Sequence::NA.new(str) ! res = seq.complement ! display res ! return res ! end ! def translate(str) ! seq = Bio::Sequence::NA.new(str) ! res = seq.translate ! display res ! return res ! end ! ! def seq_report(str) ! if File.exist?(str) ! Bio::FlatFile.open(nil, arg).each do |f| ! seq = f.seq ! if seq.class == Bio::Sequence::NA ! na_report(seq) ! else ! aa_report(seq) ! end end else ! moltype = Bio::Seq.guess(str) ! if moltype == Bio::Sequence::NA ! display na_report(str) ! elsif moltype == Bio::Sequence::AA ! display aa_report(str) ! end ! return Bio::Seq.guess(str) end - end ! def na_report(seq) ! seq = naseq(seq) unless seq === Bio::Sequence::NA ! str = "" ! str << "input sequence : #{seq}\n" ! str << "reverse complement : #{seq.complement}\n" ! str << "translation 1 : #{seq.translate}\n" ! str << "translation 2 : #{seq.translate(2)}\n" ! str << "translation 3 : #{seq.translate(3)}\n" ! str << "translation -1 : #{seq.translate(-1)}\n" ! str << "translation -2 : #{seq.translate(-2)}\n" ! str << "translation -3 : #{seq.translate(-3)}\n" ! str << "gc percent : #{seq.gc_percent} %\n" ! str << "composition : #{seq.composition.inspect}\n" ! str << "molecular weight : #{seq.molecular_weight}\n" ! str << "complemnet weight : #{seq.complement.molecular_weight}\n" ! str << "protein weight : #{seq.translate.molecular_weight}\n" ! str << "//\n" ! return str end ! def aa_report(seq) ! seq = aaseq(seq) unless seq === Bio::Sequence::AA ! str = "" ! str << "input sequence : #{seq}\n" ! str << "composition : #{seq.composition.inspect}\n" ! str << "protein weight : #{seq.molecular_weight}\n" ! str << "amino acid codes : #{seq.codes.inspect}\n" ! str << "amino acid names : #{seq.names.inspect}\n" ! str << "//\n" ! return str end ! # Reterns and displays a DNA sequence pretty printing ! # in B-type double helix. ! # Argument ``seq'' required at least 16 bases length. ! def double_helix(seq) ! str = '' ! m = [[5, 0], [4, 2], [3, 3], [2, 4], ! [1, 4], [0, 3], [0, 2], [1, 0]] ! naseq(seq).window_search(16, 16) do |subseq| ! m.each_with_index do |mij, x| base = subseq[x, 1] ! str << ' ' * mij[0] + base + '-' * mij[1] + base.complement + "\n" end ! m.reverse.each_with_index do |mij, x| base = subseq[x + 8, 1] ! str << ' ' * mij[0] + base.complement + '-' * mij[1] + base + "\n" end end ! display(str) ! return str end --- 31,132 ---- module Bio::Shell ! private ! # Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid) ! # sequence from ! # * String -- "atgcatgc" or "MQKKP" ! # * File -- "gbvrl.gbk" (only the first entry is used) ! # * ID -- "embl:BUM" (entry is retrieved by the OBDA) ! def seq(arg) ! if arg.respond_to?(:gets) or File.exists?(arg) ! entry = flatauto(arg) ! elsif arg[/:/] ! db, entry_id = arg.split(/:/) ! str = obda_get_entry(db, entry_id) ! if cls = Bio::FlatFile.autodetect(str) ! entry = cls.new(str) end else ! tmp = arg end ! if entry.respond_to?(:seq) ! tmp = entry.seq ! elsif entry.respond_to?(:naseq) ! s = entry.naseq ! elsif entry.respond_to?(:aaseq) ! s = entry.aaseq ! end ! ! if tmp and tmp.is_a?(String) and not tmp.empty? ! s = Bio::Sequence.auto(tmp) ! end ! ! return s || "" end ! # Displays some basic properties of the sequence. ! def seqstat(str) ! seq = seq(str) ! rep = "" ! if seq.respond_to?(:complement) ! rep << "Sequence : #{seq}\n" ! rep << "Reverse complement : #{seq.complement}\n" ! rep << "Translation 1 : #{seq.translate}\n" ! rep << "Translation 2 : #{seq.translate(2)}\n" ! rep << "Translation 3 : #{seq.translate(3)}\n" ! rep << "Translation -1 : #{seq.translate(-1)}\n" ! rep << "Translation -2 : #{seq.translate(-2)}\n" ! rep << "Translation -3 : #{seq.translate(-3)}\n" ! rep << "GC percent : #{seq.gc_percent} %\n" ! rep << "Composition : #{seq.composition.inspect}\n" ! begin ! rep << "Molecular weight : #{seq.molecular_weight}\n" ! rep << "Complemnet weight : #{seq.complement.molecular_weight}\n" ! rep << "Protein weight : #{seq.translate.molecular_weight}\n" ! rescue ! rep << "Molecular weight : #{$!}\n" ! end ! else ! rep << "Sequence : #{seq}\n" ! rep << "Composition : #{seq.composition.inspect}\n" ! begin ! rep << "Protein weight : #{seq.molecular_weight}\n" ! rescue ! rep << "Protein weight : #{$!}\n" ! end ! # rep << "amino acid codes : #{seq.codes.inspect}\n" ! # rep << "amino acid names : #{seq.names.inspect}\n" ! end ! rep << "//\n" ! display rep end ! # Displays a DNA sequence by ascii art in B-type double helix. ! # Argument need to be at least 16 bases in length. ! def doublehelix(str) ! seq = seq(str) ! if str.length < 16 ! display "Sequence must be longer than 16 bases." ! return ! end ! if ! seq.respond_to?(:complement) ! display "Sequence must be a DNA sequence." ! return ! end ! helix = '' ! pairs = [ [5, 0], [4, 2], [3, 3], [2, 4], ! [1, 4], [0, 3], [0, 2], [1, 0] ] ! seq.window_search(16, 16) do |subseq| ! pairs.each_with_index do |ij, x| base = subseq[x, 1] ! helix << ' ' * ij[0] + base + '-' * ij[1] + base.complement + "\n" end ! pairs.reverse.each_with_index do |ij, x| base = subseq[x + 8, 1] ! helix << ' ' * ij[0] + base.complement + '-' * ij[1] + base + "\n" end end ! display helix end From k at pub.open-bio.org Sat Nov 5 05:20:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 05:18:25 2005 Subject: [BioRuby-cvs] bioruby ChangeLog,1.42,1.43 Message-ID: <200511051020.jA5AKuVL031407@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv31387 Modified Files: ChangeLog Log Message: * added changes on Bio::Sequence and BioRuby shell plugins Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ChangeLog 4 Nov 2005 17:30:35 -0000 1.42 --- ChangeLog 5 Nov 2005 10:20:54 -0000 1.43 *************** *** 1,2 **** --- 1,27 ---- + 2005-11-05 Toshiaki Katayama + + * lib/bio/sequence.rb + + Bio::Sequence.auto(str) method is added which auto detect the + molecular type of the string and then returns the + Bio::Sequence::NA or Bio::Sequence::AA object. + + Bio::Sequence#blast and Bio::Sequence#fasta methods are removed. + + * lib/bio/shell/plugin/codon.rb + + Newly added plugin to treat codon table. + ColoredCodonTable is ported from the codontable.rb + + 2005-11-01 Toshiaki Katayama + + * bin/bioruby, lib/bio/shell/ + + All methods are changed to private methods to avoid adding them + in top level binding, which caused many unexpected behaviors, + as adviced by Koichi Sasada. + + The MIDI plugin is now able to select musical scales. + 2005-10-23 Toshiaki Katayama From k at pub.open-bio.org Sat Nov 5 05:21:49 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 05:19:18 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.3,1.4 Message-ID: <200511051021.jA5ALnVL031481@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv31463/doc Modified Files: Changes-0.7.rd Log Message: * added notification of removal of Bio::Sequence#blast and fasta methods Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Changes-0.7.rd 4 Nov 2005 17:33:29 -0000 1.3 --- Changes-0.7.rd 5 Nov 2005 10:21:47 -0000 1.4 *************** *** 53,57 **** * Bio::Sequence::NA#gc (was aliased to gc_percent) is removed ! In BioRuby, GC% is rounded to one decimal place. However, how many digits should be left when rounding the value is not clear and as the GC% is an rough measure by its nature, we have changed to return integer part only. --- 53,57 ---- * Bio::Sequence::NA#gc (was aliased to gc_percent) is removed ! Previously, GC% is rounded to one decimal place. However, how many digits should be left when rounding the value is not clear and as the GC% is an rough measure by its nature, we have changed to return integer part only. *************** *** 59,64 **** 'composition' method by your own criteria. ! The 'gc' method is removed as the method name doesn't represent its value ! is ambiguous. --- Bio::KEGG::Microarrays, Bio::KEGG::Microarray --- 59,70 ---- 'composition' method by your own criteria. ! Also, the 'gc' method is removed as the method name doesn't represent ! its value is ambiguous. ! ! * Bio::Sequence#blast ! * Bio::Sequence#fasta ! ! These two methods are removed. Use Bio::Blast and Bio::Fasta to execute ! BLAST and FASTA search. --- Bio::KEGG::Microarrays, Bio::KEGG::Microarray From k at pub.open-bio.org Sat Nov 5 05:58:03 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 05:55:35 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin keggapi.rb,NONE,1.1 Message-ID: <200511051058.jA5Aw3VL000350@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv329/lib/bio/shell/plugin Added Files: keggapi.rb Log Message: * start --- NEW FILE: keggapi.rb --- # # = bio/shell/plugin/obda.rb - plugin for OBDA # # Copyright:: Copyright (C) 2005 # Toshiaki Katayama # Lisence:: LGPL # # $Id: keggapi.rb,v 1.1 2005/11/05 10:58:01 k Exp $ # #-- # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #++ # require 'bio/io/soapwsdl' module Bio::Shell private def setup_keggapi unless @keggapi @keggapi = Bio::SOAPWSDL.new("http://soap.genome.jp/KEGG.wsdl") end end def bfind(str) setup_keggapi result = @keggapi.bfind(str) display result return result end def bget(str) setup_keggapi entry = @keggapi.bget(str) if block_given? yield entry else display entry end return entry end end =begin --- list_databases --- list_organisms --- list_pathways(org) --- binfo(string) --- bfind(string) --- bget(string) --- btit(string) --- get_linkdb_by_entry(entry_id, db, start, max_results) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) --- get_best_neighbors_by_gene(genes_id, start, max_results) --- get_reverse_best_neighbors_by_gene(genes_id, start, max_results) --- get_paralogs_by_gene(genes_id, start, max_results) --- get_motifs_by_gene(genes_id, db) --- get_genes_by_motifs(motif_id_list, start, max_results) --- get_ko_by_gene(genes_id) --- get_ko_by_ko_class(ko_class_id) --- get_genes_by_ko_class(ko_class_id, org, start, max_results) --- get_genes_by_ko(ko_id, org) --- get_oc_members_by_gene(genes_id, start, max_results) --- get_pc_members_by_gene(genes_id, start, max_results) --- mark_pathway_by_objects(pathway_id, object_id_list) --- color_pathway_by_objects(pathway_id, object_id_list, fg_color_list, bg_color_list) --- get_html_of_marked_pathway_by_objects(pathway_id, object_id_list) --- get_html_of_colored_pathway_by_objects(pathway_id, object_id_list, fg_color_list, bg_color_list) --- get_genes_by_pathway(pathway_id) --- get_enzymes_by_pathway(pathway_id) --- get_compounds_by_pathway(pathway_id) --- get_glycans_by_pathway(pathway_id) --- get_reactions_by_pathway(pathway_id) --- get_kos_by_pathway(pathway_id) --- get_pathways_by_genes(genes_id_list) --- get_pathways_by_enzymes(enzyme_id_list) --- get_pathways_by_compounds(compound_id_list) --- get_pathways_by_glycans(glycan_id_list) --- get_pathways_by_reactions(reaction_id_list) --- get_pathways_by_kos(ko_id_list, org) --- get_linked_pathways(pathway_id) --- get_genes_by_enzyme(enzyme_id, org) --- get_enzymes_by_gene(genes_id) --- get_enzymes_by_compound(compound_id) --- get_enzymes_by_glycan(glycan_id) --- get_enzymes_by_reaction(reaction_id) --- get_compounds_by_enzyme(enzyme_id) --- get_compounds_by_reaction(reaction_id) --- get_glycans_by_enzyme(enzyme_id) --- get_glycans_by_reaction(reaction_id) --- get_reactions_by_enzyme(enzyme_id) --- get_reactions_by_compound(compound_id) --- get_reactions_by_glycan(glycan_id) --- get_genes_by_organism(org, start, max_results) --- get_number_of_genes_by_organism(org) --- convert_mol_to_kcf(mol_text) =end From k at pub.open-bio.org Sat Nov 5 06:54:38 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 06:52:15 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.1,1.2 Message-ID: <200511051154.jA5BscVL000824@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv820/lib/bio/shell/plugin Modified Files: codon.rb Log Message: * nucleicacids, aminoacids methods are added Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** codon.rb 5 Nov 2005 08:24:24 -0000 1.1 --- codon.rb 5 Nov 2005 11:54:35 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- require 'bio/data/codontable' require 'bio/data/aa' + require 'bio/data/na' module Bio::Shell *************** *** 165,167 **** --- 166,203 ---- end + def aminoacids + names = Bio::AminoAcid.names + names.sort.each do |aa, code| + if aa.length == 1 + puts "#{aa}\t#{code}\t#{names[code]}" + end + end + return names + end + + def nucleicacids + [ + [ 'A', 'Adenine' ], + [ 'T', 'Thymine' ], + [ 'G', 'Guanine' ], + [ 'C', 'Cytosine' ], + [ 'U', 'Uracil' ], + [ 'r', '[ag]', 'puRine' ], + [ 'y', '[tc]', 'pYrimidine' ], + [ 'w', '[at]', 'Weak' ], + [ 's', '[gc]', 'Strong' ], + [ 'k', '[tg]', 'Keto' ], + [ 'm', '[ac]', 'aMino' ], + [ 'b', '[tgc]', 'not A' ], + [ 'v', '[agc]', 'not T' ], + [ 'h', '[atc]', 'not G' ], + [ 'd', '[atg]', 'not C' ], + [ 'n', '[atgc]', 'any' ], + ].each do |list| + puts list.join("\t") + end + return Bio::NucleicAcid.names + end + end + From k at pub.open-bio.org Sat Nov 5 20:28:46 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 20:26:14 2005 Subject: [BioRuby-cvs] bioruby/bin bioruby,1.4,1.5 Message-ID: <200511060128.jA61SkVL002618@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/bin In directory pub.open-bio.org:/tmp/cvs-serv2614/bin Modified Files: bioruby Log Message: * changed :no_readline to :READLNE Index: bioruby =================================================================== RCS file: /home/repository/bioruby/bioruby/bin/bioruby,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bioruby 5 Nov 2005 08:33:53 -0000 1.4 --- bioruby 6 Nov 2005 01:28:44 -0000 1.5 *************** *** 48,53 **** begin require 'irb/completion' rescue LoadError ! $bioruby_cache[:no_readline] = true end --- 48,54 ---- begin require 'irb/completion' + $bioruby_cache[:READLINE] = true rescue LoadError ! $bioruby_cache[:READLINE] = false end *************** *** 104,105 **** --- 105,107 ---- # saving workspace, command history and configuration before exit Bio::Shell.close + From k at pub.open-bio.org Sat Nov 5 20:29:29 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 20:26:54 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.5,1.6 Message-ID: <200511060129.jA61TTVL002666@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv2662/lib/bio Modified Files: shell.rb Log Message: * cleanup Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** shell.rb 5 Nov 2005 08:24:23 -0000 1.5 --- shell.rb 6 Nov 2005 01:29:27 -0000 1.6 *************** *** 31,35 **** --- 31,38 ---- require 'pp' + # A hash to store persistent configurations $bioruby_config = {} + + # A hash to store temporal (per session) configurations $bioruby_cache = {} *************** *** 38,42 **** require 'bio/shell/core' require 'bio/shell/session' - #require 'bio/shell/help' require 'bio/shell/plugin/seq' require 'bio/shell/plugin/midi' --- 41,44 ---- *************** *** 45,50 **** require 'bio/shell/plugin/obda' require 'bio/shell/plugin/keggapi' - #require 'bio/shell/plugin/das' - #require 'bio/shell/plugin/demo' extend Core --- 47,50 ---- From k at pub.open-bio.org Sat Nov 5 20:36:14 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 20:33:39 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.4,1.5 Message-ID: <200511060136.jA61aEVL002742@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv2738/lib/bio/shell Modified Files: core.rb Log Message: * changed to ask save directory * confirm whether readline is available * script is now able to be used as a toggle Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** core.rb 5 Nov 2005 08:33:53 -0000 1.4 --- core.rb 6 Nov 2005 01:36:11 -0000 1.5 *************** *** 64,68 **** --- 64,70 ---- end + #-- # *TODO* is this needed? (for reset) + #++ def reload load_config *************** *** 84,88 **** --- 86,94 ---- end + #-- # *TODO* This works, but sometimes causes terminal collapse + # how about to suppress loading messages? + # or try to load @keggapi and @obda during this? + #++ def opening_thread begin *************** *** 111,118 **** end ! def create_save_dir(dir = SAVEDIR) create_real_dir(dir) create_real_dir(dir + PLUGIN) create_real_dir(dir + BIOFLAT) end --- 117,146 ---- end ! def create_save_dir ! dir = ask_save_dir create_real_dir(dir) create_real_dir(dir + PLUGIN) create_real_dir(dir + BIOFLAT) + return dir + end + + # 1. ask to save in SAVEDIR directory in the current directory + # 2. otherwise save in USERDIR directory + # 3. remember the choice in $bioruby_cache[:SAVEDIR] once per session + def ask_save_dir + if $bioruby_cache[:SAVEDIR] + dir = $bioruby_cache[:SAVEDIR] + else + dir = SAVEDIR + if ! File.directory?(dir) + print "Save in \"#{dir}\" directory? [y/n]: " + answer = gets + if /^\s*n/.match(answer.downcase) + dir = USERDIR + end + end + $bioruby_cache[:SAVEDIR] = dir + end + return dir end *************** *** 148,153 **** def save_config ! create_save_dir ! file = SAVEDIR + CONFIG begin print "Saving config (#{file}) ... " --- 176,184 ---- def save_config ! dir = create_save_dir ! save_config_file(dir + CONFIG) ! end ! ! def save_config_file(file) begin print "Saving config (#{file}) ... " *************** *** 233,236 **** --- 264,269 ---- def load_object + load_object_file(SITEDIR + OBJECT) + load_object_file(USERDIR + OBJECT) load_object_file(SAVEDIR + OBJECT) end *************** *** 258,263 **** def save_object ! create_save_dir ! save_object_file(SAVEDIR + OBJECT) end --- 291,296 ---- def save_object ! dir = create_save_dir ! save_object_file(dir + OBJECT) end *************** *** 292,296 **** def load_history ! load_history_file(SAVEDIR + HISTORY) unless $bioruby_cache[:no_readline] end --- 325,333 ---- def load_history ! if $bioruby_cache[:READLINE] ! load_history_file(SITEDIR + HISTORY) ! load_history_file(USERDIR + HISTORY) ! load_history_file(SAVEDIR + HISTORY) ! end end *************** *** 306,311 **** def save_history ! create_save_dir ! save_history_file(SAVEDIR + HISTORY) unless $bioruby_cache[:no_readline] end --- 343,350 ---- def save_history ! if $bioruby_cache[:READLINE] ! dir = create_save_dir ! save_history_file(dir + HISTORY) ! end end *************** *** 324,334 **** ### script ! def script(mode) case mode when :begin, "begin", :start, "start" script_begin when :end, "end", :stop, "stop" script_end ! script_save end end --- 363,384 ---- ### script ! def script(mode = nil) case mode when :begin, "begin", :start, "start" + $bioruby_cache[:SCRIPT] = true script_begin when :end, "end", :stop, "stop" + $bioruby_cache[:SCRIPT] = false script_end ! save_script ! else ! if $bioruby_cache[:SCRIPT] ! $bioruby_cache[:SCRIPT] = false ! script_end ! save_script ! else ! $bioruby_cache[:SCRIPT] = true ! script_begin ! end end end *************** *** 344,357 **** end ! def script_save ! create_save_dir if @script_begin and @script_end and @script_begin <= @script_end ! script_save_file(SAVEDIR + SCRIPT) else ! raise "Script range '#{@script_begin}' .. '#{@script_end}' is invalid" end end ! def script_save_file(file) begin print "Saving script (#{file}) ... " --- 394,407 ---- end ! def save_script if @script_begin and @script_end and @script_begin <= @script_end ! dir = create_save_dir ! save_script_file(dir + SCRIPT) else ! puts "Error: script range #{@script_begin}..#{@script_end} is invalid" end end ! def save_script_file(file) begin print "Saving script (#{file}) ... " From k at pub.open-bio.org Sat Nov 5 20:37:02 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 20:34:28 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell session.rb,1.2,1.3 Message-ID: <200511060137.jA61b2VL002811@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv2807/lib/bio/shell Modified Files: session.rb Log Message: * script is now able to be used as toggle Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** session.rb 5 Nov 2005 08:34:49 -0000 1.2 --- session.rb 6 Nov 2005 01:37:00 -0000 1.3 *************** *** 49,53 **** ### script ! def script(mode = :begin) Bio::Shell.script(mode) end --- 49,53 ---- ### script ! def script(mode = nil) Bio::Shell.script(mode) end *************** *** 61,67 **** ### pager ! # # mysql> pager less ! # def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html --- 61,67 ---- ### pager ! #-- # mysql> pager less ! #++ def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html From k at pub.open-bio.org Sat Nov 5 21:12:05 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 21:09:33 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin keggapi.rb,1.1,1.2 Message-ID: <200511060212.jA62C5VL002961@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv2957/lib/bio/shell/plugin Modified Files: keggapi.rb Log Message: * changed to use Bio::KEGG::API Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** keggapi.rb 5 Nov 2005 10:58:01 -0000 1.1 --- keggapi.rb 6 Nov 2005 02:12:03 -0000 1.2 *************** *** 1,4 **** # ! # = bio/shell/plugin/obda.rb - plugin for OBDA # # Copyright:: Copyright (C) 2005 --- 1,4 ---- # ! # = bio/shell/plugin/keggapi.rb - plugin for KEGG API # # Copyright:: Copyright (C) 2005 *************** *** 27,31 **** # ! require 'bio/io/soapwsdl' module Bio::Shell --- 27,31 ---- # ! require 'bio/io/keggapi' module Bio::Shell *************** *** 35,39 **** def setup_keggapi unless @keggapi ! @keggapi = Bio::SOAPWSDL.new("http://soap.genome.jp/KEGG.wsdl") end end --- 35,39 ---- def setup_keggapi unless @keggapi ! @keggapi = Bio::KEGG::API.new end end From k at pub.open-bio.org Sat Nov 5 22:03:10 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sat Nov 5 22:00:36 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.5,1.6 Message-ID: <200511060303.jA633AVL003078@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv3067/lib/bio/shell/plugin Modified Files: seq.rb Log Message: * minor update Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** seq.rb 5 Nov 2005 10:19:07 -0000 1.5 --- seq.rb 6 Nov 2005 03:03:08 -0000 1.6 *************** *** 89,101 **** end else ! rep << "Sequence : #{seq}\n" ! rep << "Composition : #{seq.composition.inspect}\n" begin ! rep << "Protein weight : #{seq.molecular_weight}\n" rescue ! rep << "Protein weight : #{$!}\n" end ! # rep << "amino acid codes : #{seq.codes.inspect}\n" ! # rep << "amino acid names : #{seq.names.inspect}\n" end rep << "//\n" --- 89,101 ---- end else ! rep << "Sequence : #{seq}\n" ! rep << "Composition : #{seq.composition.inspect}\n" begin ! rep << "Protein weight : #{seq.molecular_weight}\n" rescue ! rep << "Protein weight : #{$!}\n" end ! # rep << "amino acid codes : #{seq.codes.inspect}\n" ! # rep << "amino acid names : #{seq.names.inspect}\n" end rep << "//\n" From nakao at pub.open-bio.org Sun Nov 6 11:10:10 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Nov 6 11:07:36 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/tmhmm report.rb,1.4,1.5 Message-ID: <200511061610.jA6GAAVL013528@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm In directory pub.open-bio.org:/tmp/cvs-serv13513/lib/bio/appl/tmhmm Modified Files: report.rb Log Message: * Converted to RDoc. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm/report.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** report.rb 26 Sep 2005 13:00:06 -0000 1.4 --- report.rb 6 Nov 2005 16:10:07 -0000 1.5 *************** *** 1,6 **** # ! # bio/appl/tmhmm/report.rb - TMHMM report class # ! # Copyright (C) 2003 Mitsuteru C. Nakao # # This library is free software; you can redistribute it and/or --- 1,16 ---- # ! # = bio/appl/tmhmm/report.rb - TMHMM report class # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # ! # == Example ! # == References ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,28 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # module Bio class TMHMM def TMHMM.reports(data) entry = [] --- 28,40 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # module Bio + # = TMHMM class for http://www.cbs.dtu.dk/services/TMHMM/ class TMHMM + # Splits multiple reports into a report entry. def TMHMM.reports(data) entry = [] *************** *** 58,76 **** end ! class Report def initialize(entry = nil) parse_header(entry) @tmhs = parse_tmhs(entry) end - attr_reader :tmhs, :entry_id, :query_len, :predicted_tmhs, - :exp_aas_in_tmhs, :exp_first_60aa, :total_prob_of_N_in - alias length query_len def helix @tmhs.map {|t| t if t.status == 'TMhelix' }.compact end def to_s [ --- 70,111 ---- end ! # = TMHMM report parser class. class Report + # Returns an Array of Bio::TMHMM::TMH. + attr_reader :tmhs + + # Returns + attr_reader :entry_id + + # Returns + attr_reader :query_len + + # Returns + attr_reader :predicted_tmhs + + # Returns + attr_reader :exp_aas_in_tmhs + + # Returns + attr_reader :exp_first_60aa + + # Returns + attr_reader :total_prob_of_N_in + + alias length query_len + + # def initialize(entry = nil) parse_header(entry) @tmhs = parse_tmhs(entry) end + # Returns an Array of Bio::TMHMM::TMH including only "TMhelix". def helix @tmhs.map {|t| t if t.status == 'TMhelix' }.compact end + # def to_s [ *************** *** 89,92 **** --- 124,128 ---- private + # def parse_header(raw) raw.each do |line| *************** *** 109,112 **** --- 145,149 ---- end + # def parse_tmhs(raw) tmhs = [] *************** *** 127,132 **** --- 164,186 ---- + # = Container class of the trainsmembrane helix(TMH) and the other + # segments. class TMH + # Returns + attr_accessor :entry_id + + # Returns + attr_accessor :version + + # Returns the status of the TMH. ("outside", "TMhelix" or "inside"). + attr_accessor :status + + # Returns an Range of TMH position. + attr_accessor :range + + alias pos range + + # def initialize(entry_id = nil, version = nil, status = nil, range = nil) @entry_id = entry_id *************** *** 135,141 **** @range = range end - attr_accessor :entry_id, :version, :status, :range - alias pos range def to_s [@entry_id, @version, @status, @range.first, @range.last].join("\t") --- 189,194 ---- @range = range end + # def to_s [@entry_id, @version, @status, @range.first, @range.last].join("\t") *************** *** 161,164 **** --- 214,218 ---- puts ent.to_s pp ent + p [:entry_id, ent.entry_id] p [:query_len, ent.query_len] *************** *** 183,241 **** end - - - =begin - - = Bio::TMHMM - - TMHMM class for (()) - - --- Bio::TMHMM.reports(str) - - Splits multiple reports into a report entry. - - - = Bio::TMHMM::Report - - TMHMM report parser class. - - --- Bio::TMHMM::Report.new(str) - - --- Bio::TMHMM::Report#entry_id - --- Bio::TMHMM::Report#query_len - --- Bio::TMHMM::Report#predicted_tmhs - --- Bio::TMHMM::Report#exp_aas_in_tmhs - --- Bio::TMHMM::Report#exp_first_60aa - --- Bio::TMHMM::Report#total_prob_of_N_in - - - --- Bio::TMHMM::Report#tmhs - - Retruns an Array of Bio::TMHMM::TMH. - - --- Bio::TMHMM::Report#helix - - Returns an Array of Bio::TMHMM::TMH including only "TMhelix". - - = Bio::TMHMM::TMH - - Container class of the trainsmembrane helix(TMH) and the other - segments. - - --- Bio::TMHMM::TMH.new(entry_id, version, status, first_pos, last_pos) - - --- Bio::TMHMM::TMH#entry_id - --- Bio::TMHMM::TMH#version - --- Bio::TMHMM::TMH#status - - Returns the status of the TMH. ("outside", "TMhelix" or "inside"). - - --- Bio::TMHMM::TMH#range - - Returns an Range of TMH position. - - --- Bio::TMHMM::TMH#pos - - Alias to Bio::TMHMM:TMH#range - - =end --- 237,238 ---- From nakao at pub.open-bio.org Sun Nov 6 13:24:43 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sun Nov 6 13:22:06 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/genscan report.rb,1.6,1.7 Message-ID: <200511061824.jA6IOhVL014400@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/genscan In directory pub.open-bio.org:/tmp/cvs-serv14390/lib/bio/appl/genscan Modified Files: report.rb Log Message: * Converted to RDoc. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/genscan/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 1 Nov 2005 05:15:15 -0000 1.6 --- report.rb 6 Nov 2005 18:24:41 -0000 1.7 *************** *** 1,6 **** # ! # bio/appl/genscan/report.rb - Genscan report classes # ! # Copyright (C) 2003 Mitsuteru C. Nakao # # This library is free software; you can redistribute it and/or --- 1,17 ---- # ! # = bio/appl/genscan/report.rb - Genscan report classes # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # ! # == Example ! # == References ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 20,23 **** --- 31,36 ---- # $Id$ # + #++ + # require 'bio/db/fasta' *************** *** 26,45 **** module Bio ! # Bio::Genscan class Genscan ! # Bio::Genscan::Report - Class for Genscan report output. class Report attr_reader :genscan_version attr_reader :date_run attr_reader :time attr_reader :query_name alias_method :sequence_name, :query_name alias_method :name, :query_name attr_reader :length attr_reader :gccontent attr_reader :isochore attr_reader :matrix attr_reader :predictions alias_method :prediction, :predictions --- 39,78 ---- module Bio ! # = Bio::Genscan class Genscan ! # = Bio::Genscan::Report - Class for Genscan report output. ! # ! # Parser for the Genscan report output. ! # * Genscan http://genes.mit.edu/GENSCAN.html class Report + # Returns Genscan version. attr_reader :genscan_version + + # Returns attr_reader :date_run + + # Returns attr_reader :time + + # Returns Name of query sequence. attr_reader :query_name alias_method :sequence_name, :query_name alias_method :name, :query_name + + # Returns Length of the query sequence. attr_reader :length + + # Returns C+G content of the query sequence. attr_reader :gccontent + + # Returns attr_reader :isochore + + # Returns attr_reader :matrix + + # Returns Array of Bio::Genscan::Report::Gene. attr_reader :predictions alias_method :prediction, :predictions *************** *** 177,181 **** ! # Bio::Genescan::Report::Gene class Gene --- 210,214 ---- ! # = Container class of predicted gene structures. class Gene *************** *** 189,197 **** --- 222,242 ---- @polyA = nil end + + # Returns "Gn", gene number field. attr_reader :number + + # Returns Bio::FastaFormat object. attr_reader :aaseq + + # Returns Bio::FastaFormat object. attr_reader :naseq + + # Returns Array of Bio::Genscan::Report::Exon. attr_reader :exons + + # Returns Bio::Genscan::Report::Exon object. attr_reader :promoter + + # Returns Bio::Genscan::Report::Exon object. attr_reader :polyA *************** *** 223,229 **** ! # Bio::Genescan::Report::Exon class Exon # Bio::Genescan::Report::Exon.parser def self.parser(line) --- 268,285 ---- ! # = Container class of a predicted gene structure. class Exon + # + TYPES = { + 'Init' => 'Initial exon', + 'Intr' => 'Internal exon', + 'Term' => 'Terminal exon', + 'Sngl' => 'Single-exon gene', + 'Prom' => 'Promoter', + 'PlyA' => 'poly-A signal' + } + + # Bio::Genescan::Report::Exon.parser def self.parser(line) *************** *** 239,253 **** end - - TYPES = { - 'Init' => 'Initial exon', - 'Intr' => 'Internal exon', - 'Term' => 'Terminal exon', - 'Sngl' => 'Single-exon gene', - 'Prom' => 'Promoter', - 'PlyA' => 'poly-A signal' - } # Bio::Genescan::Report::Exon.new(gene_number, exon_type, strand, first, # end, length, frame, phase, acceptor_score, donor_score, score, p_value, --- 295,334 ---- end + # Returns + attr_reader :gene_number + + # Returns "Ex", exon number field + attr_reader :number + + # Returns "Type" field. + attr_reader :exon_type + + # Returns "S" field. + attr_reader :strand + + # Returns Returns first position of the region. "Begin" field. + attr_reader :first + + # Returns Returns last position of the region. "End" field. + attr_reader :last + + # Returns "Fr" field. + attr_reader :frame + + # Returns "Ph" field. + attr_reader :phase + + # Returns "CodRg" field. + attr_reader :score + # Returns "P" field. + attr_reader :p_value + + # Returns "Tscr" field. + attr_reader :t_score + alias_method :coding_region_score, :score + + # Bio::Genescan::Report::Exon.new(gene_number, exon_type, strand, first, # end, length, frame, phase, acceptor_score, donor_score, score, p_value, *************** *** 268,286 **** @t_score = ts.to_f end ! attr_reader :gene_number ! attr_reader :number ! attr_reader :exon_type ! attr_reader :strand ! attr_reader :first ! attr_reader :last ! attr_reader :frame ! attr_reader :phase ! attr_reader :score ! attr_reader :p_value ! attr_reader :t_score ! alias_method :coding_region_score, :score # Bio::Genescan::Report::Exon#exon_type_long def exon_type_long TYPES[exon_type] --- 349,358 ---- @t_score = ts.to_f end ! # Bio::Genescan::Report::Exon#exon_type_long + # + # Returns a human-readable "Type" of exon. def exon_type_long TYPES[exon_type] *************** *** 289,292 **** --- 361,366 ---- # Bio::Genescan::Report::Exon#range + # + # Returns Range object of the region. def range Range.new(@first, @last) *************** *** 295,298 **** --- 369,374 ---- # Bio::Genescan::Report::Exon#acceptor_score + # + # "I/Ac" field. def acceptor_score @i_ac *************** *** 302,305 **** --- 378,383 ---- # Bio::Genescan::Report::Exon#donor_score + # + # "Do/T" field. def donor_score @do_t *************** *** 421,556 **** =begin - - = Bio::Genscan::Report - - Parser for the Genscan report output. - * ((Genscan|URL:http://genes.mit.edu/GENSCAN.html) - - - --- Bio::Genscan::Report.new(report) - - Parse a Genscan report output. - - --- Bio::Genscan::Report#genscan_version - - Genscan version. - - --- Bio::Genscan::Report#date_run - --- Bio::Genscan::Report#time - --- Bio::Genscan::Report#query_name - - Name of query sequence. - - --- Bio::Genscan::Report#length - - Length of the query sequence. - - --- Bio::Genscan::Report#gccontent - - C+G content of the query sequence. - - --- Bio::Genscan::Report#isochore - --- Bio::Genscan::Report#predictions - - Array of Bio::Genscan::Report::Gene. - - - = Bio::Genscan::Report::Gene - - Container class of predicted gene structures. - - --- Bio::Genscan::Report::Gene#number - - "Gn", gene number field. - - --- Bio::Genscan::Report::Gene#aaseq - - Returns Bio::FastaFormat object. - - --- Bio::Genscan::Report::Gene#naseq - - Returns Bio::FastaFormat object. - - --- Bio::Genscan::Report::Gene#promoter - - Returns Bio::Genscan::Report::Exon object. - - --- Bio::Genscan::Report::Gene#polyA - - Returns Bio::Genscan::Report::Exon object. - - --- Bio::Genscan::Report::Gene#exons - - Array of Bio::Genscan::Report::Exon. - - - = Bio::Genscan::Report::Exon - - Container class of a predicted gene structure. - - --- Bio::Genscan::Report::Gene#number - - "Ex", exon number field - - --- Bio::Genscan::Report::Gene#exon_type - - "Type" field. - - --- Bio::Genscan::Report::Gene#exon_type_long - - Returns a human-readable "Type" of exon. - - --- Bio::Genscan::Report::Gene#strand - - "S" field. - - --- Bio::Genscan::Report::Gene#first - - Returns first position of the region. "Begin" field. - - --- Bio::Genscan::Report::Gene#last - - Returns last position of the region. "End" field. - - --- Bio::Genscan::Report::Gene#range - - Returns Range object of the region. - - --- Bio::Genscan::Report::Gene#frame - - "Fr" field. - - --- Bio::Genscan::Report::Gene#phase - - "Ph" field. - - --- Bio::Genscan::Report::Gene#acceptor_score - - "I/Ac" field. - - --- Bio::Genscan::Report::Gene#donor_score - - "Do/T" field. - - --- Bio::Genscan::Report::Gene#initiation_score - - "I/Ac" field. - - --- Bio::Genscan::Report::Gene#termination_score - - "Do/T" field. - - --- Bio::Genscan::Report::Gene#score - - "CodRg" field. - - --- Bio::Genscan::Report::Gene#p_value - - "P" field. - - --- Bio::Genscan::Report::Gene#t_score - - "Tscr" field. - --- 499,502 ---- From k at pub.open-bio.org Sun Nov 6 13:28:50 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 6 13:26:10 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell session.rb,1.3,1.4 Message-ID: <200511061828.jA6ISoVL014503@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv14499/lib/bio/shell Modified Files: session.rb Log Message: * ls method is changed to hide nil objects Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** session.rb 6 Nov 2005 01:37:00 -0000 1.3 --- session.rb 6 Nov 2005 18:28:48 -0000 1.4 *************** *** 34,42 **** def ls ! display eval("local_variables", conf.workspace.binding).inspect end def rm(name) # name = :hoge ! eval("#{name} = nil", conf.workspace.binding) end --- 34,49 ---- def ls ! list = eval("local_variables", conf.workspace.binding).reject { |x| ! eval(x, conf.workspace.binding).nil? ! } ! display list.inspect end def rm(name) # name = :hoge ! begin ! eval("#{name} = nil", conf.workspace.binding) ! rescue ! puts "Usage: rm :var (rm var is not valid)" ! end end From k at pub.open-bio.org Sun Nov 6 13:30:07 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 6 13:27:27 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.5,1.6 Message-ID: <200511061830.jA6IU7VL014535@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv14526/lib/bio/shell Modified Files: core.rb Log Message: * savedir is repeatedly asked until y or n is given Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** core.rb 6 Nov 2005 01:36:11 -0000 1.5 --- core.rb 6 Nov 2005 18:30:04 -0000 1.6 *************** *** 134,141 **** dir = SAVEDIR if ! File.directory?(dir) ! print "Save in \"#{dir}\" directory? [y/n]: " ! answer = gets ! if /^\s*n/.match(answer.downcase) ! dir = USERDIR end end --- 134,146 ---- dir = SAVEDIR if ! File.directory?(dir) ! loop do ! print "Save in \"#{dir}\" directory? [y/n]: " ! answer = gets ! if /^\s*[Yy]/.match(answer) ! break ! elsif /^\s*[Nn]/.match(answer) ! dir = USERDIR ! break ! end end end From nakao at pub.open-bio.org Mon Nov 7 05:14:30 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 7 05:11:50 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db aaindex.rb,1.13,1.14 Message-ID: <200511071014.jA7AEUVL017332@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv17322/lib/bio/db Modified Files: aaindex.rb Log Message: * Converted to RDoc. Index: aaindex.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/aaindex.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** aaindex.rb 8 Sep 2005 01:22:11 -0000 1.13 --- aaindex.rb 7 Nov 2005 10:14:28 -0000 1.14 *************** *** 1,6 **** # ! # bio/db/aaindex.rb - AAindex database class # ! # Copyright (C) 2001 KAWASHIMA Shuichi # # This library is free software; you can redistribute it and/or --- 1,16 ---- # ! # = bio/db/aaindex.rb - AAindex database class # ! # Copyright:: Copyright (C) 2001 KAWASHIMA Shuichi ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # ! # == Example ! # == References ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 28,32 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 28,62 **** class AAindex < KEGGDB ! DELIMITER = RS = "\n//\n" TAGSIZE = 2 def initialize(entry) super(entry, TAGSIZE) end def entry_id field_fetch('H') end def definition field_fetch('D') end def dblinks field_fetch('R') end def author field_fetch('A') end def title field_fetch('T') end def journal field_fetch('J') end def comment get('*') --- 38,86 ---- class AAindex < KEGGDB ! # Delimiter ! DELIMITER ="\n//\n" ! ! # Delimiter ! RS = DELIMITER ! ! # TAGSIZE = 2 + # def initialize(entry) super(entry, TAGSIZE) end + # Returns def entry_id field_fetch('H') end + # Returns def definition field_fetch('D') end + # Returns def dblinks field_fetch('R') end + # Returns def author field_fetch('A') end + # Returns def title field_fetch('T') end + # Returns def journal field_fetch('J') end + # Returns def comment get('*') *************** *** 68,79 **** --- 92,106 ---- class AAindex1 < AAindex + # def initialize(entry) super(entry) end + # Returns def correlation_coefficient field_fetch('C') end + # Returns def index(type = :float) aa = %w( A R N D C Q E G H I L K M F P S T W Y V ) *************** *** 126,133 **** --- 153,162 ---- class AAindex2 < AAindex + # def initialize(entry) super(entry) end + # Returns def rows label_data *************** *** 135,138 **** --- 164,168 ---- end + # Returns def cols label_data *************** *** 140,143 **** --- 170,174 ---- end + # Returns def matrix ma = Array.new *************** *** 152,155 **** --- 183,187 ---- end + # Returns def old_matrix # for AAindex <= ver 5.0 *************** *** 234,262 **** p aax2.matrix.transpose end - - =begin - - = Bio::AAindex - - --- Bio::AAindex.new(entry) - --- Bio::AAindex#entry_id - --- Bio::AAindex#definition - --- Bio::AAindex#dblinks - --- Bio::AAindex#author - --- Bio::AAindex#title - --- Bio::AAindex#journal - --- Bio::AAindex#comment - - = Bio::AAindex1 - - --- Bio::AAindex1#correlation_coefficient - --- Bio::AAindex1#index - - = Bio::AAindex2 - - --- Bio::AAindex2#matrix - --- Bio::AAindex2#rows - --- Bio::AAindex2#cols - - =end --- 266,268 ---- From nakao at pub.open-bio.org Mon Nov 7 08:19:19 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 7 08:16:48 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db gff.rb,1.3,1.4 Message-ID: <200511071319.jA7DJJVL017980@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv17970/lib/bio/db Modified Files: gff.rb Log Message: * Converted to RDoc. Index: gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/gff.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gff.rb 26 Sep 2005 13:00:06 -0000 1.3 --- gff.rb 7 Nov 2005 13:19:17 -0000 1.4 *************** *** 1,6 **** # ! # bio/db/gff.rb - GFF format class # ! # Copyright (C) 2003 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,18 ---- # ! # = bio/db/gff.rb - GFF format class # ! # Copyright:: Copyright (C) 2003 KATAYAMA Toshiaki ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # ! # == Example ! # == References ! # * http://www.sanger.ac.uk/Software/formats/GFF/ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,27 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # module Bio class GFF def initialize(str = '') @records = Array.new --- 30,45 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # module Bio + # = GFF class GFF + + # Returns + attr_accessor :records + + # def initialize(str = '') @records = Array.new *************** *** 30,36 **** end end - attr_accessor :records class Record def initialize(str) @comments = str.chomp[/#.*/] --- 48,86 ---- end end + # = GFF::Record class Record + + # Returns + attr_accessor :seqname + + # Returns + attr_accessor :source + + # Returns + attr_accessor :feature + + # Returns + attr_accessor :start + + # Returns + attr_accessor :end + + # Returns + attr_accessor :score + + # Returns + attr_accessor :strand + + # Returns + attr_accessor :frame + + # Returns + attr_accessor :attributes + + # Returns + attr_accessor :comments + + # def initialize(str) @comments = str.chomp[/#.*/] *************** *** 40,45 **** @attributes = parse_attributes(attributes) if attributes end - attr_accessor :seqname, :source, :feature, :start, :end, :score, - :strand, :frame, :attributes, :comments private --- 90,93 ---- *************** *** 56,64 **** --- 104,118 ---- end + # = GFF2 class GFF2 < GFF + + # VERSION = 2 end + # = GFF3 class GFF3 < GFF + + # VERSION = 3 end *************** *** 76,82 **** p Bio::GFF.new(ARGF.read) end - - - =begin - http://www.sanger.ac.uk/Software/formats/GFF/ - =end --- 130,131 ---- From nakao at pub.open-bio.org Mon Nov 7 09:28:15 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 7 09:25:32 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db litdb.rb,0.5,0.6 Message-ID: <200511071428.jA7ESFVL018178@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv18168/lib/bio/db Modified Files: litdb.rb Log Message: * Converted to RDoc. Index: litdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/litdb.rb,v retrieving revision 0.5 retrieving revision 0.6 diff -C2 -d -r0.5 -r0.6 *** litdb.rb 22 Nov 2002 22:58:18 -0000 0.5 --- litdb.rb 7 Nov 2005 14:28:12 -0000 0.6 *************** *** 1,6 **** # ! # bio/db/litdb.rb - LITDB database class # ! # Copyright (C) 2001 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,17 ---- # ! # = bio/db/litdb.rb - LITDB database class # ! # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # ! # == Example ! # == References ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 29,33 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 25,50 **** module Bio class LITDB < NCBIDB ! DELIMITER = RS = "\nEND\n" ! TAGSIZE = 12 def initialize(entry) super(entry, TAGSIZE) end def reference hash = Hash.new('') ! hash['authors'] = author.split(/;/).map {|x| x.sub(/,/, ', ')} ! hash['title'] = title ! hash['journal'] = journal.gsub(/\./, '. ').strip vol = volume.split(/,\s+/) if vol.size > 1 ! hash['volume'] = vol.shift.sub(/Vol\./, '') hash['pages'], ! hash['year'] = vol.pop.split(' ') ! hash['issue'] = vol.shift.sub(/No\./, '') unless vol.empty? end --- 36,70 ---- module Bio + # = LITDB class class LITDB < NCBIDB ! # Delimiter ! DELIMITER = "\nEND\n" + # Delimiter + RS = DELIMITER + + # + TAGSIZE = 12 + + # def initialize(entry) super(entry, TAGSIZE) end + # Returns def reference hash = Hash.new('') ! hash['authors'] = author.split(/;/).map {|x| x.sub(/,/, ', ')} ! hash['title'] = title ! hash['journal'] = journal.gsub(/\./, '. ').strip vol = volume.split(/,\s+/) if vol.size > 1 ! hash['volume'] = vol.shift.sub(/Vol\./, '') hash['pages'], ! hash['year'] = vol.pop.split(' ') ! hash['issue'] = vol.shift.sub(/No\./, '') unless vol.empty? end *************** *** 110,130 **** p Bio::LITDB.new(entry).reference end - - - =begin - - = Bio::LITDB - - --- Bio::LITDB.new(entry) - --- Bio::LITDB#reference - --- Bio::LITDB#entry_id - --- Bio::LITDB#title - --- Bio::LITDB#field - --- Bio::LITDB#journal - --- Bio::LITDB#volume - --- Bio::LITDB#keyword - --- Bio::LITDB#author - - =end - - --- 130,131 ---- From k at pub.open-bio.org Mon Nov 7 20:41:12 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 7 20:38:27 2005 Subject: [BioRuby-cvs] bioruby README.DEV,1.3,1.4 Message-ID: <200511080141.jA81fCVL025472@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv25468 Modified Files: README.DEV Log Message: * added == References field in RDoc template Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README.DEV 4 Nov 2005 17:31:32 -0000 1.3 --- README.DEV 8 Nov 2005 01:41:10 -0000 1.4 *************** *** 53,59 **** # ! # = bio/foo/bar.rb - foo bar class # ! # Copyright:: Copyright (C) 2005 # Bio R. Hacker , # Chem R. Hacker --- 53,59 ---- # ! # = bio/db/hoge.rb - Hoge database parser # ! # Copyright:: Copyright (C) 2001, 2005 # Bio R. Hacker , # Chem R. Hacker *************** *** 64,73 **** # == Blah blah blah # ! # blah blah blah ... # ! # === Examples # ! # hoge = Bio::Foo::Bar.new ! # puts hoge.fuga # #-- --- 64,79 ---- # == Blah blah blah # ! # See http://hoge.db/ for more details on the Hoge databse. ! # ... blah blah blah ... # ! # == Examples # ! # hoge = Bio::Hoge.new(entry) ! # puts hoge.entry_id ! # puts hoge.definition ! # ! # == References ! # ! # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) # #-- From nakao at pub.open-bio.org Mon Nov 7 21:13:46 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 7 21:11:00 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db aaindex.rb,1.14,1.15 Message-ID: <200511080213.jA82DkVL025619@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv25609/lib/bio/db Modified Files: aaindex.rb Log Message: * Updated RDoc (Description, Examples, Referencees). * Removed TAB. Index: aaindex.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/aaindex.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** aaindex.rb 7 Nov 2005 10:14:28 -0000 1.14 --- aaindex.rb 8 Nov 2005 02:13:44 -0000 1.15 *************** *** 5,15 **** # Licence:: LGPL # ! # $Id$ # # == Description # # - # == Example # == References #-- # --- 5,27 ---- # Licence:: LGPL # ! # $Id$ # # == Description + # Classes for Amino Acid Index Database (AAindex and AAindex2). + # * AAindex Manual: http://www.genome.jp/dbget-bin/show_man?aaindex # + # == Examples + # aax1 = Bio::AAindex1.new("PRAM900102.aaindex1") + # aax1.entry_id + # aax1.index + # + # aax2 = Bio::AAindex2.new("HENS920102.aaindex2") + # aax2.entry_id + # aax2.matrix + # aax2.matrix[2,2] # # == References + # * http://www.genome.jp/aaindex/ + # #-- # *************** *** 39,51 **** # Delimiter ! DELIMITER ="\n//\n" # Delimiter RS = DELIMITER ! # ! TAGSIZE = 2 - # def initialize(entry) super(entry, TAGSIZE) --- 51,63 ---- # Delimiter ! DELIMITER ="\n//\n" # Delimiter RS = DELIMITER ! # Bio::DB API ! TAGSIZE = 2 ! def initialize(entry) super(entry, TAGSIZE) *************** *** 92,96 **** class AAindex1 < AAindex ! # def initialize(entry) super(entry) --- 104,108 ---- class AAindex1 < AAindex ! def initialize(entry) super(entry) *************** *** 116,120 **** sum += a.to_f end ! mean = sum / values.size # / 20 var = 0.0 values.each do |a| --- 128,132 ---- sum += a.to_f end ! mean = sum / values.size # / 20 var = 0.0 values.each do |a| *************** *** 153,157 **** class AAindex2 < AAindex ! # def initialize(entry) super(entry) --- 165,169 ---- class AAindex2 < AAindex ! def initialize(entry) super(entry) *************** *** 184,190 **** # Returns ! def old_matrix # for AAindex <= ver 5.0 ! @aa = {} # used to determine row/column of the aa attr_reader :aa --- 196,202 ---- # Returns ! def old_matrix # for AAindex <= ver 5.0 ! @aa = {} # used to determine row/column of the aa attr_reader :aa *************** *** 192,196 **** case field ! when / (ARNDCQEGHILKMFPSTWYV)\s+(.*)/ # 20x19/2 matrix aalist = $1 values = $2.split(/\s+/) --- 204,208 ---- case field ! when / (ARNDCQEGHILKMFPSTWYV)\s+(.*)/ # 20x19/2 matrix aalist = $1 values = $2.split(/\s+/) *************** *** 202,206 **** ma = Array.new 20.times do ! ma.push(Array.new(20)) # 2D array of 20x(20) end --- 214,218 ---- ma = Array.new 20.times do ! ma.push(Array.new(20)) # 2D array of 20x(20) end *************** *** 213,219 **** Matrix[*ma] ! when / -ARNDCQEGHILKMFPSTWYV / # 21x20/2 matrix (with gap) raise NotImplementedError ! when / ACDEFGHIKLMNPQRSTVWYJ- / # 21x21 matrix (with gap) raise NotImplementedError end --- 225,231 ---- Matrix[*ma] ! when / -ARNDCQEGHILKMFPSTWYV / # 21x20/2 matrix (with gap) raise NotImplementedError ! when / ACDEFGHIKLMNPQRSTVWYJ- / # 21x21 matrix (with gap) raise NotImplementedError end From k at pub.open-bio.org Tue Nov 8 01:42:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 8 01:40:07 2005 Subject: [BioRuby-cvs] bioruby README.DEV,1.4,1.5 Message-ID: <200511080642.jA86guVL026159@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv26155 Modified Files: README.DEV Log Message: * added example to include URL in References in the template Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README.DEV 8 Nov 2005 01:41:10 -0000 1.4 --- README.DEV 8 Nov 2005 06:42:54 -0000 1.5 *************** *** 77,80 **** --- 77,82 ---- # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) # + # * http://hoge.db/ + # #-- # From nakao at pub.open-bio.org Tue Nov 8 06:06:42 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 8 06:03:52 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/kegg - New directory Message-ID: <200511081106.jA8B6gVL027186@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv27176/test/unit/bio/db/kegg Log Message: Directory /home/repository/bioruby/bioruby/test/unit/bio/db/kegg added to the repository From nakao at pub.open-bio.org Tue Nov 8 06:07:56 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 8 06:05:09 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/kegg test_genes.rb,NONE,1.1 Message-ID: <200511081107.jA8B7uVL027244@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv27234/test/unit/bio/db/kegg Added Files: test_genes.rb Log Message: * Initial import. --- NEW FILE: test_genes.rb --- # # test/unit/bio/db/kegg/test_genes.rb - Unit test for Bio::KEGG::GENES # # Copyright (C) 2005 Mitsuteru Nakao # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_genes.rb,v 1.1 2005/11/08 11:07:54 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 5, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/db/kegg/genes' module Bio class TestGenesDblinks < Test::Unit::TestCase def setup entry =< Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv30701/doc Modified Files: Changes-0.7.rd Log Message: * Bio::KEGG::GENES#dblinks method is changed to return a Hash of Array of IDs instead of a Hash of String. Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Changes-0.7.rd 5 Nov 2005 10:21:47 -0000 1.4 --- Changes-0.7.rd 9 Nov 2005 07:15:42 -0000 1.5 *************** *** 90,93 **** --- 90,112 ---- the number of the edge objects. + --- Bio::GenBank::Common + + * lib/bio/db/genbank/common.rb is removed. + + Renamed to Bio::NCBIDB::Common for the simple autoload dependency. + + --- Bio::EMBL::Common + + * lib/bio/db/embl/common.rb is removed. + + Renamed to Bio::EMBLDB::Common for the simple autoload dependency. + + --- Bio::KEGG::GENES + + * lib/bio/db/kegg/genes.rb + + linkdb method is changed to return a Hash of an Array of entry IDs + instead of a Hash of a entry ID string. + === Deleted files From k at pub.open-bio.org Wed Nov 9 02:15:44 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Nov 9 02:12:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg genes.rb,0.20,0.21 Message-ID: <200511090715.jA97FiVL030711@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv30701/lib/bio/db/kegg Modified Files: genes.rb Log Message: * Bio::KEGG::GENES#dblinks method is changed to return a Hash of Array of IDs instead of a Hash of String. Index: genes.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/genes.rb,v retrieving revision 0.20 retrieving revision 0.21 diff -C2 -d -r0.20 -r0.21 *** genes.rb 8 Sep 2005 01:22:11 -0000 0.20 --- genes.rb 9 Nov 2005 07:15:42 -0000 0.21 *************** *** 80,83 **** --- 80,84 ---- def eclinks + # definition.slice(/\[EC:(.*?)\]/, 1) # ruby >= 1.7 # definition.scan(/\[EC:(.*?)\]/).flatten if /\[EC:(.*?)\]/.match(definition) *************** *** 89,92 **** --- 90,94 ---- def splinks + # definition.slice(/\[SP:(.*?)\]/, 1) # ruby >= 1.7 # definition.scan(/\[SP:(.*?)\]/).flatten if /\[SP:(.*?)\]/.match(definition) *************** *** 127,136 **** unless @data['DBLINKS'] hash = {} ! get('DBLINKS').scan(/(\S+):\s*(\S+)\n/).each do |k, v| ! hash[k] = v end @data['DBLINKS'] = hash end ! @data['DBLINKS'] # Hash of DB:ID in DBLINKS end --- 129,139 ---- unless @data['DBLINKS'] hash = {} ! get('DBLINKS').scan(/(\S+):\s*(.*)\n/).each do |db, str| ! id_array = str.strip.split(/\s+/) ! hash[db] = id_array end @data['DBLINKS'] = hash end ! @data['DBLINKS'] # Hash of Array of DB IDs in DBLINKS end From nakao at pub.open-bio.org Wed Nov 9 02:58:21 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 9 02:55:25 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/kegg test_genes.rb,1.1,1.2 Message-ID: <200511090758.jA97wLVL030801@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv30791/test/unit/bio/db/kegg Modified Files: test_genes.rb Log Message: * Test for dblinks method. Index: test_genes.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/kegg/test_genes.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_genes.rb 8 Nov 2005 11:07:54 -0000 1.1 --- test_genes.rb 9 Nov 2005 07:58:19 -0000 1.2 *************** *** 39,44 **** end def test_dblinks_1 ! assert_equal(@obj.dblinks['TIGR'], 'At3g05560') end --- 39,52 ---- end + def test_data + assert_equal(@obj.instance_eval('get("DBLINKS")'), '') + end + + def test_dblinks_0 + assert_equal(@obj.dblinks, {}) + end + def test_dblinks_1 ! assert_equal(@obj.dblinks['TIGR'], ['At3g05560']) end From k at pub.open-bio.org Wed Nov 9 07:30:10 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Wed Nov 9 07:27:35 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg genes.rb,0.21,0.22 Message-ID: <200511091230.jA9CUAVL031599@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv31590/lib/bio/db/kegg Modified Files: genes.rb Log Message: * dblinks is fixed to collectly handle the line without new line at the line end. Index: genes.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/genes.rb,v retrieving revision 0.21 retrieving revision 0.22 diff -C2 -d -r0.21 -r0.22 *** genes.rb 9 Nov 2005 07:15:42 -0000 0.21 --- genes.rb 9 Nov 2005 12:30:07 -0000 0.22 *************** *** 129,133 **** unless @data['DBLINKS'] hash = {} ! get('DBLINKS').scan(/(\S+):\s*(.*)\n/).each do |db, str| id_array = str.strip.split(/\s+/) hash[db] = id_array --- 129,133 ---- unless @data['DBLINKS'] hash = {} ! get('DBLINKS').scan(/(\S+):\s*(.*)\n?/).each do |db, str| id_array = str.strip.split(/\s+/) hash[db] = id_array From nakao at pub.open-bio.org Wed Nov 9 08:20:11 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 9 08:17:13 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/kegg test_genes.rb,1.2,1.3 Message-ID: <200511091320.jA9DKBVL031717@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/kegg In directory pub.open-bio.org:/tmp/cvs-serv31702/test/unit/bio/db/kegg Modified Files: test_genes.rb Log Message: * Update TestGenesDblinks. Index: test_genes.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/kegg/test_genes.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_genes.rb 9 Nov 2005 07:58:19 -0000 1.2 --- test_genes.rb 9 Nov 2005 13:20:09 -0000 1.3 *************** *** 40,56 **** def test_data ! assert_equal(@obj.instance_eval('get("DBLINKS")'), '') end def test_dblinks_0 ! assert_equal(@obj.dblinks, {}) end def test_dblinks_1 ! assert_equal(@obj.dblinks['TIGR'], ['At3g05560']) end def test_dblinks_2 ! assert_equal(@obj.dblinks['NCBI-GI'], ['15230008', '42572267']) end end --- 40,57 ---- def test_data ! str = "DBLINKS TIGR: At3g05560\n NCBI-GI: 15230008 42572267" ! assert_equal(str, @obj.instance_eval('get("DBLINKS")')) end def test_dblinks_0 ! assert_equal(Hash, @obj.dblinks.class) end def test_dblinks_1 ! assert_equal(['At3g05560'], @obj.dblinks['TIGR']) end def test_dblinks_2 ! assert_equal(['15230008', '42572267'], @obj.dblinks['NCBI-GI']) end end From k at pub.open-bio.org Sun Nov 13 20:34:15 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:30:53 2005 Subject: [BioRuby-cvs] bioruby README.DEV,1.5,1.6 Message-ID: <200511140134.jAE1YEVL025535@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv25531 Modified Files: README.DEV Log Message: * Corrections contributed by Trevor Wennbolm Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** README.DEV 8 Nov 2005 06:42:54 -0000 1.5 --- README.DEV 14 Nov 2005 01:34:12 -0000 1.6 *************** *** 8,51 **** There are many possible ways to contribute to the BioRuby project, ! such as * Join the discussion on the BioRuby mailing list ! * Send a bug report, write a bug fix patch ! * Add and correcting documentations ! * Development codes for new features etc. ! ! and all of these are welcome! ! However, here we describe on the last option -- how to contribute and ! include your codes to the BioRuby distribution. We would like to include your contribution as long as the scope of your module meets the field of bioinformatics. ! == Licence ! If you wish your module to be included in the BioRuby distribution, ! you need to agree that your module is licensed under the GNU's LGPL ! as the BioRuby chosen LGPL for its license. == Coding style ! You need to follow the typical coding styles of the BioRuby modules: === Use the following naming conventions ! * CamelCase for module and class names, ! * '_'-separated lowercase names for method names, ! * '_'-separated lowercase names for variable names, and ! * all uppercase names for constants. === Indentation must not include tabs * Use 2 spaces for indentation. ! * Don't replace spaces at the line head to tabs. === Comments ! Don't use =begin and =end block for comments. If you need to add comments, include it in the RDoc documentation. --- 8,49 ---- There are many possible ways to contribute to the BioRuby project, ! such as: * Join the discussion on the BioRuby mailing list ! * Send a bug report or write a bug fix patch ! * Add and correct documentation ! * Develop code for new features, etc. ! All of these are welcome! This document describes the last option, ! how to contribute your code to the BioRuby distribution. We would like to include your contribution as long as the scope of your module meets the field of bioinformatics. ! == License ! If you would like your module to be included in the BioRuby ! distribution, please license your module under GNU's LGPL for ! compatibility with the BioRuby project. == Coding style ! You will need to follow the typical coding styles of the BioRuby modules: === Use the following naming conventions ! * CamelCase for module and class names ! * '_'-separated_lowercase for method names ! * '_'-separated_lowercase for variable names ! * all UPPERCASE for constants === Indentation must not include tabs * Use 2 spaces for indentation. ! * Don't replace spaces to tabs. === Comments ! Don't use =begin and =end blocks for comments. If you need to add comments, include it in the RDoc documentation. *************** *** 55,62 **** # = bio/db/hoge.rb - Hoge database parser # ! # Copyright:: Copyright (C) 2001, 2005 ! # Bio R. Hacker , ! # Chem R. Hacker ! # Lisence:: LGPL # # $Id$ --- 53,60 ---- # = bio/db/hoge.rb - Hoge database parser # ! # Copyright:: Copyright (C) 2001, 2005 ! # Bio R. Hacker , ! # Chem R. Hacker ! # License:: LGPL # # $Id$ *************** *** 75,79 **** # == References # ! # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) # # * http://hoge.db/ --- 73,78 ---- # == References # ! # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. ! 123:100--123 (2030) # # * http://hoge.db/ *************** *** 93,97 **** # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # --- 92,97 ---- # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ! 02111-1307 USA # # *************** *** 99,134 **** === Documentation should be written in the RDoc format in the source code ! The RDoc format is becoming de facto standard for the Ruby documentation. ! So, we are now in transition from the RD format which we have been used ! to the RDoc format in API documentations. ! Additional tutorial documents and some working examples are also ! welcome when you contribute your codes. You may also able to use ! the header part of the file for this purpose as shown in the previous ! section. === Testing code should use 'test/unit' ! Unit test should come with your modules by which you can assure what ! you meant to do with each method. The test code is also able to make ! your maintainance procedure easy and stable. === Using autoload ! To make fast start up, we replaced most of 'require' to 'autoload' ! since the BioRuby version 0.7. During this change, we have found some tips: ! You sholud not separate a same namespace into several files. * For example, if you have separated definitions of the Bio::Foo ! class in two files (e.g. 'bio/foo.rb' and 'bio/bar.rb'), you ! need to resolve the dependency of them (including the order of ! loading these two files) by yourself. ! * It is not the case that you have a definition of Bio::Foo in ! 'bio/foo.rb' and a definition of Bio::Foo::Bar in 'bio/bar.rb'. ! In this case, you just need to add following line in the ! 'bio/foo.rb' file. autoload :Bar, 'bio/foo/bar' --- 99,133 ---- === Documentation should be written in the RDoc format in the source code ! The RDoc format is becoming the popular standard for Ruby documentation. ! We are now in transition from the previously used RD format to the RDoc ! format in API documentation. ! Additional tutorial documentation and working examples are encouraged ! with your contribution. You may use the header part of the file for ! this purpose as demonstrated in the previous section. === Testing code should use 'test/unit' ! Unit tests should come with your modules by which you can assure what ! you meant to do with each method. The test code is useful to make ! maintenance easy and ensure stability. === Using autoload ! To quicken the initial load time we have replaced most of 'require' to ! 'autoload' ! since BioRuby version 0.7. During this change, we have found some tips: ! You should not separate the same namespace into several files. * For example, if you have separated definitions of the Bio::Foo ! class into two files (e.g. 'bio/foo.rb' and 'bio/bar.rb'), you ! need to resolve the dependencies (including the load order) ! yourself. ! * If you have a defined Bio::Foo in 'bio/foo.rb' and a defined ! Bio::Foo::Bar in 'bio/foo/bar.rb' add the following line in the ! 'bio/foo.rb' file: autoload :Bar, 'bio/foo/bar' *************** *** 150,158 **** autoload :Foo, 'bio/foo' ! to make autoload can be written in 1 line. == Name space ! Your module should be located under the module Bio and put under the 'bioruby/lib/bio' directory. The class/module names and the file names should be short and descriptive. --- 149,157 ---- autoload :Foo, 'bio/foo' ! so autoload can be written in 1 line. == Name space ! Your module should be located under the top-level module Bio and put under the 'bioruby/lib/bio' directory. The class/module names and the file names should be short and descriptive. *************** *** 167,177 **** bio/util/ -- utilities and algorithms for bioinformatics ! If your module doesn't match to any of the above, please propose an appropriate directory name when you contribute. == Maintainance ! Finally, please keep maintain the code your contrubuted. The BioRuby ! staff is willing to give you CVS privilege if needed. =end --- 166,177 ---- bio/util/ -- utilities and algorithms for bioinformatics ! If your module doesn't match any of the above, please propose an appropriate directory name when you contribute. == Maintainance ! Finally, please maintain the code you've contrubuted. The BioRuby ! staff is willing to give you CVS privileges if needed. =end + From k at pub.open-bio.org Sun Nov 13 20:52:21 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:48:56 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data na.rb,0.15,0.16 Message-ID: <200511140152.jAE1qLVL025619@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv25615/lib/bio/data Modified Files: na.rb Log Message: * Updates and correction by Trevor Wennblom Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.15 retrieving revision 0.16 diff -C2 -d -r0.15 -r0.16 *** na.rb 4 Nov 2005 17:49:10 -0000 0.15 --- na.rb 14 Nov 2005 01:52:19 -0000 0.16 *************** *** 4,11 **** # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ # #-- # --- 4,42 ---- # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ # + # == Synopsis + # + # Bio::NucleicAcid class contains data related to nucleic acids. + # + # == Usage + # + # Examples: + # + # require 'bio' + # + # puts "### na = Bio::NucleicAcid.new" + # na = Bio::NucleicAcid.new + # + # puts "# na.to_re('yrwskmbdhvnatgc')" + # p na.to_re('yrwskmbdhvnatgc') + # + # puts "# Bio::NucleicAcid.to_re('yrwskmbdhvnatgc')" + # p Bio::NucleicAcid.to_re('yrwskmbdhvnatgc') + # + # puts "# na.weight('A')" + # p na.weight('A') + # + # puts "# Bio::NucleicAcid.weight('A')" + # p Bio::NucleicAcid.weight('A') + # + # puts "# na.weight('atgc')" + # p na.weight('atgc') + # + # puts "# Bio::NucleicAcid.weight('atgc')" + # p Bio::NucleicAcid.weight('atgc') + # #-- # *************** *** 44,48 **** 's' => '[gc]', # Strong 'k' => '[tg]', # Keto ! 'm' => '[ac]', # aMino 'b' => '[tgc]', # not A --- 75,79 ---- 's' => '[gc]', # Strong 'k' => '[tg]', # Keto ! 'm' => '[ac]', # aroMatic 'b' => '[tgc]', # not A *************** *** 81,91 **** :guanine => 151.15, :cytosine => 111.12, ! :uracil => 112.10, :deoxyribose_phosphate => 196.11, ! :ribose_phosphate => 212.11, :hydrogen => 1.00794, ! :water => 18.015, } --- 112,122 ---- :guanine => 151.15, :cytosine => 111.12, ! :uracil => 112.10, :deoxyribose_phosphate => 196.11, ! :ribose_phosphate => 212.11, :hydrogen => 1.00794, ! :water => 18.015, } *************** *** 158,166 **** extend Data - # backward compatibility Names = Data::Names Weight = Data::Weight - end --- 189,195 ---- From k at pub.open-bio.org Sun Nov 13 21:01:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:58:29 2005 Subject: [BioRuby-cvs] bioruby/bin bioruby,1.5,1.6 Message-ID: <200511140201.jAE21uVL025698@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/bin In directory pub.open-bio.org:/tmp/cvs-serv25684/bin Modified Files: bioruby Log Message: * fixed typo s/lisence/license/ Index: bioruby =================================================================== RCS file: /home/repository/bioruby/bioruby/bin/bioruby,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bioruby 6 Nov 2005 01:28:44 -0000 1.5 --- bioruby 14 Nov 2005 02:01:53 -0000 1.6 *************** *** 5,9 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 5,9 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Nov 13 21:01:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:58:30 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb, 0.13, 0.14 codontable.rb, 0.14, 0.15 Message-ID: <200511140201.jAE21uVL025702@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv25684/lib/bio/data Modified Files: aa.rb codontable.rb Log Message: * fixed typo s/lisence/license/ Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.13 retrieving revision 0.14 diff -C2 -d -r0.13 -r0.14 *** aa.rb 4 Nov 2005 17:49:10 -0000 0.13 --- aa.rb 14 Nov 2005 02:01:54 -0000 0.14 *************** *** 4,8 **** # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ Index: codontable.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/codontable.rb,v retrieving revision 0.14 retrieving revision 0.15 diff -C2 -d -r0.14 -r0.15 *** codontable.rb 5 Nov 2005 08:25:47 -0000 0.14 --- codontable.rb 14 Nov 2005 02:01:54 -0000 0.15 *************** *** 4,8 **** # Copyright:: Copyright (C) 2001, 2004 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2001, 2004 # Toshiaki Katayama ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Nov 13 21:01:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:58:35 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io das.rb, 1.10, 1.11 ddbjxml.rb, 1.7, 1.8 Message-ID: <200511140201.jAE21uVL025707@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv25684/lib/bio/io Modified Files: das.rb ddbjxml.rb Log Message: * fixed typo s/lisence/license/ Index: das.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/das.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** das.rb 5 Nov 2005 08:31:26 -0000 1.10 --- das.rb 14 Nov 2005 02:01:54 -0000 1.11 *************** *** 5,9 **** # Shuichi Kawashima , # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 5,9 ---- # Shuichi Kawashima , # Toshiaki Katayama ! # License:: LGPL # # $Id$ Index: ddbjxml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ddbjxml.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ddbjxml.rb 5 Nov 2005 08:33:01 -0000 1.7 --- ddbjxml.rb 14 Nov 2005 02:01:54 -0000 1.8 *************** *** 4,8 **** # Copyright:: Copyright (C) 2003, 2004 # KATAYAMA Toshiaki ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2003, 2004 # KATAYAMA Toshiaki ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Nov 13 21:01:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:58:39 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.6,1.7 Message-ID: <200511140201.jAE21uVL025712@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv25684/lib/bio Modified Files: shell.rb Log Message: * fixed typo s/lisence/license/ Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** shell.rb 6 Nov 2005 01:29:27 -0000 1.6 --- shell.rb 14 Nov 2005 02:01:54 -0000 1.7 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Nov 13 21:01:57 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:58:50 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb, 1.2, 1.3 flatfile.rb, 1.4, 1.5 keggapi.rb, 1.2, 1.3 obda.rb, 1.2, 1.3 seq.rb, 1.6, 1.7 Message-ID: <200511140201.jAE21vVL025717@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv25684/lib/bio/shell/plugin Modified Files: codon.rb flatfile.rb keggapi.rb obda.rb seq.rb Log Message: * fixed typo s/lisence/license/ Index: obda.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** obda.rb 5 Nov 2005 09:06:49 -0000 1.2 --- obda.rb 14 Nov 2005 02:01:54 -0000 1.3 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** flatfile.rb 5 Nov 2005 08:36:24 -0000 1.4 --- flatfile.rb 14 Nov 2005 02:01:54 -0000 1.5 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** codon.rb 5 Nov 2005 11:54:35 -0000 1.2 --- codon.rb 14 Nov 2005 02:01:54 -0000 1.3 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ *************** *** 188,192 **** [ 's', '[gc]', 'Strong' ], [ 'k', '[tg]', 'Keto' ], ! [ 'm', '[ac]', 'aMino' ], [ 'b', '[tgc]', 'not A' ], [ 'v', '[agc]', 'not T' ], --- 188,192 ---- [ 's', '[gc]', 'Strong' ], [ 'k', '[tg]', 'Keto' ], ! [ 'm', '[ac]', 'aroMatic' ], [ 'b', '[tgc]', 'not A' ], [ 'v', '[agc]', 'not T' ], Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** keggapi.rb 6 Nov 2005 02:12:03 -0000 1.2 --- keggapi.rb 14 Nov 2005 02:01:54 -0000 1.3 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** seq.rb 6 Nov 2005 03:03:08 -0000 1.6 --- seq.rb 14 Nov 2005 02:01:54 -0000 1.7 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Sun Nov 13 21:01:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 13 20:58:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb, 1.6, 1.7 session.rb, 1.4, 1.5 Message-ID: <200511140201.jAE21uVL025714@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv25684/lib/bio/shell Modified Files: core.rb session.rb Log Message: * fixed typo s/lisence/license/ Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** session.rb 6 Nov 2005 18:28:48 -0000 1.4 --- session.rb 14 Nov 2005 02:01:54 -0000 1.5 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** core.rb 6 Nov 2005 18:30:04 -0000 1.6 --- core.rb 14 Nov 2005 02:01:54 -0000 1.7 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # Lisence:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Mon Nov 14 00:43:45 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 14 00:40:20 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db/genbank common.rb, 1.7, 1.8 genbank.rb, 0.36, 0.37 Message-ID: <200511140543.jAE5hjVL026194@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/genbank In directory pub.open-bio.org:/tmp/cvs-serv26190/lib/bio/db/genbank Modified Files: common.rb genbank.rb Log Message: * fixed typo in methodname (s/varnacular_name/vernacular_name/) by Trevor Wennblom * Bio::GenBank#gc method is removed as it can be calculated by Bio::Sequence::NA #gc and the method is changed to return int istead of float in BioRuby v0.7 Index: genbank.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/genbank.rb,v retrieving revision 0.36 retrieving revision 0.37 diff -C2 -d -r0.36 -r0.37 *** genbank.rb 23 Oct 2005 07:20:37 -0000 0.36 --- genbank.rb 14 Nov 2005 05:43:43 -0000 0.37 *************** *** 2,6 **** # bio/db/genbank/genbank.rb - GenBank database class # ! # Copyright (C) 2000-2004 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 2,6 ---- # bio/db/genbank/genbank.rb - GenBank database class # ! # Copyright (C) 2000-2005 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or *************** *** 118,127 **** end - def gc - num_gc = basecount('g') + basecount('c') - num_at = basecount('a') + basecount('t') - return format("%.1f", num_gc * 100.0 / (num_at + num_gc)).to_f - end - end # GenBank end # Bio --- 118,121 ---- *************** *** 186,190 **** p gb.source p gb.common_name ! p gb.varnacular_name p gb.organism p gb.taxonomy --- 180,184 ---- p gb.source p gb.common_name ! p gb.vernacular_name p gb.organism p gb.taxonomy *************** *** 203,207 **** p gb.basecount('a') p gb.basecount('A') - p gb.gc puts "## ORIGIN" --- 197,200 ---- *************** *** 292,296 **** --- Bio::GenBank#common_name -> String ! --- Bio::GenBank#varnacular_name -> String --- Bio::GenBank#organism -> String --- Bio::GenBank#taxonomy -> String --- 285,289 ---- --- Bio::GenBank#common_name -> String ! --- Bio::GenBank#vernacular_name -> String --- Bio::GenBank#organism -> String --- Bio::GenBank#taxonomy -> String *************** *** 299,303 **** The 'common_name' method is same as source['common_name']. ! The 'varnacular_name' method is an alias for the 'common_name'. The 'organism' method is same as source['organism']. The 'taxonomy' method is same as source['taxonomy']. --- 292,296 ---- The 'common_name' method is same as source['common_name']. ! The 'vernacular_name' method is an alias for the 'common_name'. The 'organism' method is same as source['organism']. The 'taxonomy' method is same as source['taxonomy']. *************** *** 337,344 **** count of the base as a Fixnum. The base can be one of 'a', 't', 'g', 'c', and 'o' (others). - - --- Bio::GenBank#gc -> Float - - Returns the average G+C% content of the sequence as a Float. === ORIGIN --- 330,333 ---- Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/genbank/common.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** common.rb 23 Oct 2005 07:20:36 -0000 1.7 --- common.rb 14 Nov 2005 05:43:43 -0000 1.8 *************** *** 115,119 **** source['common_name'] end ! alias varnacular_name common_name def organism --- 115,119 ---- source['common_name'] end ! alias vernacular_name common_name def organism From k at pub.open-bio.org Mon Nov 14 00:49:26 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 14 00:45:59 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.5,1.6 Message-ID: <200511140549.jAE5nQVL026224@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv26220/doc Modified Files: Changes-0.7.rd Log Message: * changes in bio/db/genbank/*.rb Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Changes-0.7.rd 9 Nov 2005 07:15:42 -0000 1.5 --- Changes-0.7.rd 14 Nov 2005 05:49:24 -0000 1.6 *************** *** 90,93 **** --- 90,102 ---- the number of the edge objects. + --- Bio::GenBank + + Bio::GenBank#gc is removed as the value can be calculated by the + Bio::Sequence::NA#gc method and the method is also changed to + return integer instead of float. + + Bio::GenBank#varnacular_name is renamed to Bio::GenBank#vernacular_name + as it was a typo. + --- Bio::GenBank::Common From nakao at pub.open-bio.org Mon Nov 14 09:46:09 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 14 09:42:44 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/util test_sirna.rb,NONE,1.1 Message-ID: <200511141446.jAEEk9VL027611@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/util In directory pub.open-bio.org:/tmp/cvs-serv27601/test/unit/bio/util Added Files: test_sirna.rb Log Message: * Initial import. --- NEW FILE: test_sirna.rb --- # # test/unit/bio/util/test_sirna.rb - Unit test for Bio::SiRNA. # # Copyright (C) 2005 Mitsuteru C. Nakap # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_sirna.rb,v 1.1 2005/11/14 14:46:06 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4 , 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/util/sirna' module Bio class TestSiRNANew < Test::Unit::TestCase def test_new srand(1) naseq = Bio::Sequence::NA.new("ACGT" * 100).randomize assert(Bio::SiRNA.new(naseq)) assert(Bio::SiRNA.new(naseq, 21)) assert(Bio::SiRNA.new(naseq, 21, 60.0)) assert(Bio::SiRNA.new(naseq, 21, 60.0, 40.0)) assert_raise(ArgumentError) { Bio::SiRNA.new(naseq, 21, 60.0, 40.0, 10.0) } end end class TestSiRNA < Test::Unit::TestCase def setup srand(1) naseq = Bio::Sequence::NA.new("ACGT" * 100).randomize @obj = Bio::SiRNA.new(naseq) end def test_antisense_size assert_equal(21, @obj.antisense_size) end def test_max_gc_percent assert_equal(60.0, @obj.max_gc_percent) end def test_min_gc_percent assert_equal(40.0, @obj.min_gc_percent) end def test_uitei? target = "aaGaa" assert_equal(false, @obj.uitei?(target)) target = "aaAaa" assert_equal(false, @obj.uitei?(target)) target = "G" * 9 assert_equal(false, @obj.uitei?(target)) end def test_reynolds? target = "G" * 9 assert_equal(false, @obj.reynolds?(target)) target = "aaaaAaaaaaaUaaAaaaaaAaa" assert_equal(true, @obj.reynolds?(target)) end def test_uitei assert(@obj.uitei) end def test_reynolds assert(@obj.reynolds) end def test_design assert(@obj.design) end def test_design_uitei assert(@obj.design('uitei')) end def test_design_reynolds assert(@obj.design('reynolds')) end end class TestSiRNAPairNew < Test::Unit::TestCase def test_new target = "" sense = "" antisense = "" start = 0 stop = 1 rule = 'rule' gc_percent = 60.0 assert_raise(ArgumentError) { Bio::SiRNA::Pair.new(target, sense, antisense, start, stop, rule) } assert(Bio::SiRNA::Pair.new(target, sense, antisense, start, stop, rule, gc_percent)) assert_raise(ArgumentError) { Bio::SiRNA::Pair.new(target, sense, antisense, start, stop, rule, gc_percent, "") } end end class TestSiRNAPair < Test::Unit::TestCase def setup srand(1) naseq = Bio::Sequence::NA.new("ACGT" * 100).randomize @obj = Bio::SiRNA.new(naseq).design.first end def test_target assert_equal("gcggacguaaggaguauuccugu", @obj.target) end def test_sense assert_equal("ggacguaaggaguauuccugu", @obj.sense) end def test_antisense assert_equal("aggaauacuccuuacguccgc", @obj.antisense) end def test_start assert_equal(9, @obj.start) end def test_stop assert_equal(32, @obj.stop) end def test_rule assert_equal("uitei", @obj.rule) end def test_gc_percent assert_equal(52.0, @obj.gc_percent) end def test_report report =< Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv27618/lib/bio/util Modified Files: sirna.rb Log Message: * Changed to RDoc format. Index: sirna.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/sirna.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sirna.rb 8 Sep 2005 01:22:12 -0000 1.4 --- sirna.rb 14 Nov 2005 14:47:59 -0000 1.5 *************** *** 1,6 **** # ! # bio/util/sirna.rb - Class for designing small inhibitory RNAs # ! # Copyright (C) 2004, 2005 Itoshi NIKAIDO # # This library is free software; you can redistribute it and/or --- 1,54 ---- # ! # = bio/util/sirna.rb - Class for designing small inhibitory RNAs # ! # Copyright:: Copyright (C) 2004, 2005 ! # Itoshi NIKAIDO ! # License:: LGPL ! # ! # $Id$ ! # ! # = Bio::SiRNA - Designing siRNA. ! # ! # This class implements the selection rules described by Kumiko Ui-Tei ! # et al. (2004) and Reynolds et al. (2004). ! # ! # = Example ! # ! # seq = Bio::Sequence::NA.new(ARGF.read) ! # ! # sirna = Bio::SiRNA.new(seq) ! # pairs = sirna.design ! # ! # pairs.each do |pair| ! # puts pair.report ! # shrna = Bio::SiRNA::ShRNA.new(pair) ! # shrna.design ! # puts shrna.report ! # ! # puts shrna.top_strand.dna ! # puts shrna.bottom_strand.dna ! # end ! # ! # = References ! # ! # * Kumiko Ui-Tei et al. Guidelines for the selection of highly effective ! # siRNA sequences for mammalian and chick RNA interference. ! # Nucl. Acids. Res. 2004 32: 936-948. ! # ! # * Angela Reynolds et al. Rational siRNA design for RNA interference. ! # Nature Biotech. 2004 22: 326-330. ! # ! # = ChangeLog ! # ! # 2005/03/21 Itoshi NIKAIDO ! # Bio::SiRNA#ShRNA_designer method was changed design method. ! # ! # 2004/06/25 ! # Bio::ShRNA class was added. ! # ! # 2004/06/17 Itoshi NIKAIDO ! # We can use shRNA loop sequence from piGene document. ! # ! # #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 66,70 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 25,30 **** --- 73,91 ---- module Bio + # = Bio::SiRNA + # Designing siRNA. class SiRNA + # A parameter of size of antisense. + attr_accessor :antisense_size + + # A parameter of maximal %GC. + attr_accessor :max_gc_percent + + # A parameter of minimum %GC. + attr_accessor :min_gc_percent + + # Input is a Bio::Sequence::NA object (the target sequence). + # Output is a list of Bio::SiRNA::Pair object. def initialize(seq, antisense_size = 21, max_gc_percent = 60.0, min_gc_percent = 40.0) @seq = seq.rna! *************** *** 34,39 **** @min_gc_percent = min_gc_percent end - attr_accessor :antisense_size, :max_gc_percent, :min_gc_percent def uitei?(target) return false unless /^.{2}[GC]/i =~ target --- 95,100 ---- @min_gc_percent = min_gc_percent end + # Ui-Tei's rule. def uitei?(target) return false unless /^.{2}[GC]/i =~ target *************** *** 50,53 **** --- 111,115 ---- end + # Reynolds' rule. def reynolds?(target) return false if /[GC]{9}/i =~ target *************** *** 56,67 **** --- 118,132 ---- end + # same as design('uitei'). def uitei design('uitei') end + # same as design('reynolds'). def reynolds design('reynolds') end + # rule can be one of 'uitei' (default) and 'reynolds'. def design(rule = 'uitei') @target_size = @antisense_size + 2 *************** *** 81,87 **** case rule when 'uitei' ! next unless uitei?(target) when 'reynolds' ! next unless reynolds?(target) else raise NotImplementedError --- 146,152 ---- case rule when 'uitei' ! next unless uitei?(target) when 'reynolds' ! next unless reynolds?(target) else raise NotImplementedError *************** *** 94,100 **** end ! class Pair def initialize(target, sense, antisense, start, stop, rule, gc_percent) @target = target --- 159,179 ---- end ! # == Bio::SiRNA::Pair class Pair + attr_accessor :target + + attr_accessor :sense + + attr_accessor :antisense + + attr_accessor :start + + attr_accessor :stop + + attr_accessor :rule + + attr_accessor :gc_percent + def initialize(target, sense, antisense, start, stop, rule, gc_percent) @target = target *************** *** 106,110 **** @gc_percent = gc_percent end - attr_accessor :target, :sense, :antisense, :start, :stop, :rule, :gc_percent # human readable report --- 185,188 ---- *************** *** 125,138 **** #end ! end #class Pair ! class ShRNA def initialize(pair) @pair = pair end - attr_accessor :top_strand, :bottom_strand def design(method = 'BLOCK-iT') case method --- 203,224 ---- #end ! end # class Pair ! # == Bio::SiRNA::ShRNA ! # Input is a Bio::SiRNA::Pair object (the target sequence). class ShRNA + + # aBio::Sequence::NA + attr_accessor :top_strand + + # aBio::Sequence::NA + attr_accessor :bottom_strand def initialize(pair) @pair = pair end + + # only the 'BLOCK-iT' rule is implemented for now. def design(method = 'BLOCK-iT') case method *************** *** 144,150 **** end def block_it(method = 'piGENE') ! top = Bio::Sequence::NA.new('CACC') # top_strand_shrna_overhang ! bot = Bio::Sequence::NA.new('AAAA') # bottom_strand_shrna_overhang fwd = @pair.sense rev = @pair.sense.complement --- 230,239 ---- end + + # same as design('BLOCK-iT'). + # method can be one of 'piGENE' (default) and 'BLOCK-iT'. def block_it(method = 'piGENE') ! top = Bio::Sequence::NA.new('CACC') # top_strand_shrna_overhang ! bot = Bio::Sequence::NA.new('AAAA') # bottom_strand_shrna_overhang fwd = @pair.sense rev = @pair.sense.complement *************** *** 164,175 **** if /^G/i =~ fwd ! @top_strand = top + fwd + loop_fwd + rev @bottom_strand = bot + fwd + loop_rev + rev else ! @top_strand = top + 'G' + fwd + loop_fwd + rev @bottom_strand = bot + fwd + loop_rev + rev + 'C' end end def report report = "### shRNA\n" --- 253,265 ---- if /^G/i =~ fwd ! @top_strand = top + fwd + loop_fwd + rev @bottom_strand = bot + fwd + loop_rev + rev else ! @top_strand = top + 'G' + fwd + loop_fwd + rev @bottom_strand = bot + fwd + loop_rev + rev + 'C' end end + # human readable report def report report = "### shRNA\n" *************** *** 180,188 **** end ! end #class ShRNA ! end #class SiRNA ! end #module bio --- 270,278 ---- end ! end # class ShRNA ! end # class SiRNA ! end # module Bio *************** *** 192,196 **** sirna = Bio::SiRNA.new(seq) ! pairs = sirna.design # or .design('uitei') or .uitei or .reynolds pairs.each do |pair| --- 282,286 ---- sirna = Bio::SiRNA.new(seq) ! pairs = sirna.design # or .design('uitei') or .uitei or .reynolds pairs.each do |pair| *************** *** 198,202 **** shrna = Bio::SiRNA::ShRNA.new(pair) ! shrna.design # or .design('BLOCK-iT') or .block_it puts shrna.report --- 288,292 ---- shrna = Bio::SiRNA::ShRNA.new(pair) ! shrna.design # or .design('BLOCK-iT') or .block_it puts shrna.report *************** *** 208,290 **** end - =begin - - = Bio::SiRNA - - Designing siRNA. - - Input is a Bio::Sequence::NA object (the target sequence). - Output is a list of Bio::SiRNA::Pair object. - - This class implements the selection rules described by Kumiko Ui-Tei - et al. (2004) and Reynolds et al. (2004) - - Kumiko Ui-Tei et al. Guidelines for the selection of highly effective - siRNA sequences for mammalian and chick RNA interference. - Nucl. Acids. Res. 2004 32: 936-948. - - Angela Reynolds et al. Rational siRNA design for RNA interference. - Nature Biotech. 2004 22: 326-330. - - --- Bio::SiRNA.new(seq, antisense_size, max_gc_percent, min_gc_percent) - - --- Bio::SiRNA#design(rule) - - rule can be one of 'uitei' (default) and 'reynolds'. - - --- Bio::SiRNA#uitei - - same as design('uitei') - - --- Bio::SiRNA#reynolds - - same as design('reynolds') - - --- Bio::SiRNA#antisense_size - --- Bio::SiRNA#max_gc_percent - --- Bio::SiRNA#min_gc_percent - - == Bio::SiRNA::Pair - - --- Bio::SiRNA::Pair.new(target, sense, antisense, target_start, target_stop, rule, antisense_gc_percent) - - --- Bio::SiRNA::Pair#target - --- Bio::SiRNA::Pair#sense - --- Bio::SiRNA::Pair#antisense - --- Bio::SiRNA::Pair#start - --- Bio::SiRNA::Pair#stop - --- Bio::SiRNA::Pair#rule - --- Bio::SiRNA::Pair#report - - == Bio::SiRNA::ShRNA - - Input is a Bio::SiRNA::Pair object (the target sequence). - - --- Bio::ShRNA.new(pair) - - --- Bio::ShRNA#design(rule) - - only the 'BLOCK-iT' rule is implemented for now - - --- Bio::ShRNA#block_it(method) - - same as design('BLOCK-iT'). - method can be one of 'piGENE' (default) and 'BLOCK-iT'. - - --- Bio::ShRNA#top_strand - --- Bio::ShRNA#bottom_strand - --- Bio::ShRNA#report - - - === ChangeLog - - 2005/03/21 Itoshi NIKAIDO - Bio::SiRNA#ShRNA_designer method was changed design method. - - 2004/06/25 - Bio::ShRNA class was added. - - 2004/06/17 Itoshi NIKAIDO - We can use shRNA loop sequence from piGene document. - - =end --- 298,299 ---- From nakao at pub.open-bio.org Mon Nov 14 09:53:53 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 14 09:50:22 2005 Subject: [BioRuby-cvs] bioruby README.DEV,1.6,1.7 Message-ID: <200511141453.jAEErrVL027684@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv27674 Modified Files: README.DEV Log Message: * Fix typos. Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** README.DEV 14 Nov 2005 01:34:12 -0000 1.6 --- README.DEV 14 Nov 2005 14:53:51 -0000 1.7 *************** *** 62,66 **** # == Blah blah blah # ! # See http://hoge.db/ for more details on the Hoge databse. # ... blah blah blah ... # --- 62,66 ---- # == Blah blah blah # ! # See http://hoge.db/ for more details on the Hoge database. # ... blah blah blah ... # *************** *** 73,78 **** # == References # ! # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. ! 123:100--123 (2030) # # * http://hoge.db/ --- 73,77 ---- # == References # ! # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) # # * http://hoge.db/ *************** *** 92,98 **** # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ! 02111-1307 USA # # --- 91,97 ---- # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # + #++ # *************** *** 169,175 **** an appropriate directory name when you contribute. ! == Maintainance ! Finally, please maintain the code you've contrubuted. The BioRuby staff is willing to give you CVS privileges if needed. --- 168,174 ---- an appropriate directory name when you contribute. ! == Maintenance ! Finally, please maintain the code you've contributed. The BioRuby staff is willing to give you CVS privileges if needed. From nakao at pub.open-bio.org Mon Nov 14 10:44:33 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 14 10:41:19 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/util sirna.rb,1.5,1.6 Message-ID: <200511141544.jAEFiXVL027866@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv27856/lib/bio/util Modified Files: sirna.rb Log Message: * Updated RDoc. Index: sirna.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/sirna.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sirna.rb 14 Nov 2005 14:47:59 -0000 1.5 --- sirna.rb 14 Nov 2005 15:44:30 -0000 1.6 *************** *** 2,17 **** # = bio/util/sirna.rb - Class for designing small inhibitory RNAs # ! # Copyright:: Copyright (C) 2004, 2005 ! # Itoshi NIKAIDO ! # License:: LGPL # # $Id$ # ! # = Bio::SiRNA - Designing siRNA. # # This class implements the selection rules described by Kumiko Ui-Tei # et al. (2004) and Reynolds et al. (2004). # ! # = Example # # seq = Bio::Sequence::NA.new(ARGF.read) --- 2,17 ---- # = bio/util/sirna.rb - Class for designing small inhibitory RNAs # ! # Copyright:: Copyright (C) 2004, 2005 ! # Itoshi NIKAIDO ! # License:: LGPL # # $Id$ # ! # == Bio::SiRNA - Designing siRNA. # # This class implements the selection rules described by Kumiko Ui-Tei # et al. (2004) and Reynolds et al. (2004). # ! # == Example # # seq = Bio::Sequence::NA.new(ARGF.read) *************** *** 30,34 **** # end # ! # = References # # * Kumiko Ui-Tei et al. Guidelines for the selection of highly effective --- 30,34 ---- # end # ! # == References # # * Kumiko Ui-Tei et al. Guidelines for the selection of highly effective *************** *** 39,54 **** # Nature Biotech. 2004 22: 326-330. # ! # = ChangeLog ! # ! # 2005/03/21 Itoshi NIKAIDO ! # Bio::SiRNA#ShRNA_designer method was changed design method. ! # ! # 2004/06/25 ! # Bio::ShRNA class was added. ! # ! # 2004/06/17 Itoshi NIKAIDO ! # We can use shRNA loop sequence from piGene document. ! # ! # #-- # # This library is free software; you can redistribute it and/or --- 39,43 ---- # Nature Biotech. 2004 22: 326-330. # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 75,78 **** --- 64,70 ---- # = Bio::SiRNA # Designing siRNA. + # + # This class implements the selection rules described by Kumiko Ui-Tei + # et al. (2004) and Reynolds et al. (2004). class SiRNA *************** *** 159,163 **** end ! # == Bio::SiRNA::Pair class Pair --- 151,155 ---- end ! # = Bio::SiRNA::Pair class Pair *************** *** 205,210 **** end # class Pair ! # == Bio::SiRNA::ShRNA ! # Input is a Bio::SiRNA::Pair object (the target sequence). class ShRNA --- 197,203 ---- end # class Pair ! ! # = Bio::SiRNA::ShRNA ! # Designing shRNA. class ShRNA *************** *** 214,223 **** # aBio::Sequence::NA attr_accessor :bottom_strand ! def initialize(pair) @pair = pair end - # only the 'BLOCK-iT' rule is implemented for now. def design(method = 'BLOCK-iT') --- 207,216 ---- # aBio::Sequence::NA attr_accessor :bottom_strand ! ! # Input is a Bio::SiRNA::Pair object (the target sequence). def initialize(pair) @pair = pair end # only the 'BLOCK-iT' rule is implemented for now. def design(method = 'BLOCK-iT') *************** *** 298,299 **** --- 291,306 ---- end + =begin + + = ChangeLog + + 2005/03/21 Itoshi NIKAIDO + Bio::SiRNA#ShRNA_designer method was changed design method. + + 2004/06/25 + Bio::ShRNA class was added. + + 2004/06/17 Itoshi NIKAIDO + We can use shRNA loop sequence from piGene document. + + =end From nakao at pub.open-bio.org Mon Nov 14 10:50:23 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Mon Nov 14 10:46:58 2005 Subject: [BioRuby-cvs] bioruby README.DEV,1.7,1.8 Message-ID: <200511141550.jAEFoNVL027912@pub.open-bio.org> Update of /home/repository/bioruby/bioruby In directory pub.open-bio.org:/tmp/cvs-serv27897 Modified Files: README.DEV Log Message: * Fixed RDoc sample. Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README.DEV 14 Nov 2005 14:53:51 -0000 1.7 --- README.DEV 14 Nov 2005 15:50:21 -0000 1.8 *************** *** 53,60 **** # = bio/db/hoge.rb - Hoge database parser # ! # Copyright:: Copyright (C) 2001, 2005 ! # Bio R. Hacker , ! # Chem R. Hacker ! # License:: LGPL # # $Id$ --- 53,60 ---- # = bio/db/hoge.rb - Hoge database parser # ! # Copyright:: Copyright (C) 2001, 2005 ! # Bio R. Hacker , ! # Chem R. Hacker ! # License:: LGPL # # $Id$ From k at pub.open-bio.org Tue Nov 15 07:43:39 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 07:40:23 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.6,1.7 Message-ID: <200511151243.jAFChdVL031279@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv31273/doc Modified Files: Changes-0.7.rd Log Message: * Constans are renamed to UPPERCASE (incompatible change) Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Changes-0.7.rd 14 Nov 2005 05:49:24 -0000 1.6 --- Changes-0.7.rd 15 Nov 2005 12:43:37 -0000 1.7 *************** *** 68,71 **** --- 68,104 ---- BLAST and FASTA search. + --- Bio::NucleicAcid + + Bio::NucleicAcid::Names and Bio::NucleicAcid::Weight no longer exists. + + Bio::NucleicAcid::Names is renamed to Bio::NucleicAcid::Data::NAMES and + can be accessed by Bio::NucleicAcid#names, Bio::NucleicAcid.names methods + and Bio::NucleicAcid::WEIGHT hash as the Data module is included. + + Bio::NucleicAcid::Weight is renamed to Bio::NucleicAcid::Data::Weight and + can be accessed by Bio::NucleicAcid#weight, Bio::NucleicAcid.weight methods + and Bio::NucleicAcid::WEIGHT hash as the Data module is included. + + --- Bio::AminoAcid + + Bio::AminoAcid::Names and Bio::AminoAcid::Weight no longer exists. + + Bio::AminoAcid::Names is renamed to Bio::AminoAcid::Data::NAMES and + can be accessed by Bio::AminoAcid#names, Bio::AminoAcid.names methods + and Bio::AminoAcid::WEIGHT hash as the Data module is included. + + Bio::AminoAcid::Weight is renamed to Bio::AminoAcid::Data::Weight and + can be accessed by Bio::AminoAcid#weight, Bio::AminoAcid.weight methods + and Bio::AminoAcid::WEIGHT hash as the Data module is included. + + --- Bio::CodonTable + + Bio::CodonTable::Tables, Bio::CodonTable::Definitions, + Bio::CodonTable::Starts, and Bio::CodonTable::Stops + are renamed to + Bio::CodonTable::TABLES, Bio::CodonTable::DEFINITIONS, + Bio::CodonTable::STARTS, and Bio::CodonTable::STOPS + respectively. + --- Bio::KEGG::Microarrays, Bio::KEGG::Microarray From k at pub.open-bio.org Tue Nov 15 07:43:39 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 07:40:50 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb, 0.14, 0.15 codontable.rb, 0.15, 0.16 na.rb, 0.16, 0.17 Message-ID: <200511151243.jAFChdVL031281@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv31273/lib/bio/data Modified Files: aa.rb codontable.rb na.rb Log Message: * Constans are renamed to UPPERCASE (incompatible change) Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.14 retrieving revision 0.15 diff -C2 -d -r0.14 -r0.15 *** aa.rb 14 Nov 2005 02:01:54 -0000 0.14 --- aa.rb 15 Nov 2005 12:43:37 -0000 0.15 *************** *** 37,41 **** # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! Names= { 'A' => 'Ala', --- 37,41 ---- # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! NAMES= { 'A' => 'Ala', *************** *** 96,100 **** # Proteins - Volume 1, CRC Press, Cleveland (1976) ! Weight = { 'A' => 89.09, --- 96,100 ---- # Proteins - Volume 1, CRC Press, Cleveland (1976) ! WEIGHT = { 'A' => 89.09, *************** *** 127,132 **** x.each_byte do |byte| aa = byte.chr.upcase ! if Weight[aa] ! total += Weight[aa] else raise "Error: invalid amino acid '#{aa}'" --- 127,132 ---- x.each_byte do |byte| aa = byte.chr.upcase ! if WEIGHT[aa] ! total += WEIGHT[aa] else raise "Error: invalid amino acid '#{aa}'" *************** *** 135,159 **** total -= NucleicAcid.weight[:water] * (x.length - 1) else ! Weight[x] end else ! Weight end end def [](x) ! Names[x] end # backward compatibility def names ! Names end alias aa names def name(x) ! str = Names[x] if str and str.length == 3 ! Names[str] else str --- 135,159 ---- total -= NucleicAcid.weight[:water] * (x.length - 1) else ! WEIGHT[x] end else ! WEIGHT end end def [](x) ! NAMES[x] end # backward compatibility def names ! NAMES end alias aa names def name(x) ! str = NAMES[x] if str and str.length == 3 ! NAMES[str] else str *************** *** 189,193 **** raise ArgumentError else ! Names[x] end end --- 189,193 ---- raise ArgumentError else ! NAMES[x] end end *************** *** 205,209 **** raise ArgumentError else ! three2name(Names[x]) end end --- 205,209 ---- raise ArgumentError else ! three2name(NAMES[x]) end end *************** *** 222,226 **** raise ArgumentError else ! Names[x] end end --- 222,226 ---- raise ArgumentError else ! NAMES[x] end end *************** *** 244,248 **** def reverse hash = Hash.new ! Names.each do |k, v| hash[v] = k end --- 244,248 ---- def reverse hash = Hash.new ! NAMES.each do |k, v| hash[v] = k end *************** *** 258,266 **** # as class methods extend Data - - - # backward compatibility - Names = Data::Names - Weight = Data::Weight --- 258,261 ---- Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.16 retrieving revision 0.17 diff -C2 -d -r0.16 -r0.17 *** na.rb 14 Nov 2005 01:52:19 -0000 0.16 --- na.rb 15 Nov 2005 12:43:37 -0000 0.17 *************** *** 68,72 **** # * http://www.ncbi.nlm.nih.gov/collab/FT/ ! Names = { 'y' => '[tc]', # pYrimidine --- 68,72 ---- # * http://www.ncbi.nlm.nih.gov/collab/FT/ ! NAMES = { 'y' => '[tc]', # pYrimidine *************** *** 98,102 **** } ! Weight = { # Calculated by BioPerl's Bio::Tools::SeqStats.pm :-) --- 98,102 ---- } ! WEIGHT = { # Calculated by BioPerl's Bio::Tools::SeqStats.pm :-) *************** *** 126,141 **** if x.length > 1 if rna ! phosphate = Weight[:ribose_phosphate] else ! phosphate = Weight[:deoxyribose_phosphate] end ! hydrogen = Weight[:hydrogen] ! water = Weight[:water] total = 0.0 x.each_byte do |byte| base = byte.chr.downcase ! if Weight[base] ! total += Weight[base] + phosphate - hydrogen * 2 else raise "Error: invalid nucleic acid '#{base}'" --- 126,141 ---- if x.length > 1 if rna ! phosphate = WEIGHT[:ribose_phosphate] else ! phosphate = WEIGHT[:deoxyribose_phosphate] end ! hydrogen = WEIGHT[:hydrogen] ! water = WEIGHT[:water] total = 0.0 x.each_byte do |byte| base = byte.chr.downcase ! if WEIGHT[base] ! total += WEIGHT[base] + phosphate - hydrogen * 2 else raise "Error: invalid nucleic acid '#{base}'" *************** *** 144,166 **** total -= water * (x.length - 1) else ! Weight[x.to_s.downcase] end else ! Weight end end def [](x) ! Names[x] end # backward compatibility def names ! Names end alias na names def name(x) ! Names[x.to_s.upcase] end --- 144,166 ---- total -= water * (x.length - 1) else ! WEIGHT[x.to_s.downcase] end else ! WEIGHT end end def [](x) ! NAMES[x] end # backward compatibility def names ! NAMES end alias na names def name(x) ! NAMES[x.to_s.upcase] end *************** *** 168,172 **** str = "" seq.to_s.downcase.each_byte do |base| ! if re = Names[base.chr] str += re else --- 168,172 ---- str = "" seq.to_s.downcase.each_byte do |base| ! if re = NAMES[base.chr] str += re else *************** *** 188,195 **** # as class methods extend Data - - # backward compatibility - Names = Data::Names - Weight = Data::Weight end --- 188,191 ---- Index: codontable.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/codontable.rb,v retrieving revision 0.15 retrieving revision 0.16 diff -C2 -d -r0.15 -r0.16 *** codontable.rb 14 Nov 2005 02:01:54 -0000 0.15 --- codontable.rb 15 Nov 2005 12:43:37 -0000 0.16 *************** *** 69,77 **** # hard coded codon tables in this class as a Bio::CodonTable object. def self.[](i) ! hash = Tables[i] raise "ERROR: Unknown codon table No.#{i}" unless hash ! definition = Definitions[i] ! start = Starts[i] ! stop = Stops[i] self.new(hash, definition, start, stop) end --- 69,77 ---- # hard coded codon tables in this class as a Bio::CodonTable object. def self.[](i) ! hash = TABLES[i] raise "ERROR: Unknown codon table No.#{i}" unless hash ! definition = DEFINITIONS[i] ! start = STARTS[i] ! stop = STOPS[i] self.new(hash, definition, start, stop) end *************** *** 179,183 **** private :generate_stop ! Definitions = { 1 => "Standard (Eukaryote)", --- 179,183 ---- private :generate_stop ! DEFINITIONS = { 1 => "Standard (Eukaryote)", *************** *** 202,206 **** ! Starts = { 1 => %w(ttg ctg atg gtg), # gtg added (cf. NCBI #SG1 document) 2 => %w(att atc ata atg gtg), --- 202,206 ---- ! STARTS = { 1 => %w(ttg ctg atg gtg), # gtg added (cf. NCBI #SG1 document) 2 => %w(att atc ata atg gtg), *************** *** 223,227 **** ! Stops = { 1 => %w(taa tag tga), 2 => %w(taa tag aga agg), --- 223,227 ---- ! STOPS = { 1 => %w(taa tag tga), 2 => %w(taa tag aga agg), *************** *** 244,248 **** ! Tables = { # codon table 1 --- 244,248 ---- ! TABLES = { # codon table 1 From k at pub.open-bio.org Tue Nov 15 07:50:27 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 07:46:50 2005 Subject: [BioRuby-cvs] bioruby/lib/bio extend.rb,1.2,NONE Message-ID: <200511151250.jAFCoRVL031342@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv31331/lib/bio Removed Files: extend.rb Log Message: * lib/bio/extend is removed (some functionality is moved to the bioruby shell) --- extend.rb DELETED --- From k at pub.open-bio.org Tue Nov 15 07:50:27 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 07:46:52 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.7,1.8 Message-ID: <200511151250.jAFCoRVL031345@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv31331/doc Modified Files: Changes-0.7.rd Log Message: * lib/bio/extend is removed (some functionality is moved to the bioruby shell) Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Changes-0.7.rd 15 Nov 2005 12:43:37 -0000 1.7 --- Changes-0.7.rd 15 Nov 2005 12:50:25 -0000 1.8 *************** *** 171,172 **** --- 171,181 ---- and this change will also speeds up loading time if you only need one of the sub classes under the genbank/ or embl/ directory. + + : lib/bio/extend.rb + + This file contained some additional methods to String and Array classes. + The methods added to Array are already included in Ruby itself since the + version 1.8, and the methods added to String are moved to the BioRuby shell + (lib/bio/shell/plugin/seq.rb). + + From k at pub.open-bio.org Tue Nov 15 07:56:41 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 07:53:19 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.7,1.8 Message-ID: <200511151256.jAFCufVL031449@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv31443/lib/bio/shell/plugin Modified Files: seq.rb Log Message: * htmlseq method is added which creates colored sequence using Bio::ColorScheme * to_naseq, to_aaseq, fill, fold methods are added to String class by default in the bioruby shell (moved from lib/bio/extend.rb). Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** seq.rb 14 Nov 2005 02:01:54 -0000 1.7 --- seq.rb 15 Nov 2005 12:56:39 -0000 1.8 *************** *** 28,31 **** --- 28,32 ---- require 'bio/sequence' + require 'bio/util/color_scheme' module Bio::Shell *************** *** 66,69 **** --- 67,100 ---- end + + # Convert sequence to colored HTML string + def htmlseq(str) + if str.instance_of?(String) + s = seq(str) + elsif str.kind_of?(Bio::Sequence) + s = str + end + + if s.is_a?(Bio::Sequence::AA) + scheme = Bio::ColorScheme::Taylor + else + scheme = Bio::ColorScheme::Nucleotide + end + + html = %Q[
\n] + s.fold(50).each_byte do |c| + case c.chr + when "\n" + html += "
\n" + else + color = scheme[c.chr] + html += %Q[#{c.chr}\n] + end + end + html += "
\n" + return html + end + + # Displays some basic properties of the sequence. def seqstat(str) *************** *** 131,133 **** --- 162,230 ---- end + end + + + class String + + def to_naseq + Bio::Sequence::NA.new(self) + end + + def to_aaseq + Bio::Sequence::AA.new(self) + end + + # folding both line end justified + def fold(fill_column = 72, indent = 0) + str = '' + + # size : allowed length of the actual text + unless (size = fill_column - indent) > 0 + raise "[Error] indent > fill_column" + end + + 0.step(self.length - 1, size) do |n| + str << ' ' * indent + self[n, size] + "\n" + end + + return str + end + + # folding with conscious about word boundaries with prefix string + def fill(fill_column = 80, indent = 0, separater = ' ', prefix = '', first_line_only = true) + + # size : allowed length of the actual text + unless (size = fill_column - indent) > 0 + raise "[Error] indent > fill_column" + end + + n = pos = 0 + str = [] + while n < self.length + pos = self[n, size].rindex(separater) + + if self[n, size].length < size # last line of the folded str + pos = nil + end + + if pos + str << self[n, pos+separater.length] + n += pos + separater.length + else # line too long or the last line + str << self[n, size] + n += size + end + end + str = str.join("\n") + + str[0,0] = prefix + ' ' * (indent - prefix.length) + if first_line_only + head = ' ' * indent + else + head = prefix + ' ' * (indent - prefix.length) + end + str.gsub!("\n", "\n#{head}") + + return str.chomp + end end From k at pub.open-bio.org Tue Nov 15 08:33:13 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 08:29:38 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.15,0.16 Message-ID: <200511151333.jAFDXDVL031524@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv31520/lib/bio/data Modified Files: aa.rb Log Message: * trivial change Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.15 retrieving revision 0.16 diff -C2 -d -r0.15 -r0.16 *** aa.rb 15 Nov 2005 12:43:37 -0000 0.15 --- aa.rb 15 Nov 2005 13:33:11 -0000 0.16 *************** *** 37,41 **** # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! NAMES= { 'A' => 'Ala', --- 37,41 ---- # * http://www.chem.qmw.ac.uk/iubmb/newsletter/1999/item3.html ! NAMES = { 'A' => 'Ala', From k at pub.open-bio.org Tue Nov 15 09:49:02 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 09:45:33 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.45,0.46 Message-ID: <200511151449.jAFEn2VL031705@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv31691/lib/bio Modified Files: sequence.rb Log Message: * converted to RDoc * Bio::Sequence::NA#codon_usage method is added Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.45 retrieving revision 0.46 diff -C2 -d -r0.45 -r0.46 *** sequence.rb 5 Nov 2005 08:22:52 -0000 0.45 --- sequence.rb 15 Nov 2005 14:49:00 -0000 0.46 *************** *** 1,8 **** # ! # bio/sequence.rb - biological sequence class # ! # Copyright (C) 2000-2005 KATAYAMA Toshiaki ! # Copyright (C) 2001 Yoshinori K. Okuji ! # Copyright (C) 2003 GOTO Naohisa # # This library is free software; you can redistribute it and/or --- 1,19 ---- # ! # = bio/sequence.rb - biological sequence class # ! # Copyright:: Copyright (C) 2000-2005 ! # Toshiaki Katayama , ! # Yoshinori K. Okuji , ! # Naohisa Goto ! # License:: LGPL ! # ! # $Id$ ! # ! #-- ! # *TODO* remove this functionality? ! # You can use Bio::Seq instead of Bio::Sequence for short. ! #++ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 20,24 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 31,35 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 30,359 **** module Bio ! # Nucleic/Amino Acid sequence ! class Sequence < String ! def self.auto(str) ! moltype = guess(str) ! if moltype == NA ! NA.new(str) ! else ! AA.new(str) ! end end ! def guess(threshold = 0.9) ! cmp = self.composition ! ! bases = cmp['A'] + cmp['T'] + cmp['G'] + cmp['C'] + ! cmp['a'] + cmp['t'] + cmp['g'] + cmp['c'] ! total = self.length - cmp['N'] - cmp['n'] ! if bases.to_f / total > threshold ! return NA ! else ! return AA ! end ! end ! def self.guess(str, *args) ! self.new(str).guess(*args) end ! def to_s ! String.new(self) ! end ! alias to_str to_s ! def seq ! self.class.new(self) ! end ! def normalize! ! initialize(self) ! self ! end ! alias seq! normalize! ! def <<(*arg) ! super(self.class.new(*arg)) ! end ! alias concat << ! def +(*arg) ! self.class.new(super(*arg)) ! end ! def subseq(s = 1, e = self.length) ! return nil if s < 1 or e < 1 ! s -= 1 ! e -= 1 ! self[s..e] end ! def to_fasta(header = '', width = nil) ! ">#{header}\n" + ! if width ! self.to_s.gsub(Regexp.new(".{1,#{width}}"), "\\0\n") ! else ! self.to_s + "\n" end end ! 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 ! def total(hash) ! hash.default = 0.0 unless hash.default ! sum = 0.0 ! self.each_byte do |x| ! begin ! sum += hash[x.chr] ! end ! end ! return sum end ! def composition ! count = Hash.new(0) ! self.scan(/./) do |x| ! count[x] += 1 end ! return count ! end ! def randomize(hash = nil) ! length = self.length ! if hash ! count = hash.clone ! count.each_value {|x| length += x} else ! count = self.composition end ! seq = '' ! tmp = {} ! length.times do ! count.each do |k, v| ! tmp[k] = v * rand ! end ! max = tmp.max {|a, b| a[1] <=> b[1]} ! count[max.first] -= 1 ! if block_given? ! yield max.first ! else ! seq += max.first end end - return self.class.new(seq) end ! def self.randomize(*arg, &block) ! self.new('').randomize(*arg, &block) end # This method depends on Locations class, see bio/location.rb def splicing(position) ! unless position.is_a?(Locations) then ! position = Locations.new(position) ! end ! s = '' ! position.each do |location| ! if location.sequence ! s << location.sequence ! else ! exon = self.subseq(location.from, location.to) ! begin ! exon.complement! if location.strand < 0 ! rescue NameError ! end ! s << exon ! end end ! return self.class.new(s) end ! # Nucleic Acid sequence ! ! class NA < Sequence ! ! def initialize(str) ! super ! self.downcase! ! self.tr!(" \t\n\r",'') ! end ! ! # This method depends on Locations class, see bio/location.rb ! def splicing(position) ! mRNA = super ! if mRNA.rna? ! mRNA.tr!('t', 'u') ! else ! mRNA.tr!('u', 't') ! end ! mRNA ! end ! ! def complement ! s = self.class.new(self) ! s.complement! ! s end ! def complement! ! if self.rna? ! self.reverse! ! self.tr!('augcrymkdhvbswn', 'uacgyrkmhdbvswn') ! else ! self.reverse! ! self.tr!('atgcrymkdhvbswn', 'tacgyrkmhdbvswn') ! end ! self end ! ! def translate(frame = 1, table = 1, unknown = 'X') ! if table.is_a?(Bio::CodonTable) ! ct = table ! else ! ct = Bio::CodonTable[table] ! end ! naseq = self.dna ! case frame ! when 1, 2, 3 ! frame -= 1 ! when 4, 5, 6 ! frame -= 4 ! naseq.complement! ! when -1, -2, -3 ! frame = -1 - frame ! naseq.complement! ! else ! frame = 0 ! end ! nalen = naseq.length - (naseq.length - frame) % 3 ! aaseq = naseq[frame, nalen].gsub(/.{3}/) {|codon| ct[codon] or unknown} ! return Bio::Sequence::AA.new(aaseq) end ! def gc_percent ! count = self.composition ! at = count['a'] + count['t'] + count['u'] ! gc = count['g'] + count['c'] ! gc = 100 * gc / (at + gc) ! return gc end ! def illegal_bases ! self.scan(/[^atgcu]/).sort.uniq ! end ! # NucleicAcid is defined in bio/data/na.rb ! def molecular_weight ! if self.rna? ! NucleicAcid.weight(self, true) ! else ! NucleicAcid.weight(self) ! end ! end ! def to_re ! if self.rna? ! NucleicAcid.to_re(self.dna, true) ! else ! NucleicAcid.to_re(self) ! end end ! def names ! array = [] ! self.each_byte do |x| ! array.push(NucleicAcid.names[x.chr.upcase]) ! end ! return array end ! def dna ! self.tr('u', 't') end ! def dna! ! self.tr!('u', 't') ! end ! def rna ! self.tr('t', 'u') ! end ! def rna! ! self.tr!('t', 'u') ! end ! def rna? ! self.index('u') ! end ! protected :rna? ! def pikachu ! self.dna.tr("atgc", "pika") # joke, of course :-) ! end end - # Amino Acid sequence ! class AA < Sequence ! def initialize(str) ! super ! self.upcase! ! self.tr!(" \t\n\r",'') ! end ! # AminoAcid is defined in bio/data/aa.rb ! def molecular_weight ! AminoAcid.weight(self) ! end ! def to_re ! AminoAcid.to_re(self) ! end ! def codes ! array = [] ! self.each_byte do |x| ! array.push(AminoAcid.names[x.chr]) ! end ! return array ! end ! def names ! self.codes.map do |x| ! AminoAcid.names[x] ! end end end end - class Seq < Sequence - attr_accessor :entry_id, :definition, :features, :references, :comments, - :date, :keywords, :dblinks, :taxonomy, :moltype - end end if __FILE__ == $0 --- 41,444 ---- module Bio ! # Nucleic/Amino Acid sequence ! class Sequence < String ! def self.auto(str) ! moltype = guess(str) ! if moltype == NA ! NA.new(str) ! else ! AA.new(str) end + end ! def guess(threshold = 0.9) ! cmp = self.composition ! bases = cmp['A'] + cmp['T'] + cmp['G'] + cmp['C'] + ! cmp['a'] + cmp['t'] + cmp['g'] + cmp['c'] ! total = self.length - cmp['N'] - cmp['n'] ! if bases.to_f / total > threshold ! return NA ! else ! return AA end + end ! def self.guess(str, *args) ! self.new(str).guess(*args) ! end ! def to_s ! String.new(self) ! end ! alias to_str to_s ! # Force self to re-initialize for clean up (remove white spaces, ! # case unification). ! def seq ! self.class.new(self) ! end ! # Similar to the 'seq' method, but changes the self object destructively. ! def normalize! ! initialize(self) ! self ! end ! alias seq! normalize! ! def <<(*arg) ! super(self.class.new(*arg)) ! end ! alias concat << + def +(*arg) + self.class.new(super(*arg)) + end ! # Returns the subsequence of the self string. ! def subseq(s = 1, e = self.length) ! return nil if s < 1 or e < 1 ! s -= 1 ! e -= 1 ! self[s..e] ! end ! ! # Output the FASTA format string of the sequence. The 1st argument is ! # used as the comment string. If the 2nd option is given, the output ! # sequence will be folded. ! def to_fasta(header = '', width = nil) ! ">#{header}\n" + ! if width ! self.to_s.gsub(Regexp.new(".{1,#{width}}"), "\\0\n") ! else ! self.to_s + "\n" end + end ! # This method iterates on sub string with specified length 'window_size'. ! # By specifing 'step_size', codon sized shifting or spliting genome ! # sequence with ovelapping each end can easily be yielded. ! # ! # The remainder sequence at the terminal end will be returned. ! # ! # Example: ! # # prints average GC% on each 100bp ! # seq.window_search(100) do |subseq| ! # puts subseq.gc ! # end ! # # prints every translated peptide (length 5aa) in the same frame ! # seq.window_search(15, 3) do |subseq| ! # puts subseq.translate ! # end ! # # split genome sequence by 10000bp with 1000bp overlap in fasta format ! # i = 1 ! # remainder = seq.window_search(10000, 9000) do |subseq| ! # puts subseq.to_fasta("segment #{i}", 60) ! # i += 1 ! # end ! # puts remainder.to_fasta("segment #{i}", 60) ! # ! 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 ! ! # This method receive a hash of residues/bases to the particular values, ! # and sum up the value along with the self sequence. Especially useful ! # to use with the window_search method and amino acid indices etc. ! def total(hash) ! hash.default = 0.0 unless hash.default ! sum = 0.0 ! self.each_byte do |x| ! begin ! sum += hash[x.chr] end end + return sum + end ! # Returns a hash of the occurrence counts for each residue or base. ! def composition ! count = Hash.new(0) ! self.scan(/./) do |x| ! count[x] += 1 end + return count + end ! # Returns a randomized sequence keeping its composition by default. ! # The argument is required when generating a random sequence from the empty ! # sequence (used by the class methods NA.randomize, AA.randomize). ! # If the block is given, yields for each random residue/base. ! def randomize(hash = nil) ! length = self.length ! if hash ! count = hash.clone ! count.each_value {|x| length += x} ! else ! count = self.composition end ! seq = '' ! tmp = {} ! length.times do ! count.each do |k, v| ! tmp[k] = v * rand end ! max = tmp.max {|a, b| a[1] <=> b[1]} ! count[max.first] -= 1 ! if block_given? ! yield max.first else ! seq += max.first end + end + return self.class.new(seq) + end ! # Generate a new random sequence with the given frequency of bases ! # or residues. The sequence length is determined by the sum of each ! # base/residue occurences. ! def self.randomize(*arg, &block) ! self.new('').randomize(*arg, &block) ! end ! # Receive a GenBank style position string and convert it to the Locations ! # objects to splice the sequence itself. See also: bio/location.rb ! # ! # This method depends on Locations class, see bio/location.rb ! def splicing(position) ! unless position.is_a?(Locations) then ! position = Locations.new(position) ! end ! s = '' ! position.each do |location| ! if location.sequence ! s << location.sequence ! else ! exon = self.subseq(location.from, location.to) ! begin ! exon.complement! if location.strand < 0 ! rescue NameError end + s << exon end end + return self.class.new(s) + end ! ! # Nucleic Acid sequence ! ! class NA < Sequence ! ! # Generate a nucleic acid sequence object from a string. ! def initialize(str) ! super ! self.downcase! ! self.tr!(" \t\n\r",'') end # This method depends on Locations class, see bio/location.rb def splicing(position) ! mRNA = super ! if mRNA.rna? ! mRNA.tr!('t', 'u') ! else ! mRNA.tr!('u', 't') end ! mRNA end + # Returns a reverse complement sequence (including the universal codes). + def complement + s = self.class.new(self) + s.complement! + s + end ! def complement! ! if self.rna? ! self.reverse! ! self.tr!('augcrymkdhvbswn', 'uacgyrkmhdbvswn') ! else ! self.reverse! ! self.tr!('atgcrymkdhvbswn', 'tacgyrkmhdbvswn') end + self + end ! # Translate into the amino acid sequence from the given frame and the ! # selected codon table. The table also can be a Bio::CodonTable object. ! # The 'unknown' character is used for invalid/unknown codon (can be ! # used for 'nnn' and/or gap translation in practice). ! # ! # Frame can be 1, 2 or 3 for the forward strand and -1, -2 or -3 ! # (4, 5 or 6 is also accepted) for the reverse strand. ! def translate(frame = 1, table = 1, unknown = 'X') ! if table.is_a?(Bio::CodonTable) ! ct = table ! else ! ct = Bio::CodonTable[table] end ! naseq = self.dna ! case frame ! when 1, 2, 3 ! frame -= 1 ! when 4, 5, 6 ! frame -= 4 ! naseq.complement! ! when -1, -2, -3 ! frame = -1 - frame ! naseq.complement! ! else ! frame = 0 end + nalen = naseq.length - (naseq.length - frame) % 3 + aaseq = naseq[frame, nalen].gsub(/.{3}/) {|codon| ct[codon] or unknown} + return Bio::Sequence::AA.new(aaseq) + end ! # Returns counts of the each codon in the sequence by Hash. ! def codon_usage ! hash = Hash.new(0) ! self.window_search(3, 3) do |codon| ! hash[codon] += 1 end + return hash + end ! # Calculate the ratio of GC / ATGC bases in percent. ! def gc_percent ! count = self.composition ! at = count['a'] + count['t'] + count['u'] ! gc = count['g'] + count['c'] ! gc = 100 * gc / (at + gc) ! return gc ! end ! # Show abnormal bases other than 'atgcu'. ! def illegal_bases ! self.scan(/[^atgcu]/).sort.uniq ! end ! # Estimate the weight of this biological string molecule. ! # NucleicAcid is defined in bio/data/na.rb ! def molecular_weight ! if self.rna? ! NucleicAcid.weight(self, true) ! else ! NucleicAcid.weight(self) end + end ! # Convert the universal code string into the regular expression. ! def to_re ! if self.rna? ! NucleicAcid.to_re(self.dna, true) ! else ! NucleicAcid.to_re(self) end + end ! # Convert the self string into the list of the names of the each base. ! def names ! array = [] ! self.each_byte do |x| ! array.push(NucleicAcid.names[x.chr.upcase]) end + return array + end ! # Output a DNA string by substituting 'u' to 't'. ! def dna ! self.tr('u', 't') ! end ! def dna! ! self.tr!('u', 't') ! end ! # Output a RNA string by substituting 't' to 'u'. ! def rna ! self.tr('t', 'u') ! end ! def rna! ! self.tr!('t', 'u') ! end ! def rna? ! self.index('u') ! end ! protected :rna? + def pikachu + self.dna.tr("atgc", "pika") # joke, of course :-) end + end ! # Amino Acid sequence ! class AA < Sequence ! # Generate a amino acid sequence object from a string. ! def initialize(str) ! super ! self.upcase! ! self.tr!(" \t\n\r",'') ! end ! # Estimate the weight of this protein. ! # AminoAcid is defined in bio/data/aa.rb ! def molecular_weight ! AminoAcid.weight(self) ! end ! def to_re ! AminoAcid.to_re(self) ! end ! # Generate the list of the names of the each residue along with the ! # sequence (3 letters code). ! def codes ! array = [] ! self.each_byte do |x| ! array.push(AminoAcid.names[x.chr]) end + return array + end + # Similar to codes but returns long names. + def names + self.codes.map do |x| + AminoAcid.names[x] + end end end + end # Sequence + class Seq < Sequence + attr_accessor :entry_id, :definition, :features, :references, :comments, + :date, :keywords, :dblinks, :taxonomy, :moltype end + end # Bio + + if __FILE__ == $0 *************** *** 488,654 **** end - - =begin - - = Bio::Sequence - - You can use Bio::Seq instead of Bio::Sequence for short. - - --- Bio::Sequence#seq - - Force self to re-initialize for clean up (remove white spaces, - case unification). - - --- Bio::Sequence#seq! - --- Bio::Sequence#normalize! - - Similar to the 'seq' method, but changes the self object destructively. - - --- Bio::Sequence#subseq(start = 1, end = self.length) - - Returns the subsequence of the self string. - - --- Bio::Sequence#to_fasta(header = '', width = nil) - - Output the FASTA format string of the sequence. The 1st argument is - used as the comment string. If the 2nd option is given, the output - sequence will be folded. - - --- Bio::Sequence#fasta(factory, header = '') - - Execute fasta by the factory (Bio::Fasta object) and returns - Bio::Fasta::Report object. See Bio::Fasta for more details. - - --- Bio::Sequence#blast(factory, header = '') - - Execute blast by the factory (Bio::Blast object) and returns - Bio::Blast::Report object. See Bio::Blast for more details. - - --- Bio::Sequence#splicing(position) - - Receive a GenBank style position string and convert it to the Locations - objects to splice the sequence itself. See also: bio/location.rb - - --- Bio::Sequence#window_search(window_size, step_size = 1) - - This method iterates on sub string with specified length 'window_size'. - By specifing 'step_size', codon sized shifting or spliting genome - sequence with ovelapping each end can easily be yielded. - - The remainder sequence at the terminal end will be returned. - - Example: - # prints average GC% on each 100bp - seq.window_search(100) do |subseq| - puts subseq.gc - end - # prints every translated peptide (length 5aa) in the same frame - seq.window_search(15, 3) do |subseq| - puts subseq.translate - end - # split genome sequence by 10000bp with 1000bp overlap in fasta format - i = 1 - remainder = seq.window_search(10000, 9000) do |subseq| - puts subseq.to_fasta("segment #{i}", 60) - i += 1 - end - puts remainder.to_fasta("segment #{i}", 60) - - --- Bio::Sequence#total(hash) - - This method receive a hash of residues/bases to the particular values, - and sum up the value along with the self sequence. Especially useful - to use with the window_search method and amino acid indices etc. - - --- Bio::Sequence#composition - - Returns a hash of the occurrence counts for each residue or base. - - --- Bio::Sequence#randomize(count = nil) - - Returns a randomized sequence keeping its composition by default. - The argument is required when generating a random sequence from the empty - sequence (used by the class methods NA.randomize, AA.randomize). - If the block is given, yields for each random residue/base. - - --- Bio::Sequence.randomize(composition) - - Generate a new random sequence with the given frequency of bases - or residues. The sequence length is determined by the sum of each - base/residue occurences. - - - == Bio::Sequence::NA - - --- Bio::Sequence::NA.new(str) - - Generate a nucleic acid sequence object from a string. - - --- Bio::Sequence::NA#complement - --- Bio::Sequence::NA#complement! - - Returns a reverse complement sequence (including the universal codes). - - --- Bio::Sequence::NA#translate(frame = 1, table = 1, unknown = 'X') - - Translate into the amino acid sequence from the given frame and the - selected codon table. The table also can be a Bio::CodonTable object. - The 'unknown' character is used for invalid/unknown codon (can be - used for 'nnn' and/or gap translation in practice). - - Frame can be 1, 2 or 3 for the forward strand and -1, -2 or -3 - (4, 5 or 6 is also accepted) for the reverse strand. - - --- Bio::Sequence::NA#gc_percent - --- Bio::Sequence::NA#gc - - Calculate the ratio of GC / ATGC bases in percent. - - --- Bio::Sequence::NA#illegal_bases - - Show abnormal bases other than 'atgcu'. - - --- Bio::Sequence::NA#molecular_weight - - Estimate the weight of this biological string molecule. - - --- Bio::Sequence::NA#to_re - - Convert the universal code string into the regular expression. - - --- Bio::Sequence::NA#names - - Convert the self string into the list of the names of the each base. - - --- Bio::Sequence::NA#dna - --- Bio::Sequence::NA#dna! - - Output a DNA string by substituting 'u' to 't'. - - --- Bio::Sequence::NA#rna - --- Bio::Sequence::NA#rna! - - Output a RNA string by substituting 't' to 'u'. - - - == Bio::Sequence::AA - - --- Bio::Sequence::AA.new(str) - - Generate a amino acid sequence object from a string. - - --- Bio::Sequence::AA#codes - - Generate the list of the names of the each residue along with the - sequence (3 letters code). - - --- Bio::Sequence::NA#names - - Similar to codes but returns long names. - - --- Bio::Sequence::AA#molecular_weight - - Estimate the weight of this protein. - - =end --- 573,575 ---- From nakao at pub.open-bio.org Tue Nov 15 09:58:59 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 15 09:55:23 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.46,0.47 Message-ID: <200511151458.jAFEwxVL031764@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv31754/lib/bio Modified Files: sequence.rb Log Message: * Removed TAB. Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.46 retrieving revision 0.47 diff -C2 -d -r0.46 -r0.47 *** sequence.rb 15 Nov 2005 14:49:00 -0000 0.46 --- sequence.rb 15 Nov 2005 14:58:57 -0000 0.47 *************** *** 2,10 **** # = bio/sequence.rb - biological sequence class # ! # Copyright:: Copyright (C) 2000-2005 ! # Toshiaki Katayama , ! # Yoshinori K. Okuji , ! # Naohisa Goto ! # License:: LGPL # # $Id$ --- 2,10 ---- # = bio/sequence.rb - biological sequence class # ! # Copyright:: Copyright (C) 2000-2005 ! # Toshiaki Katayama , ! # Yoshinori K. Okuji , ! # Naohisa Goto ! # License:: LGPL # # $Id$ *************** *** 383,387 **** def pikachu ! self.dna.tr("atgc", "pika") # joke, of course :-) end --- 383,387 ---- def pikachu ! self.dna.tr("atgc", "pika") # joke, of course :-) end From nakao at pub.open-bio.org Tue Nov 15 10:02:54 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 15 09:59:16 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_extend.rb,1.1,NONE Message-ID: <200511151502.jAFF2sVL031823@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv31811/test/unit/bio Removed Files: test_extend.rb Log Message: * Removed. --- test_extend.rb DELETED --- From k at pub.open-bio.org Tue Nov 15 11:42:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 11:39:26 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/util contingency_table.rb,NONE,1.1 Message-ID: <200511151642.jAFGguVL032088@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory pub.open-bio.org:/tmp/cvs-serv32082/lib/bio/util Added Files: contingency_table.rb Log Message: * Contingency table utility contributed by Trevor Wennblom --- NEW FILE: contingency_table.rb --- # # bio/util/contingency_table.rb - Statistical contingency table analysis for aligned sequences # # Copyright (C) 2005 Trevor Wennblom # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: contingency_table.rb,v 1.1 2005/11/15 16:42:54 k Exp $ # module Bio =begin rdoc == Synopsis The Bio::ContingencyTable class provides basic statistical contingency table analysis for two positions within aligned sequences. When ContingencyTable is instantiated the set of characters in the aligned sequences may be passed to it as an array. This is important since it uses these characters to create the table's rows and columns. If this array is not passed it will use it's default of an amino acid and nucleotide alphabet in lowercase along with the clustal spacer '-'. To get data from the table the most used functions will be chi_square and contingency_coefficient: ctable = Bio::ContingencyTable.new() ctable['a']['t'] += 1 # .. put more values into the table puts ctable.chi_square puts ctable.contingency_coefficient # between 0.0 and 1.0 The contingency_coefficient represents the degree of correlation of change between two sequence positions in a multiple-sequence alignment. 0.0 indicates no correlation, 1.0 is the maximum correlation. == Further Reading http://en.wikipedia.org/wiki/Contingency_table http://www.physics.csbsju.edu/stats/exact.details.html Numerical Recipes in C by Press, Flannery, Teukolsky, and Vetterling == Usage What follows is an example of ContingencyTable in typical usage analyzing results from a clustal alignment. require 'bio/contingency_table' require 'bio' seqs = {} max_length = 0 Bio::ClustalW::Report.new( IO.read('sample.aln') ).to_a.each do |entry| data = entry.data.strip seqs[entry.definition] = data.downcase max_length = data.size if max_length == 0 raise "Aligned sequences must be the same length!" unless data.size == max_length end VERBOSE = true puts "i\tj\tchi_square\tcontingency_coefficient" if VERBOSE correlations = {} 0.upto(max_length - 1) do |i| (i+1).upto(max_length - 1) do |j| ctable = Bio::ContingencyTable.new() seqs.each_value { |seq| ctable.table[ seq[i].chr ][ seq[j].chr ] += 1 } chi_square = ctable.chi_square contingency_coefficient = ctable.contingency_coefficient puts [(i+1), (j+1), chi_square, contingency_coefficient].join("\t") if VERBOSE correlations["#{i+1},#{j+1}"] = contingency_coefficient correlations["#{j+1},#{i+1}"] = contingency_coefficient # Both ways are accurate end end require 'yaml' File.new('results.yml', 'a+') { |f| f.puts correlations.to_yaml } == Tutorial ContingencyTable returns the statistical significance of change between two positions in an alignment. If you would like to see how every possible combination of positions in your alignment compares to one another you must set this up yourself. Hopefully the provided examples will help you get started without too much trouble. def lite_example(sequences, max_length, characters) %w{i j chi_square contingency_coefficient}.each { |x| print x.ljust(12) } puts 0.upto(max_length - 1) do |i| (i+1).upto(max_length - 1) do |j| ctable = Bio::ContingencyTable.new( characters ) sequences.each do |seq| i_char = seq[i].chr j_char = seq[j].chr ctable.table[i_char][j_char] += 1 end chi_square = ctable.chi_square contingency_coefficient = ctable.contingency_coefficient [(i+1), (j+1), chi_square, contingency_coefficient].each { |x| print x.to_s.ljust(12) } puts end end end allowed_letters = Array.new allowed_letters = 'abcdefghijk'.split('') seqs = Array.new seqs << 'abcde' seqs << 'abcde' seqs << 'aacje' seqs << 'aacae' length_of_every_sequence = seqs[0].size # 5 letters long lite_example(seqs, length_of_every_sequence, allowed_letters) This produces the following results: i j chi_square contingency_coefficient 1 2 0.0 0.0 1 3 0.0 0.0 1 4 0.0 0.0 1 5 0.0 0.0 2 3 0.0 0.0 2 4 4.0 0.707106781186548 2 5 0.0 0.0 3 4 0.0 0.0 3 5 0.0 0.0 4 5 0.0 0.0 The position i=2 and j=4 has a high contingency coefficient indicating that the changes at these positions are related. Note that i and j are arbitrary, this could be represented as i=4 and j=2 since they both refer to position two and position four in the alignment. Here are some more examples: seqs = Array.new seqs << 'abcde' seqs << 'abcde' seqs << 'aacje' seqs << 'aacae' seqs << 'akcfe' seqs << 'akcfe' length_of_every_sequence = seqs[0].size # 5 letters long lite_example(seqs, length_of_every_sequence, allowed_letters) Results: i j chi_square contingency_coefficient 1 2 0.0 0.0 1 3 0.0 0.0 1 4 0.0 0.0 1 5 0.0 0.0 2 3 0.0 0.0 2 4 12.0 0.816496580927726 2 5 0.0 0.0 3 4 0.0 0.0 3 5 0.0 0.0 4 5 0.0 0.0 Here we can see that the strength of the correlation of change has increased when more data is added with correlated changes at the same positions. seqs = Array.new seqs << 'abcde' seqs << 'abcde' seqs << 'kacje' # changed first letter seqs << 'aacae' seqs << 'akcfa' # changed last letter seqs << 'akcfe' length_of_every_sequence = seqs[0].size # 5 letters long lite_example(seqs, length_of_every_sequence, allowed_letters) Results: i j chi_square contingency_coefficient 1 2 2.4 0.534522483824849 1 3 0.0 0.0 1 4 6.0 0.707106781186548 1 5 0.24 0.196116135138184 2 3 0.0 0.0 2 4 12.0 0.816496580927726 2 5 2.4 0.534522483824849 3 4 0.0 0.0 3 5 0.0 0.0 4 5 2.4 0.534522483824849 With random changes it becomes more difficult to identify correlated changes, yet positions two and four still have the highest correlation as indicated by the contingency coefficient. The best way to improve the accuracy of your results, as is often the case with statistics, is to increase the sample size. == Efficiency ContingencyTable is slow. It involves many calculations for even a seemingly small five-string sequence. Even worse, it's very dependent on matrix traversal, and this is done with two dimensional hashes which just kills any hope of decent speed. Finally, half of the matrix is redundant and positions could be summed with their companion position to reduce calculations. For example the positions (5,2) and (2,5) could both have their values added together and just stored in (2,5) while (5,2) could be an illegal position. Also, positions (1,1), (2,2), (3,3), etc. will never be used. The purpose of this package is flexibility and education. The code is short and to the point in aims of achieving that purpose. If the BioRuby project moves towards C extensions in the future a professional caliber version will likely be created. == Author Trevor Wennblom == Copyright Copyright (C) 2005 Trevor Wennblom Licensed under the same terms as BioRuby. =end class ContingencyTable # Since we're making this math-notation friendly here is the layout of @table: # @table[row][column] # @table[i][j] # @table[y][x] attr_accessor :table attr_reader :characters # Create a ContingencyTable that has characters_in_sequence.size rows and # characters_in_sequence.size columns for each row def initialize(characters_in_sequences = nil) @characters = ( characters_in_sequences or %w{a c d e f g h i k l m n p q r s t v w y - x u} ) tmp = Hash[*@characters.collect { |v| [v, 0] }.flatten] @table = Hash[*@characters.collect { |v| [v, tmp.dup] }.flatten] end # Report the sum of all values in a given row def row_sum(i) total = 0 @table[i].each { |k, v| total += v } total end # Report the sum of all values in a given column def column_sum(j) total = 0 @table.each { |row_key, column| total += column[j] } total end # Report the sum of all values in all columns. # This is the same thing as asking for the sum of all values in the table. def column_sum_all total = 0 @characters.each { |j| total += column_sum(j) } total end # Report the sum of all values in all rows. # This is the same thing as asking for the sum of all values in the table. def row_sum_all total = 0 @characters.each { |i| total += row_sum(i) } total end alias table_sum_all row_sum_all # e(sub:ij) = (r(sub:i)/N) * (c(sub:j)) def expected(i, j) (row_sum(i).to_f / table_sum_all) * column_sum(j) end # Report the chi square of the entire table def chi_square total = 0 c = @characters max = c.size - 1 @characters.each do |i| # Loop through every row in the ContingencyTable @characters.each do |j| # Loop through every column in the ContingencyTable total += chi_square_element(i, j) end end total end # Report the chi square relation of two elements in the table def chi_square_element(i, j) eij = expected(i, j) return 0 if eij == 0 ( @table[i][j] - eij )**2 / eij end # Report the contingency coefficient of the table def contingency_coefficient c_s = chi_square Math.sqrt(c_s / (table_sum_all + c_s) ) end end end From k at pub.open-bio.org Tue Nov 15 11:42:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 11:39:43 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/util test_contingency_table.rb, NONE, 1.1 Message-ID: <200511151642.jAFGguVL032090@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/util In directory pub.open-bio.org:/tmp/cvs-serv32082/test/unit/bio/util Added Files: test_contingency_table.rb Log Message: * Contingency table utility contributed by Trevor Wennblom --- NEW FILE: test_contingency_table.rb --- # # test/unit/bio/util/test_contingency_table.rb - Unit test for Bio::ContingencyTable # # Copyright (C) 2005 Trevor Wennblom # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: test_contingency_table.rb,v 1.1 2005/11/15 16:42:54 k Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4 , 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/util/contingency_table' module Bio class TestContingencyTable < Test::Unit::TestCase def lite_example(sequences, max_length, characters) output = [] 0.upto(max_length - 1) do |i| (i+1).upto(max_length - 1) do |j| ctable = Bio::ContingencyTable.new( characters ) sequences.each do |seq| i_char = seq[i].chr j_char = seq[j].chr ctable.table[i_char][j_char] += 1 end chi_square = ctable.chi_square contingency_coefficient = ctable.contingency_coefficient output << [(i+1), (j+1), chi_square, contingency_coefficient] end end return output end def test_lite_example ctable = Bio::ContingencyTable allowed_letters = 'abcdefghijk'.split('') seqs = Array.new seqs << 'abcde' seqs << 'abcde' seqs << 'kacje' seqs << 'aacae' seqs << 'akcfa' seqs << 'akcfe' length_of_every_sequence = seqs[0].size # 5 letters long results = lite_example(seqs, length_of_every_sequence, allowed_letters) =begin i j chi_square contingency_coefficient 1 2 2.4 0.534522483824849 1 3 0.0 0.0 1 4 6.0 0.707106781186548 1 5 0.24 0.196116135138184 2 3 0.0 0.0 2 4 12.0 0.816496580927726 2 5 2.4 0.534522483824849 3 4 0.0 0.0 3 5 0.0 0.0 4 5 2.4 0.534522483824849 =end #assert_equal(results[0][2], 2.4) assert_equal(results[0][2].to_s, '2.4') assert_equal(results[0][3].to_s, '0.534522483824849') assert_equal(results[5][2].to_s, '12.0') assert_equal(results[5][3].to_s, '0.816496580927726') assert_equal(results[9][2].to_s, '2.4') assert_equal(results[9][3].to_s, '0.534522483824849') ctable = Bio::ContingencyTable.new ctable.table['a']['t'] = 4 ctable.table['a']['g'] = 2 ctable.table['g']['t'] = 3 assert_equal(ctable.chi_square.to_s, '1.28571428571429') assert_equal(ctable.row_sum_all, ctable.column_sum_all) assert_equal(ctable.table_sum_all, ctable.column_sum_all) end end end From k at pub.open-bio.org Tue Nov 15 23:01:12 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 22:57:39 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin flatfile.rb,1.5,1.6 Message-ID: <200511160401.jAG41CVL001434@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv1421/plugin Modified Files: flatfile.rb Log Message: * flatfile method is added (similar to flatauto but returns raw entry) * save_fasta method is renamed to flatfasta * parse method is added which parse the entry string to obj by autodetection * flatindex/flatsearch is changed to ask and uses USERDIR when SAVEDIR is not available Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** flatfile.rb 14 Nov 2005 02:01:54 -0000 1.5 --- flatfile.rb 16 Nov 2005 04:01:10 -0000 1.6 *************** *** 33,36 **** --- 33,53 ---- private + def flatfile(filename) + if block_given? + Bio::FlatFile.auto(filename) do |flat| + flat.each do |entry| + yield flat.entry_raw + end + end + else + entry = '' + Bio::FlatFile.auto(filename) do |flat| + flat.next_entry + entry = flat.entry_raw + end + return entry + end + end + def flatauto(filename) if block_given? *************** *** 41,52 **** end else ! flat = Bio::FlatFile.auto(filename) ! entry = flat.next_entry ! flat.close return entry end end ! def save_fasta(fastafile, *flatfiles) puts "Saving fasta file (#{fastafile}) ... " File.open(fastafile, "w") do |fasta| --- 58,76 ---- end else ! entry = '' ! Bio::FlatFile.auto(filename) do |flat| ! entry = flat.next_entry ! end return entry end end ! def parse(entry) ! if cls = Bio::FlatFile.autodetect(entry) ! return cls.new(entry) ! end ! end ! ! def flatfasta(fastafile, *flatfiles) puts "Saving fasta file (#{fastafile}) ... " File.open(fastafile, "w") do |fasta| *************** *** 65,80 **** def flatindex(dbname, *flatfiles) ! prefix = Core::SAVEDIR + Core::BIOFLAT ! unless File.directory?(prefix) ! Bio::Shell.create_save_dir ! end ! dir = prefix + dbname.to_s ! bdb = format = options = nil begin ! print "Creating BioFlat index (#{dir}) ... " ! Bio::FlatFileIndex.makeindex(bdb, dir, format, options, *flatfiles) puts "done" rescue ! raise "Failed to create index (#{dir}) : #{$!}" end end --- 89,101 ---- def flatindex(dbname, *flatfiles) ! prefix = Bio::Shell.create_save_dir + Core::BIOFLAT ! idxdir = prefix + dbname.to_s begin ! print "Creating BioFlat index (#{idxdir}) ... " ! bdb = format = options = nil ! Bio::FlatFileIndex.makeindex(bdb, idxdir, format, options, *flatfiles) puts "done" rescue ! raise "Failed to create index (#{idxdir}) : #{$!}" end end *************** *** 82,85 **** --- 103,107 ---- def flatsearch(dbname, keyword) dir = Core::SAVEDIR + Core::BIOFLAT + dbname.to_s + dir = Core::USERDIR + Core::BIOFLAT + dbname.to_s unless File.exists?(dir) Bio::FlatFileIndex.open(dir) do |db| if results = db.include?(keyword) From k at pub.open-bio.org Tue Nov 15 23:03:25 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 15 22:59:47 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.8,1.9 Message-ID: <200511160403.jAG43PVL001482@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv1478/plugin Modified Files: seq.rb Log Message: * Bio::Sequence object go through seq() methods faster * changed to use parse() method in plugin/flatfile.rb * sequence is folded in seqstat method Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** seq.rb 15 Nov 2005 12:56:39 -0000 1.8 --- seq.rb 16 Nov 2005 04:03:23 -0000 1.9 *************** *** 40,51 **** # * ID -- "embl:BUM" (entry is retrieved by the OBDA) def seq(arg) ! if arg.respond_to?(:gets) or File.exists?(arg) entry = flatauto(arg) elsif arg[/:/] db, entry_id = arg.split(/:/) str = obda_get_entry(db, entry_id) ! if cls = Bio::FlatFile.autodetect(str) ! entry = cls.new(str) ! end else tmp = arg --- 40,51 ---- # * ID -- "embl:BUM" (entry is retrieved by the OBDA) def seq(arg) ! if arg.kind_of?(Bio::Sequence) ! s = arg ! elsif arg.respond_to?(:gets) or File.exists?(arg) entry = flatauto(arg) elsif arg[/:/] db, entry_id = arg.split(/:/) str = obda_get_entry(db, entry_id) ! entry = parse(str) else tmp = arg *************** *** 70,80 **** # Convert sequence to colored HTML string def htmlseq(str) ! if str.instance_of?(String) ! s = seq(str) ! elsif str.kind_of?(Bio::Sequence) ! s = str end ! if s.is_a?(Bio::Sequence::AA) scheme = Bio::ColorScheme::Taylor else --- 70,80 ---- # Convert sequence to colored HTML string def htmlseq(str) ! if str.kind_of?(Bio::Sequence) ! seq = str ! else ! seq = seq(str) end ! if seq.is_a?(Bio::Sequence::AA) scheme = Bio::ColorScheme::Taylor else *************** *** 83,87 **** html = %Q[
\n] ! s.fold(50).each_byte do |c| case c.chr when "\n" --- 83,87 ---- html = %Q[
\n] ! seq.fold(50).each_byte do |c| case c.chr when "\n" *************** *** 102,124 **** rep = "" if seq.respond_to?(:complement) ! rep << "Sequence : #{seq}\n" ! rep << "Reverse complement : #{seq.complement}\n" ! rep << "Translation 1 : #{seq.translate}\n" ! rep << "Translation 2 : #{seq.translate(2)}\n" ! rep << "Translation 3 : #{seq.translate(3)}\n" ! rep << "Translation -1 : #{seq.translate(-1)}\n" ! rep << "Translation -2 : #{seq.translate(-2)}\n" ! rep << "Translation -3 : #{seq.translate(-3)}\n" rep << "GC percent : #{seq.gc_percent} %\n" rep << "Composition : #{seq.composition.inspect}\n" begin rep << "Molecular weight : #{seq.molecular_weight}\n" rep << "Complemnet weight : #{seq.complement.molecular_weight}\n" rep << "Protein weight : #{seq.translate.molecular_weight}\n" rescue ! rep << "Molecular weight : #{$!}\n" end else ! rep << "Sequence : #{seq}\n" rep << "Composition : #{seq.composition.inspect}\n" begin --- 102,132 ---- rep = "" if seq.respond_to?(:complement) ! rep << "Sequence : #{seq.fold(71,21).strip}\n" ! rep << "Reverse complement : #{seq.complement.fold(71,21).strip}\n" ! rep << "Translation 1 : #{seq.translate.fold(71,21).strip}\n" ! rep << "Translation 2 : #{seq.translate(2).fold(71,21).strip}\n" ! rep << "Translation 3 : #{seq.translate(3).fold(71,21).strip}\n" ! rep << "Translation -1 : #{seq.translate(-1).fold(71,21).strip}\n" ! rep << "Translation -2 : #{seq.translate(-2).fold(71,21).strip}\n" ! rep << "Translation -3 : #{seq.translate(-3).fold(71,21).strip}\n" rep << "GC percent : #{seq.gc_percent} %\n" rep << "Composition : #{seq.composition.inspect}\n" begin rep << "Molecular weight : #{seq.molecular_weight}\n" + rescue + rep << "Molecular weight : #{$!}\n" + end + begin rep << "Complemnet weight : #{seq.complement.molecular_weight}\n" + rescue + rep << "Complement weight : #{$!}\n" + end + begin rep << "Protein weight : #{seq.translate.molecular_weight}\n" rescue ! rep << "Protein weight : #{$!}\n" end else ! rep << "Sequence : #{seq.fold(71,21).strip}\n" rep << "Composition : #{seq.composition.inspect}\n" begin From k at pub.open-bio.org Mon Nov 21 19:33:01 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 21 19:28:43 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.47,0.48 Message-ID: <200511220033.jAM0X1VL011013@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv11009/lib/bio Modified Files: sequence.rb Log Message: * added forward_complement(!) and reverse_complement(!) methods * changed complement(!) methods to aliases of reverse_complement(!) methods Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.47 retrieving revision 0.48 diff -C2 -d -r0.47 -r0.48 *** sequence.rb 15 Nov 2005 14:58:57 -0000 0.47 --- sequence.rb 22 Nov 2005 00:32:59 -0000 0.48 *************** *** 46,50 **** def self.auto(str) ! moltype = guess(str) if moltype == NA NA.new(str) --- 46,50 ---- def self.auto(str) ! moltype = self.guess(str) if moltype == NA NA.new(str) *************** *** 259,279 **** end ! # Returns a reverse complement sequence (including the universal codes). ! def complement s = self.class.new(self) ! s.complement! s end ! def complement! if self.rna? - self.reverse! self.tr!('augcrymkdhvbswn', 'uacgyrkmhdbvswn') else - self.reverse! self.tr!('atgcrymkdhvbswn', 'tacgyrkmhdbvswn') end self end # Translate into the amino acid sequence from the given frame and the --- 259,296 ---- end ! # Returns complement sequence without reversing ("atgc" -> "tacg") ! def forward_complement s = self.class.new(self) ! s.forward_complement! s end ! # Convert to complement sequence without reversing ("atgc" -> "tacg") ! def forward_complement! if self.rna? self.tr!('augcrymkdhvbswn', 'uacgyrkmhdbvswn') else self.tr!('atgcrymkdhvbswn', 'tacgyrkmhdbvswn') end self end + + # Returns reverse complement sequence ("atgc" -> "gcat") + def reverse_complement + s = self.class.new(self) + s.reverse_complement! + s + end + + # Convert to reverse complement sequence ("atgc" -> "gcat") + def reverse_complement! + self.reverse! + self.forward_complement! + end + + # Aliases for short + alias complement reverse_complement + alias complement! reverse_complement! + # Translate into the amino acid sequence from the given frame and the From nakao at pub.open-bio.org Tue Nov 22 03:31:50 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 22 03:27:41 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl/genscan test_report.rb, 1.1, 1.2 Message-ID: <200511220831.jAM8VoVL011846@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/genscan In directory pub.open-bio.org:/tmp/cvs-serv11824/test/unit/bio/appl/genscan Modified Files: test_report.rb Log Message: * Fixed the order of arguments of assert_equal method. Index: test_report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/genscan/test_report.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_report.rb 31 Oct 2005 16:27:46 -0000 1.1 --- test_report.rb 22 Nov 2005 08:31:47 -0000 1.2 *************** *** 42,78 **** def test_genscan_version ! assert_equal(@obj.genscan_version, '1.0') end def test_date_run ! assert_equal(@obj.date_run, '30-May-103') end def test_time ! assert_equal(@obj.time, "14:06:28") end def test_query_name ! assert_equal(@obj.query_name, 'HUMRASH') end def test_length ! assert_equal(@obj.length, 12942) end def test_gccontent ! assert_equal(@obj.gccontent, 68.17) end def test_isochore ! assert_equal(@obj.isochore, '4 (57 - 100 C+G%)') end def test_matrix ! assert_equal(@obj.matrix, 'HumanIso.smat') end def test_predictions_size ! assert_equal(@obj.predictions.size, 2) end --- 42,78 ---- def test_genscan_version ! assert_equal('1.0', @obj.genscan_version) end def test_date_run ! assert_equal('30-May-103', @obj.date_run) end def test_time ! assert_equal("14:06:28", @obj.time) end def test_query_name ! assert_equal('HUMRASH', @obj.query_name) end def test_length ! assert_equal(12942, @obj.length) end def test_gccontent ! assert_equal(68.17, @obj.gccontent) end def test_isochore ! assert_equal('4 (57 - 100 C+G%)', @obj.isochore) end def test_matrix ! assert_equal('HumanIso.smat', @obj.matrix) end def test_predictions_size ! assert_equal(2, @obj.predictions.size) end *************** *** 90,120 **** def test_number ! assert_equal(@obj.first.number, 1) end def test_aaseq ! assert_equal(@obj.first.aaseq.class, Bio::FastaFormat) seq = "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAGQEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDLAARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPGCMSCKCVLS" ! assert_equal(@obj.first.aaseq.seq, seq) definition = "HUMRASH|GENSCAN_predicted_peptide_1|189_aa" ! assert_equal(@obj.first.aaseq.definition, definition) end def test_naseq ! assert_equal(@obj.first.naseq.class, Bio::FastaFormat) seq = "atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgaccatccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctaccggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggccaggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgtgtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatcaaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctggctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccctacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtgcgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggctgcatgagctgcaagtgtgtgctctcctga" ! assert_equal(@obj.first.naseq.seq, seq) definition = "HUMRASH|GENSCAN_predicted_CDS_1|570_bp" ! assert_equal(@obj.first.naseq.definition, definition) end def test_promoter ! assert_equal(@obj.last.promoter.class, Bio::Genscan::Report::Exon) ! assert_equal(@obj.last.promoter.exon_type, "Prom") end def test_polyA ! assert_equal(@obj.first.polyA.class, Bio::Genscan::Report::Exon) ! assert_equal(@obj.first.polyA.exon_type, 'PlyA') end --- 90,120 ---- def test_number ! assert_equal(1, @obj.first.number) end def test_aaseq ! assert_equal(Bio::FastaFormat, @obj.first.aaseq.class) seq = "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAGQEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDLAARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPGCMSCKCVLS" ! assert_equal(seq, @obj.first.aaseq.seq) definition = "HUMRASH|GENSCAN_predicted_peptide_1|189_aa" ! assert_equal(definition, @obj.first.aaseq.definition) end def test_naseq ! assert_equal(Bio::FastaFormat, @obj.first.naseq.class) seq = "atgacggaatataagctggtggtggtgggcgccggcggtgtgggcaagagtgcgctgaccatccagctgatccagaaccattttgtggacgaatacgaccccactatagaggattcctaccggaagcaggtggtcattgatggggagacgtgcctgttggacatcctggataccgccggccaggaggagtacagcgccatgcgggaccagtacatgcgcaccggggagggcttcctgtgtgtgtttgccatcaacaacaccaagtcttttgaggacatccaccagtacagggagcagatcaaacgggtgaaggactcggatgacgtgcccatggtgctggtggggaacaagtgtgacctggctgcacgcactgtggaatctcggcaggctcaggacctcgcccgaagctacggcatcccctacatcgagacctcggccaagacccggcagggagtggaggatgccttctacacgttggtgcgtgagatccggcagcacaagctgcggaagctgaaccctcctgatgagagtggccccggctgcatgagctgcaagtgtgtgctctcctga" ! assert_equal(seq, @obj.first.naseq.seq) definition = "HUMRASH|GENSCAN_predicted_CDS_1|570_bp" ! assert_equal(definition, @obj.first.naseq.definition) end def test_promoter ! assert_equal(Bio::Genscan::Report::Exon, @obj.last.promoter.class) ! assert_equal("Prom", @obj.last.promoter.exon_type) end def test_polyA ! assert_equal(Bio::Genscan::Report::Exon, @obj.first.polyA.class) ! assert_equal('PlyA', @obj.first.polyA.exon_type) end *************** *** 132,192 **** def test_number ! assert_equal(@obj.number, 1) end def test_exon_type ! assert_equal(@obj.exon_type, 'Init') end def test_exon_type_long ! assert_equal(@obj.exon_type_long, 'Initial exon') end def test_strand ! assert_equal(@obj.strand, '+') end def test_first ! assert_equal(@obj.first, 1664) end def test_last ! assert_equal(@obj.last, 1774) end def test_range ! assert_equal(@obj.range, 1664..1774) end def test_phase ! assert_equal(@obj.phase, '0') end def test_acceptor_score ! assert_equal(@obj.acceptor_score, 94) end def test_donor_score ! assert_equal(@obj.donor_score, 83) end def test_initiation_score ! assert_equal(@obj.initiation_score, 94) end def test_termination_score ! assert_equal(@obj.termination_score, 83) end def test_score ! assert_equal(@obj.score, 212) end def test_p_value ! assert_equal(@obj.p_value, 0.997) end def test_t_score ! assert_equal(@obj.t_score, 21.33) end --- 132,192 ---- def test_number ! assert_equal(1, @obj.number) end def test_exon_type ! assert_equal('Init', @obj.exon_type) end def test_exon_type_long ! assert_equal('Initial exon', @obj.exon_type_long) end def test_strand ! assert_equal('+', @obj.strand) end def test_first ! assert_equal(1664, @obj.first) end def test_last ! assert_equal(1774, @obj.last) end def test_range ! assert_equal(1664..1774, @obj.range) end def test_phase ! assert_equal('0', @obj.phase) end def test_acceptor_score ! assert_equal(94, @obj.acceptor_score) end def test_donor_score ! assert_equal(83, @obj.donor_score) end def test_initiation_score ! assert_equal(94, @obj.initiation_score) end def test_termination_score ! assert_equal(83, @obj.termination_score) end def test_score ! assert_equal(212, @obj.score) end def test_p_value ! assert_equal(0.997, @obj.p_value) end def test_t_score ! assert_equal(21.33, @obj.t_score) end From nakao at pub.open-bio.org Tue Nov 22 03:31:50 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 22 03:27:53 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl/sosui test_report.rb, 1.2, 1.3 Message-ID: <200511220831.jAM8VoVL011848@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/sosui In directory pub.open-bio.org:/tmp/cvs-serv11824/test/unit/bio/appl/sosui Modified Files: test_report.rb Log Message: * Fixed the order of arguments of assert_equal method. Index: test_report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/sosui/test_report.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_report.rb 31 Oct 2005 17:02:45 -0000 1.2 --- test_report.rb 22 Nov 2005 08:31:48 -0000 1.3 *************** *** 39,47 **** def test_delimiter ! assert_equal(Bio::SOSUI::Report::DELIMITER, "\n>") end def test_rs ! assert_equal(Bio::SOSUI::Report::RS, "\n>") end --- 39,47 ---- def test_delimiter ! assert_equal("\n>", Bio::SOSUI::Report::DELIMITER) end def test_rs ! assert_equal("\n>", Bio::SOSUI::Report::RS) end *************** *** 56,73 **** def test_entry_id ! assert_equal(@obj.entry_id, 'Q9HC19') end def test_prediction ! assert_equal(@obj.prediction, 'MEMBRANE PROTEIN') end def test_tmhs ! assert_equal(@obj.tmhs.class, Array) ! assert_equal(@obj.tmhs[0].class, Bio::SOSUI::Report::TMH) end def test_tmh ! assert_equal(@obj.tmhs.size, 7) end --- 56,73 ---- def test_entry_id ! assert_equal('Q9HC19', @obj.entry_id) end def test_prediction ! assert_equal('MEMBRANE PROTEIN', @obj.prediction) end def test_tmhs ! assert_equal(Array, @obj.tmhs.class) ! assert_equal(Bio::SOSUI::Report::TMH, @obj.tmhs[0].class) end def test_tmh ! assert_equal(7, @obj.tmhs.size) end *************** *** 80,92 **** def test_range ! assert_equal(@obj.range, 31..53) end def test_grade ! assert_equal(@obj.grade, 'SECONDARY') end def test_sequence ! assert_equal(@obj.sequence, 'HIRMTFLRKVYSILSLQVLLTTV') end --- 80,92 ---- def test_range ! assert_equal(31..53, @obj.range) end def test_grade ! assert_equal('SECONDARY', @obj.grade) end def test_sequence ! assert_equal('HIRMTFLRKVYSILSLQVLLTTV', @obj.sequence) end From nakao at pub.open-bio.org Tue Nov 22 03:31:49 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 22 03:28:26 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl/blast test_report.rb, 1.1, 1.2 test_xmlparser.rb, 1.1, 1.2 Message-ID: <200511220831.jAM8VnVL011843@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/blast In directory pub.open-bio.org:/tmp/cvs-serv11824/test/unit/bio/appl/blast Modified Files: test_report.rb test_xmlparser.rb Log Message: * Fixed the order of arguments of assert_equal method. Index: test_xmlparser.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/blast/test_xmlparser.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_xmlparser.rb 28 Oct 2005 02:32:38 -0000 1.1 --- test_xmlparser.rb 22 Nov 2005 08:31:47 -0000 1.2 *************** *** 72,76 **** def test_db ! assert_equal(@report.db, "eco:b0002.faa") end --- 72,76 ---- def test_db ! assert_equal("eco:b0002.faa", @report.db) end *************** *** 311,315 **** def test_num ! assert_equal(@hsp.num, 1) end --- 311,315 ---- def test_num ! assert_equal(1, @hsp.num) end Index: test_report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/blast/test_report.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_report.rb 28 Oct 2005 02:30:57 -0000 1.1 --- test_report.rb 22 Nov 2005 08:31:47 -0000 1.2 *************** *** 63,79 **** def test_parameters ! assert_equal(@report.parameters['matrix'], 'BLOSUM62') ! assert_equal(@report.parameters['expect'], 10) ! assert_equal(@report.parameters['gap-open'], 11) ! assert_equal(@report.parameters['gap-extend'], 1) ! assert_equal(@report.parameters['filter'], 'S') end def test_program ! assert_equal(@report.program, 'blastp') end def test_version ! assert_equal(@report.version, 'blastp 2.2.10 [Oct-19-2004]') end --- 63,79 ---- def test_parameters ! assert_equal('BLOSUM62', @report.parameters['matrix']) ! assert_equal(10, @report.parameters['expect']) ! assert_equal(11, @report.parameters['gap-open']) ! assert_equal(1, @report.parameters['gap-extend']) ! assert_equal('S', @report.parameters['filter']) end def test_program ! assert_equal('blastp', @report.program) end def test_version ! assert_equal('blastp 2.2.10 [Oct-19-2004]', @report.version) end *************** *** 81,110 **** xml_quoted_str = "~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~"Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs", Nucleic Acids Res. 25:3389-3402." text_str = '~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~"Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs", Nucleic Acids Res. 25:3389-3402.' ! assert_equal(@report.reference, xml_quoted_str) ! assert_equal(@report.reference, text_str) end def test_db ! assert_equal(@report.db, 'eco:b0002.faa') end def test_query_id ! assert_equal(@report.query_id, 'lcl|QUERY') end def test_query_def ! assert_equal(@report.query_def, 'eco:b0002 thrA, Hs, thrD, thrA2, thrA1; bifunctional: aspartokinase I (N-terminal); homoserine dehydrogenase I (C-terminal) [EC:2.7.2.4 1.1.1.3]; K00003 homoserine dehydrogenase; K00928 aspartate kinase (A)') end def test_query_len ! assert_equal(@report.query_len, 820) end def test_matrix ! assert_equal(@report.matrix, 'BLOSUM62') end def test_expect ! assert_equal(@report.expect, 10) end --- 81,110 ---- xml_quoted_str = "~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~"Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs", Nucleic Acids Res. 25:3389-3402." text_str = '~Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer, ~Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), ~"Gapped BLAST and PSI-BLAST: a new generation of protein database search~programs", Nucleic Acids Res. 25:3389-3402.' ! assert_equal(xml_quoted_str, @report.reference) ! assert_equal(text_str, @report.reference) end def test_db ! assert_equal('eco:b0002.faa', @report.db) end def test_query_id ! assert_equal('lcl|QUERY', @report.query_id) end def test_query_def ! assert_equal('eco:b0002 thrA, Hs, thrD, thrA2, thrA1; bifunctional: aspartokinase I (N-terminal); homoserine dehydrogenase I (C-terminal) [EC:2.7.2.4 1.1.1.3]; K00003 homoserine dehydrogenase; K00928 aspartate kinase (A)', @report.query_def) end def test_query_len ! assert_equal(820, @report.query_len) end def test_matrix ! assert_equal('BLOSUM62', @report.matrix) end def test_expect ! assert_equal(10, @report.expect) end *************** *** 122,134 **** def test_gap_open ! assert_equal(@report.gap_open, 11) end def test_gap_extend ! assert_equal(@report.gap_extend, 1) end def test_filter ! assert_equal(@report.filter, 'S') end --- 122,134 ---- def test_gap_open ! assert_equal(11, @report.gap_open) end def test_gap_extend ! assert_equal(1, @report.gap_extend) end def test_filter ! assert_equal('S', @report.filter) end *************** *** 154,186 **** def test_statistics ! assert_equal(@report.statistics, {"kappa"=>0.041, "db-num"=>1, "eff-space"=>605284.0, "hsp-len"=>42, "db-len"=>820, "lambda"=>0.267, "entropy"=>0.14}) end def test_db_num ! assert_equal(@report.db_num, 1) end def test_db_len ! assert_equal(@report.db_len, 820) end def test_hsp_len ! assert_equal(@report.hsp_len, 42) end def test_eff_space ! assert_equal(@report.eff_space, 605284) end def test_kappa ! assert_equal(@report.kappa, 0.041) end def test_lambda ! assert_equal(@report.lambda, 0.267) end def test_entropy ! assert_equal(@report.entropy, 0.14) end --- 154,186 ---- def test_statistics ! assert_equal({"kappa"=>0.041, "db-num"=>1, "eff-space"=>605284.0, "hsp-len"=>42, "db-len"=>820, "lambda"=>0.267, "entropy"=>0.14}, @report.statistics) end def test_db_num ! assert_equal(1, @report.db_num) end def test_db_len ! assert_equal(820, @report.db_len) end def test_hsp_len ! assert_equal(42, @report.hsp_len) end def test_eff_space ! assert_equal(605284, @report.eff_space) end def test_kappa ! assert_equal(0.041, @report.kappa) end def test_lambda ! assert_equal(0.267, @report.lambda) end def test_entropy ! assert_equal(0.14, @report.entropy) end *************** *** 192,196 **** class TestBlastReportIteration < Test::Unit::TestCase def setup ! data = Bio::TestBlastData.data report = Bio::Blast::Report.new(data) @itr = report.iterations.first --- 192,196 ---- class TestBlastReportIteration < Test::Unit::TestCase def setup ! data = Bio::TestBlastReportData.output report = Bio::Blast::Report.new(data) @itr = report.iterations.first *************** *** 206,210 **** def test_num ! assert_equal(@itr.num, 1) end --- 206,210 ---- def test_num ! assert_equal(1, @itr.num) end *************** *** 216,220 **** class TestBlastReportHit < Test::Unit::TestCase def setup ! data = Bio::TestBlastData.data report = Bio::Blast::Report.new(data) @hit = report.hits.first --- 216,220 ---- class TestBlastReportHit < Test::Unit::TestCase def setup ! data = Bio::TestBlastReportData.output report = Bio::Blast::Report.new(data) @hit = report.hits.first *************** *** 226,238 **** def test_Hit_query_id ! assert_equal(@hit.query_id, 'lcl|QUERY') end def test_Hit_query_def ! assert_equal(@hit.query_def, 'eco:b0002 thrA, Hs, thrD, thrA2, thrA1; bifunctional: aspartokinase I (N-terminal); homoserine dehydrogenase I (C-terminal) [EC:2.7.2.4 1.1.1.3]; K00003 homoserine dehydrogenase; K00928 aspartate kinase (A)') end def test_Hit_query_len ! assert_equal(@hit.query_len, 820) end --- 226,238 ---- def test_Hit_query_id ! assert_equal('lcl|QUERY', @hit.query_id) end def test_Hit_query_def ! assert_equal('eco:b0002 thrA, Hs, thrD, thrA2, thrA1; bifunctional: aspartokinase I (N-terminal); homoserine dehydrogenase I (C-terminal) [EC:2.7.2.4 1.1.1.3]; K00003 homoserine dehydrogenase; K00928 aspartate kinase (A)', @hit.query_def) end def test_Hit_query_len ! assert_equal(820, @hit.query_len) end *************** *** 242,254 **** def test_Hit_hit_id ! assert_equal(@hit.hit_id, 'gnl|BL_ORD_ID|0') end def test_Hit_len ! assert_equal(@hit.len, 820) end def test_Hit_target_len ! assert_equal(@hit.target_len, 820) end --- 242,254 ---- def test_Hit_hit_id ! assert_equal('gnl|BL_ORD_ID|0', @hit.hit_id) end def test_Hit_len ! assert_equal(820, @hit.len) end def test_Hit_target_len ! assert_equal(820, @hit.target_len) end *************** *** 270,325 **** def test_Hit_evalue ! assert_equal(@hit.evalue, 0) end def test_Hit_bit_score ! assert_equal(@hit.bit_score, 1567.75) end def test_Hit_identity ! assert_equal(@hit.identity, 820) end def test_Hit_overlap ! assert_equal(@hit.overlap, 820) end def test_Hit_query_seq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(@hit.query_seq, seq) end def test_Hit_target_seq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(@hit.target_seq, seq) end def test_Hit_midline seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(@hit.midline, seq) end def test_Hit_query_start ! assert_equal(@hit.query_start, 1) ! # assert_equal(@hit.query_from, 1) end def test_Hit_query_end ! assert_equal(@hit.query_end, 820) ! # assert_equal(@hit.query_to, 820) end def test_Hit_target_start ! assert_equal(@hit.target_start, 1) ! # assert_equal(@hit.hit_from, 1) end def test_Hit_target_end ! assert_equal(@hit.target_end, 820) ! # assert_equal(@hit.hit_to, 820) end def test_Hit_lap_at ! assert_equal(@hit.lap_at, [1, 820, 1, 820]) end end --- 270,325 ---- def test_Hit_evalue ! assert_equal(0, @hit.evalue) end def test_Hit_bit_score ! assert_equal(1567.75, @hit.bit_score) end def test_Hit_identity ! assert_equal(820, @hit.identity) end def test_Hit_overlap ! assert_equal(820, @hit.overlap) end def test_Hit_query_seq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(seq, @hit.query_seq) end def test_Hit_target_seq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(seq, @hit.target_seq) end def test_Hit_midline seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(seq, @hit.midline) end def test_Hit_query_start ! assert_equal(1, @hit.query_start) ! # assert_equal(1, @hit.query_from) end def test_Hit_query_end ! assert_equal(820, @hit.query_end) ! # assert_equal(820, @hit.query_to) end def test_Hit_target_start ! assert_equal(1, @hit.target_start) ! # assert_equal(1, @hit.hit_from) end def test_Hit_target_end ! assert_equal(820, @hit.target_end) ! # assert_equal(820, @hit.hit_to) end def test_Hit_lap_at ! assert_equal([1, 820, 1, 820], @hit.lap_at) end end *************** *** 327,331 **** class TestBlastReportHsp < Test::Unit::TestCase def setup ! data = Bio::TestBlastData.data report = Bio::Blast::Report.new(data) @hsp = report.hits.first.hsps.first --- 327,331 ---- class TestBlastReportHsp < Test::Unit::TestCase def setup ! data = Bio::TestBlastReportData.output report = Bio::Blast::Report.new(data) @hsp = report.hits.first.hsps.first *************** *** 333,353 **** def test_Hsp_num ! assert_equal(@hsp.num, 1) end def test_Hsp_hit_score ! assert_equal(@hsp.bit_score, 1567.75) end def test_Hsp_score ! assert_equal(@hsp.score, 4058) end def test_Hsp_evalue ! assert_equal(@hsp.evalue, 0) end def test_Hsp_identity ! assert_equal(@hsp.identity, 820) end --- 333,353 ---- def test_Hsp_num ! assert_equal(1, @hsp.num) end def test_Hsp_hit_score ! assert_equal(1567.75, @hsp.bit_score) end def test_Hsp_score ! assert_equal(4058, @hsp.score) end def test_Hsp_evalue ! assert_equal(0, @hsp.evalue) end def test_Hsp_identity ! assert_equal(820, @hsp.identity) end *************** *** 357,365 **** def test_Hsp_positive ! assert_equal(@hsp.positive, 820) end def test_Hsp_align_len ! assert_equal(@hsp.align_len, 820) end --- 357,365 ---- def test_Hsp_positive ! assert_equal(820, @hsp.positive) end def test_Hsp_align_len ! assert_equal(820, @hsp.align_len) end *************** *** 369,393 **** def test_Hsp_query_frame ! assert_equal(@hsp.query_frame, 1) end def test_Hsp_query_from ! assert_equal(@hsp.query_from, 1) end def test_Hsp_query_to ! assert_equal(@hsp.query_to, 820) end def test_Hsp_hit_frame ! assert_equal(@hsp.hit_frame, 1) end def test_Hsp_hit_from ! assert_equal(@hsp.hit_from, 1) end def test_Hsp_hit_to ! assert_equal(@hsp.hit_to, 820) end --- 369,393 ---- def test_Hsp_query_frame ! assert_equal(1, @hsp.query_frame) end def test_Hsp_query_from ! assert_equal(1, @hsp.query_from) end def test_Hsp_query_to ! assert_equal(820, @hsp.query_to) end def test_Hsp_hit_frame ! assert_equal(1, @hsp.hit_frame) end def test_Hsp_hit_from ! assert_equal(1, @hsp.hit_from) end def test_Hsp_hit_to ! assert_equal(820, @hsp.hit_to) end *************** *** 402,416 **** def test_Hsp_qseq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(@hsp.qseq, seq) end def test_Hsp_midline seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(@hsp.midline, seq) end def test_Hsp_hseq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(@hsp.hseq, seq) end --- 402,416 ---- def test_Hsp_qseq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(seq, @hsp.qseq) end def test_Hsp_midline seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(seq, @hsp.midline) end def test_Hsp_hseq seq = 'MRVLKFGGTSVANAERFLRVADILESNARQGQVATVLSAPAKITNHLVAMIEKTISGQDALPNISDAERIFAELLTGLAAAQPGFPLAQLKTFVDQEFAQIKHVLHGISLLGQCPDSINAALICRGEKMSIAIMAGVLEARGHNVTVIDPVEKLLAVGHYLESTVDIAESTRRIAASRIPADHMVLMAGFTAGNEKGELVVLGRNGSDYSAAVLAACLRADCCEIWTDVDGVYTCDPRQVPDARLLKSMSYQEAMELSYFGAKVLHPRTITPIAQFQIPCLIKNTGNPQAPGTLIGASRDEDELPVKGISNLNNMAMFSVSGPGMKGMVGMAARVFAAMSRARISVVLITQSSSEYSISFCVPQSDCVRAERAMQEEFYLELKEGLLEPLAVTERLAIISVVGDGMRTLRGISAKFFAALARANINIVAIAQGSSERSISVVVNNDDATTGVRVTHQMLFNTDQVIEVFVIGVGGVGGALLEQLKRQQSWLKNKHIDLRVCGVANSKALLTNVHGLNLENWQEELAQAKEPFNLGRLIRLVKEYHLLNPVIVDCTSSQAVADQYADFLREGFHVVTPNKKANTSSMDYYHQLRYAAEKSRRKFLYDTNVGAGLPVIENLQNLLNAGDELMKFSGILSGSLSYIFGKLDEGMSFSEATTLAREMGYTEPDPRDDLSGMDVARKLLILARETGRELELADIEIEPVLPAEFNAEGDVAAFMANLSQLDDLFAARVAKARDEGKVLRYVGNIDEDGVCRVKIAEVDGNDPLFKVKNGENALAFYSHYYQPLPLVLRGYGAGNDVTAAGVFADLLRTLSWKLGV' ! assert_equal(seq, @hsp.hseq) end From nakao at pub.open-bio.org Tue Nov 22 20:42:40 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 22 20:38:18 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl/targetp test_report.rb, 1.2, 1.3 Message-ID: <200511230142.jAN1geVL014776@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/targetp In directory pub.open-bio.org:/tmp/cvs-serv14766/test/unit/bio/appl/targetp Modified Files: test_report.rb Log Message: * Fixed the order of arguments of assert_equal method. Index: test_report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/targetp/test_report.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_report.rb 31 Oct 2005 17:59:46 -0000 1.2 --- test_report.rb 23 Nov 2005 01:42:38 -0000 1.3 *************** *** 88,96 **** def test_delimiter ! assert_equal(Bio::TargetP::Report::DELIMITER, "\n \n") end def test_rs ! assert_equal(Bio::TargetP::Report::RS, "\n \n") end --- 88,96 ---- def test_delimiter ! assert_equal("\n \n", Bio::TargetP::Report::DELIMITER) end def test_rs ! assert_equal("\n \n", Bio::TargetP::Report::RS) end *************** *** 105,121 **** def test_version ! assert_equal(@obj.version, '1.0') end def test_query_sequences ! assert_equal(@obj.query_sequences, 0) end def test_cleavage_site_prediction ! assert_equal(@obj.cleavage_site_prediction, 'not included') end def test_networks ! assert_equal(@obj.networks, 'PLANT') end --- 105,121 ---- def test_version ! assert_equal('1.0', @obj.version) end def test_query_sequences ! assert_equal(0, @obj.query_sequences) end def test_cleavage_site_prediction ! assert_equal('not included', @obj.cleavage_site_prediction) end def test_networks ! assert_equal('PLANT', @obj.networks) end *************** *** 123,158 **** hash = {"Name"=>"MGI_2141503", "Loc."=>"_", "RC"=>3, "SP"=>0.271, "other"=>0.844, "mTP"=>0.161, "cTP"=>0.031, "Length"=>640} ! assert_equal(@obj.pred, hash) ! assert_equal(@obj.prediction, hash) end def test_cutoff hash = {"SP"=>0.0, "other"=>0.0, "mTP"=>0.0, "cTP"=>0.0} ! assert_equal(@obj.cutoff, hash) end def test_entry_id ! assert_equal(@obj.entry_id, 'MGI_2141503') end def test_name ! assert_equal(@obj.name, 'MGI_2141503') end def test_query_len ! assert_equal(@obj.query_len, 640) end def test_length ! assert_equal(@obj.length, 640) end def test_loc ! assert_equal(@obj.loc, '_') end def test_rc ! assert_equal(@obj.rc, 3) end end # class TestTargetPReport --- 123,158 ---- hash = {"Name"=>"MGI_2141503", "Loc."=>"_", "RC"=>3, "SP"=>0.271, "other"=>0.844, "mTP"=>0.161, "cTP"=>0.031, "Length"=>640} ! assert_equal(hash, @obj.pred) ! assert_equal(hash, @obj.prediction) end def test_cutoff hash = {"SP"=>0.0, "other"=>0.0, "mTP"=>0.0, "cTP"=>0.0} ! assert_equal(hash, @obj.cutoff) end def test_entry_id ! assert_equal('MGI_2141503', @obj.entry_id) end def test_name ! assert_equal('MGI_2141503', @obj.name) end def test_query_len ! assert_equal(640, @obj.query_len) end def test_length ! assert_equal(640, @obj.length) end def test_loc ! assert_equal('_', @obj.loc) end def test_rc ! assert_equal(3, @obj.rc) end end # class TestTargetPReport From nakao at pub.open-bio.org Tue Nov 22 21:47:21 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Tue Nov 22 21:43:02 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl test_blast.rb,1.1,1.2 Message-ID: <200511230247.jAN2lLVL014892@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl In directory pub.open-bio.org:/tmp/cvs-serv14882/test/unit/bio/appl Modified Files: test_blast.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_blast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/test_blast.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_blast.rb 24 Sep 2005 16:38:55 -0000 1.1 --- test_blast.rb 23 Nov 2005 02:47:19 -0000 1.2 *************** *** 62,120 **** def test_new blast = Bio::Blast.new(@program, @db) ! assert_equal(blast.program, @program) ! assert_equal(blast.db, @db) assert(blast.options) ! assert_equal(blast.server, 'local') ! assert_equal(blast.blastall, 'blastall') end def test_new_opt_string blast = Bio::Blast.new(@program, @db, '-m 7 -F F') ! assert_equal(blast.options, ['-m', '7', '-F', 'F']) end def test_program ! assert_equal(@blast.program, @program) end def test_db ! assert_equal(@blast.db, @db) end def test_options ! assert_equal(@blast.options, []) end def test_option ! assert_equal(@blast.option, '') end def test_option_set @blast.option = '-m 7 -p T' ! assert_equal(@blast.option, '-m 7 -p T') end def test_server ! assert_equal(@blast.server, @server) end def test_blastll ! assert_equal(@blast.blastall, 'blastall') end def test_matrix ! assert_equal(@blast.matrix, nil) end def test_filter ! assert_equal(@blast.filter, nil) end def test_parser ! assert_equal(@blast.instance_eval { @parser }, nil) end def test_output ! assert_equal(@blast.output, '') end --- 62,120 ---- def test_new blast = Bio::Blast.new(@program, @db) ! assert_equal(@program, blast.program) ! assert_equal(@db, blast.db) assert(blast.options) ! assert_equal('local', blast.server) ! assert_equal('blastall', blast.blastall) end def test_new_opt_string blast = Bio::Blast.new(@program, @db, '-m 7 -F F') ! assert_equal(['-m', '7', '-F', 'F'], blast.options) end def test_program ! assert_equal(@program, @blast.program) end def test_db ! assert_equal(@db, @blast.db) end def test_options ! assert_equal([], @blast.options) end def test_option ! assert_equal('', @blast.option) end def test_option_set @blast.option = '-m 7 -p T' ! assert_equal('-m 7 -p T', @blast.option) end def test_server ! assert_equal(@server, @blast.server) end def test_blastll ! assert_equal('blastall', @blast.blastall) end def test_matrix ! assert_equal(nil, @blast.matrix) end def test_filter ! assert_equal(nil, @blast.filter) end def test_parser ! assert_equal(nil, @blast.instance_eval { @parser }) end def test_output ! assert_equal('', @blast.output) end From nakao at pub.open-bio.org Wed Nov 23 00:10:36 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 00:06:11 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl/tmhmm test_report.rb, 1.1, 1.2 Message-ID: <200511230510.jAN5AaVL015328@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl/tmhmm In directory pub.open-bio.org:/tmp/cvs-serv15316/test/unit/bio/appl/tmhmm Modified Files: test_report.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/appl/tmhmm/test_report.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_report.rb 1 Nov 2005 05:13:57 -0000 1.1 --- test_report.rb 23 Nov 2005 05:10:34 -0000 1.2 *************** *** 49,83 **** def test_entry_id ! assert_equal(@obj.entry_id, 'O42385') end def test_query_len ! assert_equal(@obj.query_len, 423) end def test_predicted_tmhs ! assert_equal(@obj.predicted_tmhs, 7) end def test_tmhs ! assert_equal(@obj.tmhs.class, Array) ! assert_equal(@obj.tmhs.size, 15) end def test_exp_aas_in_tmhs ! assert_equal(@obj.exp_aas_in_tmhs, 157.40784) end def test_exp_first_60aa ! assert_equal(@obj.exp_first_60aa, 13.85627) end def test_total_prob_of_N_in ! assert_equal(@obj.total_prob_of_N_in, 0.00993) end def test_helix ! assert_equal(@obj.helix.size, 7) ! assert_equal(@obj.helix[0].class, Bio::TMHMM::TMH) end --- 49,83 ---- def test_entry_id ! assert_equal('O42385', @obj.entry_id) end def test_query_len ! assert_equal(423, @obj.query_len) end def test_predicted_tmhs ! assert_equal(7, @obj.predicted_tmhs) end def test_tmhs ! assert_equal(Array, @obj.tmhs.class) ! assert_equal(15, @obj.tmhs.size) end def test_exp_aas_in_tmhs ! assert_equal(157.40784, @obj.exp_aas_in_tmhs) end def test_exp_first_60aa ! assert_equal(13.85627, @obj.exp_first_60aa) end def test_total_prob_of_N_in ! assert_equal(0.00993, @obj.total_prob_of_N_in) end def test_helix ! assert_equal(7, @obj.helix.size) ! assert_equal(Bio::TMHMM::TMH, @obj.helix[0].class) end *************** *** 103,107 **** "O42385\tTMHMM2.0\tTMhelix\t381\t403", "O42385\tTMHMM2.0\tinside\t404\t423"].join("\n") ! assert_equal(@obj.to_s, str) end --- 103,107 ---- "O42385\tTMHMM2.0\tTMhelix\t381\t403", "O42385\tTMHMM2.0\tinside\t404\t423"].join("\n") ! assert_equal(str, @obj.to_s) end *************** *** 115,135 **** def test_entry_id ! assert_equal(@obj.entry_id, 'O42385') end def test_version ! assert_equal(@obj.version, 'TMHMM2.0') end def test_status ! assert_equal(@obj.status, 'outside') end def test_range ! assert_equal(@obj.range, 1..46) end def test_pos ! assert_equal(@obj.pos, 1..46) end --- 115,135 ---- def test_entry_id ! assert_equal('O42385', @obj.entry_id) end def test_version ! assert_equal('TMHMM2.0', @obj.version) end def test_status ! assert_equal('outside', @obj.status) end def test_range ! assert_equal(1..46, @obj.range) end def test_pos ! assert_equal(1..46, @obj.pos) end From nakao at pub.open-bio.org Wed Nov 23 00:10:36 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 00:06:29 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/data test_aa.rb, 1.2, 1.3 test_codontable.rb, 1.2, 1.3 test_na.rb, 1.2, 1.3 Message-ID: <200511230510.jAN5AaVL015330@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/data In directory pub.open-bio.org:/tmp/cvs-serv15316/test/unit/bio/data Modified Files: test_aa.rb test_codontable.rb test_na.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_codontable.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/data/test_codontable.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_codontable.rb 24 Sep 2005 03:12:56 -0000 1.2 --- test_codontable.rb 23 Nov 2005 05:10:34 -0000 1.3 *************** *** 49,65 **** def test_definition ! assert_equal(@ct.definition, "Standard (Eukaryote)") end def test_start ! assert_equal(@ct.start, ['ttg', 'ctg', 'atg', 'gtg']) end def test_stop ! assert_equal(@ct.stop, ['taa', 'tag', 'tga']) end def test_accessor #[] ! assert_equal(@ct['atg'], 'M') end --- 49,65 ---- def test_definition ! assert_equal("Standard (Eukaryote)", @ct.definition) end def test_start ! assert_equal(['ttg', 'ctg', 'atg', 'gtg'], @ct.start) end def test_stop ! assert_equal(['taa', 'tag', 'tga'], @ct.stop) end def test_accessor #[] ! assert_equal('M', @ct['atg']) end *************** *** 67,73 **** alternative = 'Y' @ct['atg'] = alternative ! assert_equal(@ct['atg'], alternative) @ct['atg'] = 'M' ! assert_equal(@ct['atg'], 'M') end --- 67,73 ---- alternative = 'Y' @ct['atg'] = alternative ! assert_equal(alternative, @ct['atg']) @ct['atg'] = 'M' ! assert_equal('M', @ct['atg']) end *************** *** 77,91 **** def test_revtrans ! assert_equal(@ct.revtrans('M'), ['atg']) end def test_start_codon? ! assert_equal(@ct.start_codon?('atg'), true) ! assert_equal(@ct.start_codon?('taa'), false) end def test_stop_codon? ! assert_equal(@ct.stop_codon?('atg'), false) ! assert_equal(@ct.stop_codon?('taa'), true) end --- 77,91 ---- def test_revtrans ! assert_equal(['atg'], @ct.revtrans('M')) end def test_start_codon? ! assert_equal(true, @ct.start_codon?('atg')) ! assert_equal(false, @ct.start_codon?('taa')) end def test_stop_codon? ! assert_equal(false, @ct.stop_codon?('atg')) ! assert_equal(true, @ct.stop_codon?('taa')) end *************** *** 97,111 **** def test_Starts assert(Bio::CodonTable::Starts) ! assert_equal(Bio::CodonTable::Starts[1], ['ttg', 'ctg', 'atg', 'gtg']) end def test_stops assert(Bio::CodonTable::Stops) ! assert_equal(Bio::CodonTable::Stops[1], ['taa', 'tag', 'tga']) end def test_Tables assert(Bio::CodonTable::Tables) ! assert_equal(Bio::CodonTable::Tables[1], @ct.table) end --- 97,111 ---- def test_Starts assert(Bio::CodonTable::Starts) ! assert_equal(['ttg', 'ctg', 'atg', 'gtg'], Bio::CodonTable::Starts[1]) end def test_stops assert(Bio::CodonTable::Stops) ! assert_equal(['taa', 'tag', 'tga'], Bio::CodonTable::Stops[1]) end def test_Tables assert(Bio::CodonTable::Tables) ! assert_equal(@ct.table, Bio::CodonTable::Tables[1]) end Index: test_na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/data/test_na.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_na.rb 24 Sep 2005 03:12:56 -0000 1.2 --- test_na.rb 23 Nov 2005 05:10:34 -0000 1.3 *************** *** 37,83 **** def test_to_re re = /[tc][ag][at][gc][tg][ac][tgc][atg][agc][atgc]atgc/ ! assert_equal(@obj.to_re('yrwskmbdvnatgc'), re) ! assert_equal(Bio::NucleicAcid.to_re('yrwskmbdvnatgc'), re) end def test_Names ! assert_equal(Bio::NucleicAcid::Names['a'], 'a') end def test_Names_1_to_name ! assert_equal(Bio::NucleicAcid::Names['A'], 'adenine') end def test_Weight mw = 135.15 ! assert_equal(Bio::NucleicAcid::Weight['a'], mw) ! assert_equal(Bio::NucleicAcid::Weight[:adenine], mw) end def test_weight mw = 135.15 ! assert_equal(@obj.weight('a'), mw) ! assert_equal(Bio::NucleicAcid.weight('a'), mw) end def test_weight_rna mw = 135.15 ! assert_equal(@obj.weight('A', true), mw) ! assert_equal(Bio::NucleicAcid.weight('A', true), mw) end def test_accessor ! assert_equal(@obj['A'], 'adenine') end def test_names ! assert_equal(@obj.names, Bio::NucleicAcid::Names) end def test_na ! assert_equal(@obj.na, Bio::NucleicAcid::Names) end def test_name ! assert_equal(@obj.name('A'), 'adenine') end end --- 37,83 ---- def test_to_re re = /[tc][ag][at][gc][tg][ac][tgc][atg][agc][atgc]atgc/ ! assert_equal(re, @obj.to_re('yrwskmbdvnatgc')) ! assert_equal(re, Bio::NucleicAcid.to_re('yrwskmbdvnatgc')) end def test_Names ! assert_equal('a', Bio::NucleicAcid::Names['a']) end def test_Names_1_to_name ! assert_equal('adenine', Bio::NucleicAcid::Names['A']) end def test_Weight mw = 135.15 ! assert_equal(mw, Bio::NucleicAcid::Weight['a']) ! assert_equal(mw, Bio::NucleicAcid::Weight[:adenine]) end def test_weight mw = 135.15 ! assert_equal(mw, @obj.weight('a')) ! assert_equal(mw, Bio::NucleicAcid.weight('a')) end def test_weight_rna mw = 135.15 ! assert_equal(mw, @obj.weight('A', true)) ! assert_equal(mw, Bio::NucleicAcid.weight('A', true)) end def test_accessor ! assert_equal('adenine', @obj['A']) end def test_names ! assert_equal(Bio::NucleicAcid::Names, @obj.names) end def test_na ! assert_equal(Bio::NucleicAcid::Names, @obj.na) end def test_name ! assert_equal('adenine', @obj.name('A')) end end Index: test_aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/data/test_aa.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_aa.rb 24 Sep 2005 03:12:56 -0000 1.2 --- test_aa.rb 23 Nov 2005 05:10:34 -0000 1.3 *************** *** 36,100 **** def test_bio_aminoacid ! assert_equal(Bio::AminoAcid['A'], 'Ala') end def test_13 ! assert_equal(@obj['A'], "Ala") end def test_1n ! assert_equal(@obj.name('A'), 'alanine') end def test_to_1_name ! assert_equal(@obj.to_1('alanine'), 'A') end def test_to_1_3 ! assert_equal(@obj.to_1('Ala'), 'A') end def test_to_1_1 ! assert_equal(@obj.to_1('A'), 'A') end def test_to_3_name ! assert_equal(@obj.to_3('alanine'), 'Ala') end def test_to_3_3 ! assert_equal(@obj.to_3('Ala'), 'Ala') end def test_to_3_1 ! assert_equal(@obj.to_3('A'), 'Ala') end def test_one2three ! assert_equal(@obj.one2three('A'), 'Ala') end def test_three2one ! assert_equal(@obj.three2one('Ala'), 'A') end def test_one2name ! assert_equal(@obj.one2name('A'), 'alanine') end def test_name2one ! assert_equal(@obj.name2one('alanine'), 'A') end def test_three2name ! assert_equal(@obj.three2name('Ala'), 'alanine') end def test_name2three ! assert_equal(@obj.name2three('alanine'), 'Ala') end def test_to_re ! assert_equal(@obj.to_re('BZACDEFGHIKLMNPQRSTVWYU'), /[DN][EQ]ACDEFGHIKLMNPQRSTVWYU/) end end --- 36,100 ---- def test_bio_aminoacid ! assert_equal('Ala', Bio::AminoAcid['A']) end def test_13 ! assert_equal("Ala", @obj['A']) end def test_1n ! assert_equal('alanine', @obj.name('A')) end def test_to_1_name ! assert_equal('A', @obj.to_1('alanine')) end def test_to_1_3 ! assert_equal('A', @obj.to_1('Ala')) end def test_to_1_1 ! assert_equal('A', @obj.to_1('A')) end def test_to_3_name ! assert_equal('Ala', @obj.to_3('alanine')) end def test_to_3_3 ! assert_equal('Ala', @obj.to_3('Ala')) end def test_to_3_1 ! assert_equal('Ala', @obj.to_3('A')) end def test_one2three ! assert_equal('Ala', @obj.one2three('A')) end def test_three2one ! assert_equal('A', @obj.three2one('Ala')) end def test_one2name ! assert_equal('alanine', @obj.one2name('A')) end def test_name2one ! assert_equal('A', @obj.name2one('alanine')) end def test_three2name ! assert_equal('alanine', @obj.three2name('Ala')) end def test_name2three ! assert_equal('Ala', @obj.name2three('alanine')) end def test_to_re ! assert_equal(/[DN][EQ]ACDEFGHIKLMNPQRSTVWYU/, @obj.to_re('BZACDEFGHIKLMNPQRSTVWYU')) end end From nakao at pub.open-bio.org Wed Nov 23 00:25:12 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 00:20:48 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/data test_aa.rb, 1.3, 1.4 test_codontable.rb, 1.3, 1.4 test_na.rb, 1.3, 1.4 Message-ID: <200511230525.jAN5PCVL015393@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/data In directory pub.open-bio.org:/tmp/cvs-serv15371/test/unit/bio/data Modified Files: test_aa.rb test_codontable.rb test_na.rb Log Message: * Updated test codes for constants renamed UPPERCASE. Index: test_codontable.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/data/test_codontable.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_codontable.rb 23 Nov 2005 05:10:34 -0000 1.3 --- test_codontable.rb 23 Nov 2005 05:25:10 -0000 1.4 *************** *** 30,33 **** --- 30,55 ---- module Bio + class TestCodonTableConstants < Test::Unit::TestCase + def test_Definitions + assert(Bio::CodonTable::DEFINITIONS) + assert(Bio::CodonTable::DEFINITIONS[1], "Standard (Eukaryote)") + end + + def test_Starts + assert(Bio::CodonTable::STARTS) + assert_equal(['ttg', 'ctg', 'atg', 'gtg'], Bio::CodonTable::STARTS[1]) + end + + def test_stops + assert(Bio::CodonTable::STOPS) + assert_equal(['taa', 'tag', 'tga'], Bio::CodonTable::STOPS[1]) + end + + def test_Tables + assert(Bio::CodonTable::TABLES) + end + end + + class TestCodonTable < Test::Unit::TestCase *************** *** 90,111 **** end - def test_Definitions - assert(Bio::CodonTable::Definitions) - assert(Bio::CodonTable::Definitions[1], "Standard (Eukaryote)") - end - - def test_Starts - assert(Bio::CodonTable::Starts) - assert_equal(['ttg', 'ctg', 'atg', 'gtg'], Bio::CodonTable::Starts[1]) - end - - def test_stops - assert(Bio::CodonTable::Stops) - assert_equal(['taa', 'tag', 'tga'], Bio::CodonTable::Stops[1]) - end def test_Tables ! assert(Bio::CodonTable::Tables) ! assert_equal(@ct.table, Bio::CodonTable::Tables[1]) end --- 112,118 ---- end def test_Tables ! assert_equal(@ct.table, Bio::CodonTable::TABLES[1]) end Index: test_na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/data/test_na.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_na.rb 23 Nov 2005 05:10:34 -0000 1.3 --- test_na.rb 23 Nov 2005 05:25:10 -0000 1.4 *************** *** 29,34 **** module Bio - class TestNA < Test::Unit::TestCase def setup @obj = Bio::NucleicAcid.new --- 29,51 ---- module Bio + class TestNAConstants < Test::Unit::TestCase + def test_NAMES + assert_equal('a', Bio::NucleicAcid::NAMES['a']) + end + + def test_NAMES_1_to_name + assert_equal('adenine', Bio::NucleicAcid::NAMES['A']) + end + + def test_WEIGHT + mw = 135.15 + assert_equal(mw, Bio::NucleicAcid::WEIGHT['a']) + assert_equal(mw, Bio::NucleicAcid::WEIGHT[:adenine]) + end + end + + + class TestNA < Test::Unit::TestCase def setup @obj = Bio::NucleicAcid.new *************** *** 41,56 **** end - def test_Names - assert_equal('a', Bio::NucleicAcid::Names['a']) - end - def test_Names_1_to_name - assert_equal('adenine', Bio::NucleicAcid::Names['A']) - end - - def test_Weight - mw = 135.15 - assert_equal(mw, Bio::NucleicAcid::Weight['a']) - assert_equal(mw, Bio::NucleicAcid::Weight[:adenine]) - end def test_weight --- 58,61 ---- *************** *** 72,79 **** def test_names ! assert_equal(Bio::NucleicAcid::Names, @obj.names) end def test_na ! assert_equal(Bio::NucleicAcid::Names, @obj.na) end --- 77,84 ---- def test_names ! assert_equal(Bio::NucleicAcid::NAMES, @obj.names) end def test_na ! assert_equal(Bio::NucleicAcid::NAMES, @obj.na) end Index: test_aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/data/test_aa.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_aa.rb 23 Nov 2005 05:10:34 -0000 1.3 --- test_aa.rb 23 Nov 2005 05:25:10 -0000 1.4 *************** *** 29,40 **** module Bio ! class TestAA < Test::Unit::TestCase def setup @obj = Bio::AminoAcid.new - end - - def test_bio_aminoacid - assert_equal('Ala', Bio::AminoAcid['A']) end --- 29,42 ---- module Bio ! class TestAAConstants < Test::Unit::TestCase ! def test_bio_aminoacid ! assert_equal('Ala', Bio::AminoAcid['A']) ! end ! end + + class TestAA < Test::Unit::TestCase def setup @obj = Bio::AminoAcid.new end From nakao at pub.open-bio.org Wed Nov 23 05:00:56 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 04:56:35 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/embl test_common.rb,1.1,1.2 Message-ID: <200511231000.jANA0uVL016255@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/embl In directory pub.open-bio.org:/tmp/cvs-serv16240/test/unit/bio/db/embl Modified Files: test_common.rb Log Message: * Fixed the order of arguments of assert_equal and TestEMBLAPI class. Index: test_common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/embl/test_common.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_common.rb 27 Oct 2005 09:37:22 -0000 1.1 --- test_common.rb 23 Nov 2005 10:00:54 -0000 1.2 *************** *** 31,35 **** module Bio ! class EMBL_API include Bio::EMBLDB::Common end --- 31,36 ---- module Bio ! # TestClass EMBLDB Inherited ! class EMBL_API < EMBLDB include Bio::EMBLDB::Common end *************** *** 117,125 **** def test_ac ! assert_equal(@obj.ac, ["A12345", "B23456"]) end def test_accessions ! assert_equal(@obj.accessions, ["A12345", "B23456"]) end --- 118,126 ---- def test_ac ! assert_equal(["A12345", "B23456"], @obj.ac) end def test_accessions ! assert_equal(["A12345", "B23456"], @obj.accessions) end From nakao at pub.open-bio.org Wed Nov 23 05:02:44 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 04:58:19 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/embl test_embl.rb,1.2,1.3 Message-ID: <200511231002.jANA2iVL016295@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/embl In directory pub.open-bio.org:/tmp/cvs-serv16264/test/unit/bio/db/embl Modified Files: test_embl.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_embl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/embl/test_embl.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_embl.rb 27 Oct 2005 09:38:12 -0000 1.2 --- test_embl.rb 23 Nov 2005 10:02:42 -0000 1.3 *************** *** 47,90 **** def test_id_line_entry_name ! assert_equal(@obj.id_line('ENTRY_NAME'), 'AB090716') end def test_id_line_data_class ! assert_equal(@obj.id_line('DATA_CLASS'), 'standard') end def test_id_line_molecule_type ! assert_equal(@obj.id_line('MOLECULE_TYPE'), 'genomic DNA') end def test_id_line_division ! assert_equal(@obj.id_line('DIVISION'), 'VRT') end def test_id_line_sequence_length ! assert_equal(@obj.id_line('SEQUENCE_LENGTH'), 166) end def test_entry entry_id = 'AB090716' ! assert_equal(@obj.entry, entry_id) ! assert_equal(@obj.entry_name, entry_id) ! assert_equal(@obj.entry_id, entry_id) end def test_molecule molecule = 'genomic DNA' ! assert_equal(@obj.molecule, molecule) ! assert_equal(@obj.molecule_type, molecule) end def test_division ! assert_equal(@obj.division, 'VRT') end def test_sequence_length seqlen = 166 ! assert_equal(@obj.sequence_length, seqlen) ! assert_equal(@obj.seqlen, seqlen) end --- 47,90 ---- def test_id_line_entry_name ! assert_equal('AB090716', @obj.id_line('ENTRY_NAME')) end def test_id_line_data_class ! assert_equal('standard', @obj.id_line('DATA_CLASS')) end def test_id_line_molecule_type ! assert_equal('genomic DNA', @obj.id_line('MOLECULE_TYPE')) end def test_id_line_division ! assert_equal('VRT', @obj.id_line('DIVISION')) end def test_id_line_sequence_length ! assert_equal(166, @obj.id_line('SEQUENCE_LENGTH')) end def test_entry entry_id = 'AB090716' ! assert_equal(entry_id, @obj.entry) ! assert_equal(entry_id, @obj.entry_name) ! assert_equal(entry_id, @obj.entry_id) end def test_molecule molecule = 'genomic DNA' ! assert_equal(molecule, @obj.molecule) ! assert_equal(molecule, @obj.molecule_type) end def test_division ! assert_equal('VRT', @obj.division) end def test_sequence_length seqlen = 166 ! assert_equal(seqlen, @obj.sequence_length) ! assert_equal(seqlen, @obj.seqlen) end *************** *** 92,110 **** def test_ac ac = ['AB090716'] ! assert_equal(@obj.ac, ac) ! assert_equal(@obj.accessions, ac) end # Bio::EMBLDB::COMMON#accession def test_accession ! assert_equal(@obj.accession, 'AB090716') end def test_sv ! assert_equal(@obj.sv, 'AB090716.1') end def test_version ! assert_equal(@obj.version, 1) end --- 92,110 ---- def test_ac ac = ['AB090716'] ! assert_equal(ac, @obj.ac) ! assert_equal(ac, @obj.accessions) end # Bio::EMBLDB::COMMON#accession def test_accession ! assert_equal('AB090716', @obj.accession) end def test_sv ! assert_equal('AB090716.1', @obj.sv) end def test_version ! assert_equal(1, @obj.version) end *************** *** 118,131 **** def test_dt_created ! assert_equal(@obj.dt('created'), '25-OCT-2002 (Rel. 73, Created)') end def test_dt_updated ! assert_equal(@obj.dt('updated'), '29-NOV-2002 (Rel. 73, Last updated, Version 2)') end # Bio::EMBLDB::COMMON#de def test_de ! assert_equal(@obj.de, "Haplochromis sp. 'muzu, rukwa' LWS gene for long wavelength-sensitive opsin, partial cds, specimen_voucher:specimen No. HT-9361.") end --- 118,131 ---- def test_dt_created ! assert_equal('25-OCT-2002 (Rel. 73, Created)', @obj.dt('created')) end def test_dt_updated ! assert_equal('29-NOV-2002 (Rel. 73, Last updated, Version 2)', @obj.dt('updated')) end # Bio::EMBLDB::COMMON#de def test_de ! assert_equal("Haplochromis sp. 'muzu, rukwa' LWS gene for long wavelength-sensitive opsin, partial cds, specimen_voucher:specimen No. HT-9361.", @obj.de) end *************** *** 133,142 **** def test_kw k = [] ! assert_equal(@obj.kw, []) ! assert_equal(@obj.keywords, []) end def test_os ! # assert_equal(@obj.os, '') assert_raises(RuntimeError) { @obj.os } end --- 133,142 ---- def test_kw k = [] ! assert_equal([], @obj.kw) ! assert_equal([], @obj.keywords) end def test_os ! # assert_equal('', @obj.os) assert_raises(RuntimeError) { @obj.os } end *************** *** 144,196 **** def test_os_valid @obj.instance_eval { @data['OS'] = "Haplochromis sp. 'muzu rukwa'" } ! assert_equal(@obj.os, "Haplochromis sp. 'muzu rukwa'") end # Bio::EMBLDB::COMMON#oc def test_oc ! assert_equal(@obj.oc.first, 'Eukaryota') end # Bio::EMBLDB::COMMON#og def test_og ! assert_equal(@obj.og, []) end # Bio::EMBLDB::COMMON#ref def test_ref ! assert_equal(@obj.ref.size, 2) end # Bio::EMBLDB::COMMON#references def test_references ! assert_equal(@obj.references.class, Bio::References) end # Bio::EMBLDB::COMMON#dr def test_dr ! assert_equal(@obj.dr, {}) end def test_fh ! assert_equal(@obj.fh, 'Key Location/Qualifiers') end def test_ft ! assert_equal(@obj.ft.class, Bio::Features) end def test_ft_iterator @obj.ft.each do |feature| ! assert_equal(feature.class, Bio::Feature) end end def test_ft_accessor ! assert_equal(@obj.ft.features[1].feature, 'CDS') end def test_each_cds @obj.each_cds do |x| ! assert_equal(x.feature, 'CDS') end end --- 144,196 ---- def test_os_valid @obj.instance_eval { @data['OS'] = "Haplochromis sp. 'muzu rukwa'" } ! assert_equal("Haplochromis sp. 'muzu rukwa'", @obj.os) end # Bio::EMBLDB::COMMON#oc def test_oc ! assert_equal('Eukaryota', @obj.oc.first) end # Bio::EMBLDB::COMMON#og def test_og ! assert_equal([], @obj.og) end # Bio::EMBLDB::COMMON#ref def test_ref ! assert_equal(2, @obj.ref.size) end # Bio::EMBLDB::COMMON#references def test_references ! assert_equal(Bio::References, @obj.references.class) end # Bio::EMBLDB::COMMON#dr def test_dr ! assert_equal({}, @obj.dr) end def test_fh ! assert_equal('Key Location/Qualifiers', @obj.fh) end def test_ft ! assert_equal(Bio::Features, @obj.ft.class) end def test_ft_iterator @obj.ft.each do |feature| ! assert_equal(Bio::Feature, feature.class) end end def test_ft_accessor ! assert_equal('CDS', @obj.ft.features[1].feature) end def test_each_cds @obj.each_cds do |x| ! assert_equal('CDS', x.feature) end end *************** *** 198,207 **** def test_each_gene @obj.each_gene do |x| ! assert_equal(x.feature, 'gene') end end def test_cc ! assert_equal(@obj.cc, '') end --- 198,207 ---- def test_each_gene @obj.each_gene do |x| ! assert_equal('gene', x.feature) end end def test_cc ! assert_equal('', @obj.cc) end *************** *** 211,226 **** def test_sq data = {"a"=>29, "c"=>42, "ntlen"=>166, "g"=>41, "t"=>54, "other"=>0} ! assert_equal(@obj.sq, data) end def test_sq_get ! assert_equal(@obj.sq("a"), 29) end def test_seq seq = 'gttctggcctcatggactgaagacttcctgtggacctgatgtgttcagtggaagtgaagaccctggagtacagtcctacatgattgttctcatgattacttgctgtttcatccccctggctatcatcatcctgtgctaccttgctgtgtggatggccatccgtgct' ! assert_equal(@obj.seq, seq) ! assert_equal(@obj.naseq, seq) ! assert_equal(@obj.ntseq, seq) end end --- 211,226 ---- def test_sq data = {"a"=>29, "c"=>42, "ntlen"=>166, "g"=>41, "t"=>54, "other"=>0} ! assert_equal(data, @obj.sq) end def test_sq_get ! assert_equal(29, @obj.sq("a")) end def test_seq seq = 'gttctggcctcatggactgaagacttcctgtggacctgatgtgttcagtggaagtgaagaccctggagtacagtcctacatgattgttctcatgattacttgctgtttcatccccctggctatcatcatcctgtgctaccttgctgtgtggatggccatccgtgct' ! assert_equal(seq, @obj.seq) ! assert_equal(seq, @obj.naseq) ! assert_equal(seq, @obj.ntseq) end end From nakao at pub.open-bio.org Wed Nov 23 05:06:14 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 05:01:51 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/embl test_sptr.rb,1.1,1.2 Message-ID: <200511231006.jANA6EVL016318@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/embl In directory pub.open-bio.org:/tmp/cvs-serv16306/test/unit/bio/db/embl Modified Files: test_sptr.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_sptr.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/embl/test_sptr.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_sptr.rb 27 Oct 2005 09:28:43 -0000 1.1 --- test_sptr.rb 23 Nov 2005 10:06:12 -0000 1.2 *************** *** 42,86 **** def test_id_line_entry_name ! assert_equal(@obj.id_line('ENTRY_NAME'), 'P53_HUMAN') end def test_id_line_data_class ! assert_equal(@obj.id_line('DATA_CLASS'), 'STANDARD') end def test_id_line_molecule_type ! assert_equal(@obj.id_line('MOLECULE_TYPE'), 'PRT') end def test_id_line_sequence_length ! assert_equal(@obj.id_line('SEQUENCE_LENGTH'), 393) end def test_entry entry = 'P53_HUMAN' ! assert_equal(@obj.entry, entry) ! assert_equal(@obj.entry_name, entry) ! assert_equal(@obj.entry_id, entry) end def test_molecule ! assert_equal(@obj.molecule, 'PRT') ! assert_equal(@obj.molecule_type, 'PRT') end def test_sequence_length seqlen = 393 ! assert_equal(@obj.sequence_length, seqlen) ! assert_equal(@obj.aalen, seqlen) end def test_ac acs = ["P04637", "Q15086", "Q15087", "Q15088", "Q16535", "Q16807", "Q16808", "Q16809", "Q16810", "Q16811", "Q16848", "Q86UG1", "Q8J016", "Q99659", "Q9BTM4", "Q9HAQ8", "Q9NP68", "Q9NPJ2", "Q9NZD0", "Q9UBI2", "Q9UQ61"] ! assert_equal(@obj.ac, acs) ! assert_equal(@obj.accessions, acs) end def test_accession ! assert_equal(@obj.accession, 'P04637') end --- 42,86 ---- def test_id_line_entry_name ! assert_equal('P53_HUMAN', @obj.id_line('ENTRY_NAME')) end def test_id_line_data_class ! assert_equal('STANDARD', @obj.id_line('DATA_CLASS')) end def test_id_line_molecule_type ! assert_equal('PRT', @obj.id_line('MOLECULE_TYPE')) end def test_id_line_sequence_length ! assert_equal(393, @obj.id_line('SEQUENCE_LENGTH')) end def test_entry entry = 'P53_HUMAN' ! assert_equal(entry, @obj.entry) ! assert_equal(entry, @obj.entry_name) ! assert_equal(entry, @obj.entry_id) end def test_molecule ! assert_equal('PRT', @obj.molecule) ! assert_equal('PRT', @obj.molecule_type) end def test_sequence_length seqlen = 393 ! assert_equal(seqlen, @obj.sequence_length) ! assert_equal(seqlen, @obj.aalen) end def test_ac acs = ["P04637", "Q15086", "Q15087", "Q15088", "Q16535", "Q16807", "Q16808", "Q16809", "Q16810", "Q16811", "Q16848", "Q86UG1", "Q8J016", "Q99659", "Q9BTM4", "Q9HAQ8", "Q9NP68", "Q9NPJ2", "Q9NZD0", "Q9UBI2", "Q9UQ61"] ! assert_equal(acs, @obj.ac) ! assert_equal(acs, @obj.accessions) end def test_accession ! assert_equal('P04637', @obj.accession) end *************** *** 90,102 **** def test_dt_created ! assert_equal(@obj.dt('created'), '13-AUG-1987 (Rel. 05, Created)') end def test_dt_sequence ! assert_equal(@obj.dt('sequence'), '01-MAR-1989 (Rel. 10, Last sequence update)') end def test_dt_annotation ! assert_equal(@obj.dt('annotation'), '13-SEP-2005 (Rel. 48, Last annotation update)') end --- 90,102 ---- def test_dt_created ! assert_equal('13-AUG-1987 (Rel. 05, Created)', @obj.dt('created')) end def test_dt_sequence ! assert_equal('01-MAR-1989 (Rel. 10, Last sequence update)', @obj.dt('sequence')) end def test_dt_annotation ! assert_equal('13-SEP-2005 (Rel. 48, Last annotation update)', @obj.dt('annotation')) end *************** *** 106,136 **** def test_protein_name ! assert_equal(@obj.protein_name, "Cellular tumor antigen p53") end def test_synonyms ! assert_equal(@obj.synonyms, ["Tumor suppressor p53", "Phosphoprotein p53", "Antigen NY-CO-13"]) end def test_gn ! assert_equal(@obj.gn, [{:orfs=>[], :synonyms=>["P53"], :name=>"TP53", :loci=>[]}]) end def test_gn_uniprot_parser gn_uniprot_data = '' ! assert_equal(@obj.instance_eval("gn_uniprot_parser"), [{:orfs=>[], :loci=>[], :name=>"TP53", :synonyms=>["P53"]}]) end def test_gn_old_parser gn_old_data = '' ! assert_equal(@obj.instance_eval("gn_old_parser"), [["Name=TP53; Synonyms=P53;"]]) end def test_gene_names ! assert_equal(@obj.gene_names, ["TP53"]) end def test_gene_name ! assert_equal(@obj.gene_name, 'TP53') end --- 106,136 ---- def test_protein_name ! assert_equal("Cellular tumor antigen p53", @obj.protein_name) end def test_synonyms ! assert_equal(["Tumor suppressor p53", "Phosphoprotein p53", "Antigen NY-CO-13"], @obj.synonyms) end def test_gn ! assert_equal([{:orfs=>[], :synonyms=>["P53"], :name=>"TP53", :loci=>[]}], @obj.gn) end def test_gn_uniprot_parser gn_uniprot_data = '' ! assert_equal([{:orfs=>[], :loci=>[], :name=>"TP53", :synonyms=>["P53"]}], @obj.instance_eval("gn_uniprot_parser")) end def test_gn_old_parser gn_old_data = '' ! assert_equal([["Name=TP53; Synonyms=P53;"]], @obj.instance_eval("gn_old_parser")) end def test_gene_names ! assert_equal(["TP53"], @obj.gene_names) end def test_gene_name ! assert_equal('TP53', @obj.gene_name) end *************** *** 140,148 **** def test_os_access ! assert_equal(@obj.os(0), "Homo sapiens (Human)") end def test_os_access2 ! assert_equal(@obj.os[0], {"name"=>"(Human)", "os"=>"Homo sapiens"}) end --- 140,148 ---- def test_os_access ! assert_equal("Homo sapiens (Human)", @obj.os(0)) end def test_os_access2 ! assert_equal({"name"=>"(Human)", "os"=>"Homo sapiens"}, @obj.os[0]) end *************** *** 151,155 **** ary = ['Plastid', 'Chloroplast'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(@obj.og, ary) end --- 151,155 ---- ary = ['Plastid', 'Chloroplast'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(ary, @obj.og) end *************** *** 158,162 **** ary = ['Mitochondrion'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(@obj.og, ary) end --- 158,162 ---- ary = ['Mitochondrion'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(ary, @obj.og) end *************** *** 165,169 **** ary = ["Plasmid sym pNGR234a"] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(@obj.og, ary) end --- 165,169 ---- ary = ["Plasmid sym pNGR234a"] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(ary, @obj.og) end *************** *** 172,176 **** ary = ['Plastid', 'Cyanelle'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(@obj.og, ary) end --- 172,176 ---- ary = ['Plastid', 'Cyanelle'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(ary, @obj.og) end *************** *** 179,183 **** ary = ["Plasmid pSymA (megaplasmid 1)"] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(@obj.og, ary) end --- 179,183 ---- ary = ["Plasmid pSymA (megaplasmid 1)"] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(ary, @obj.og) end *************** *** 186,198 **** ary = ['Plasmid pNRC100', 'Plasmid pNRC200', 'Plasmid pHH1'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(@obj.og, ary) end def test_oc ! assert_equal(@obj.oc, ["Eukaryota", "Metazoa", "Chordata", "Craniata", "Vertebrata", "Euteleostomi", "Mammalia", "Eutheria", "Euarchontoglires", "Primates", "Catarrhini", "Hominidae", "Homo"]) end def test_ox ! assert_equal(@obj.ox, {"NCBI_TaxID"=>["9606"]}) end --- 186,198 ---- ary = ['Plasmid pNRC100', 'Plasmid pNRC200', 'Plasmid pHH1'] @obj.instance_eval("@orig['OG'] = '#{og}'") ! assert_equal(ary, @obj.og) end def test_oc ! assert_equal(["Eukaryota", "Metazoa", "Chordata", "Craniata", "Vertebrata", "Euteleostomi", "Mammalia", "Eutheria", "Euarchontoglires", "Primates", "Catarrhini", "Hominidae", "Homo"], @obj.oc) end def test_ox ! assert_equal({"NCBI_TaxID"=>["9606"]}, @obj.ox) end *************** *** 202,206 **** def test_cc ! assert_equal(@obj.cc.class, Hash) end --- 202,206 ---- def test_cc ! assert_equal(Hash, @obj.cc.class) end *************** *** 210,214 **** {"NAME"=>"p53 web site at the Institut Curie", "WWW"=>"http://p53.curie.fr/", "FTP"=>nil, "NOTE"=>nil}, {"NAME"=>"Atlas Genet. Cytogenet. Oncol. Haematol.", "WWW"=>"http://www.infobiogen.fr/services/chromcancer/Genes/P53ID88.html", "FTP"=>nil, "NOTE"=>nil}] ! assert_equal(@obj.cc('DATABASE'), db) end --- 210,214 ---- {"NAME"=>"p53 web site at the Institut Curie", "WWW"=>"http://p53.curie.fr/", "FTP"=>nil, "NOTE"=>nil}, {"NAME"=>"Atlas Genet. Cytogenet. Oncol. Haematol.", "WWW"=>"http://www.infobiogen.fr/services/chromcancer/Genes/P53ID88.html", "FTP"=>nil, "NOTE"=>nil}] ! assert_equal(db, @obj.cc('DATABASE')) end *************** *** 217,225 **** {"IsoId"=>"P04637-2", "Name"=>"2", "Synonyms"=>"I9RET", "Sequence"=>["VSP_006535", "VSP_006536"]}], "Event"=>"Alternative splicing"} ! assert_equal(@obj.cc('ALTERNATIVE PRODUCTS'), ap) end def test_cc_mass_spectrometry ! assert_equal(@obj.cc('MASS SPECTROMETRY'), nil) end --- 217,225 ---- {"IsoId"=>"P04637-2", "Name"=>"2", "Synonyms"=>"I9RET", "Sequence"=>["VSP_006535", "VSP_006536"]}], "Event"=>"Alternative splicing"} ! assert_equal(ap, @obj.cc('ALTERNATIVE PRODUCTS')) end def test_cc_mass_spectrometry ! assert_equal(nil, @obj.cc('MASS SPECTROMETRY')) end *************** *** 228,232 **** def test_kw keywords = ["3D-structure", "Acetylation", "Activator", "Alternative splicing", "Anti-oncogene", "Apoptosis", "Cell cycle", "Disease mutation", "DNA-binding", "Glycoprotein", "Li-Fraumeni syndrome", "Metal-binding", "Nuclear protein", "Phosphorylation", "Polymorphism", "Transcription", "Transcription regulation", "Zinc"] ! assert_equal(@obj.kw, keywords) end --- 228,232 ---- def test_kw keywords = ["3D-structure", "Acetylation", "Activator", "Alternative splicing", "Anti-oncogene", "Apoptosis", "Cell cycle", "Disease mutation", "DNA-binding", "Glycoprotein", "Li-Fraumeni syndrome", "Metal-binding", "Nuclear protein", "Phosphorylation", "Polymorphism", "Transcription", "Transcription regulation", "Zinc"] ! assert_equal(keywords, @obj.kw) end *************** *** 234,266 **** assert(@obj.ft) name = 'DNA_BIND' ! assert_equal(@obj.ft(name), [{"FTId"=>nil, "From"=>102, "diff"=>[], "To"=>292, "Description"=>nil}]) end def test_sq ! assert_equal(@obj.sq, {"CRC64"=>"AD5C149FD8106131", "aalen"=>393, "MW"=>43653}) end def test_sq_crc64 ! assert_equal(@obj.sq('CRC64'), "AD5C149FD8106131") end def test_sq_mw mw = 43653 ! assert_equal(@obj.sq('mw'), mw) ! assert_equal(@obj.sq('molecular'), mw) ! assert_equal(@obj.sq('weight'), mw) end def test_sq_len length = 393 ! assert_equal(@obj.sq('len'), length) ! assert_equal(@obj.sq('length'), length) ! assert_equal(@obj.sq('AA'), length) end def test_seq seq = 'MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGPDEAPRMPEAAPPVAPAPAAPTPAAPAPAPSWPLSSSVPSQKTYQGSYGFRLGFLHSGTAKSVTCTYSPALNKMFCQLAKTCPVQLWVDSTPPPGTRVRAMAIYKQSQHMTEVVRRCPHHERCSDSDGLAPPQHLIRVEGNLRVEYLDDRNTFRHSVVVPYEPPEVGSDCTTIHYNYMCNSSCMGGMNRRPILTIITLEDSSGNLLGRNSFEVRVCACPGRDRRTEEENLRKKGEPHHELPPGSTKRALPNNTSSSPQPKKKPLDGEYFTLQIRGRERFEMFRELNEALELKDAQAGKEPGGSRAHSSHLKSKKGQSTSRHKKLMFKTEGPDSD' ! assert_equal(@obj.seq, seq) ! assert_equal(@obj.aaseq, seq) end --- 234,266 ---- assert(@obj.ft) name = 'DNA_BIND' ! assert_equal([{"FTId"=>nil, "From"=>102, "diff"=>[], "To"=>292, "Description"=>nil}], @obj.ft(name)) end def test_sq ! assert_equal({"CRC64"=>"AD5C149FD8106131", "aalen"=>393, "MW"=>43653}, @obj.sq) end def test_sq_crc64 ! assert_equal("AD5C149FD8106131", @obj.sq('CRC64')) end def test_sq_mw mw = 43653 ! assert_equal(mw, @obj.sq('mw')) ! assert_equal(mw, @obj.sq('molecular')) ! assert_equal(mw, @obj.sq('weight')) end def test_sq_len length = 393 ! assert_equal(length, @obj.sq('len')) ! assert_equal(length, @obj.sq('length')) ! assert_equal(length, @obj.sq('AA')) end def test_seq seq = 'MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGPDEAPRMPEAAPPVAPAPAAPTPAAPAPAPSWPLSSSVPSQKTYQGSYGFRLGFLHSGTAKSVTCTYSPALNKMFCQLAKTCPVQLWVDSTPPPGTRVRAMAIYKQSQHMTEVVRRCPHHERCSDSDGLAPPQHLIRVEGNLRVEYLDDRNTFRHSVVVPYEPPEVGSDCTTIHYNYMCNSSCMGGMNRRPILTIITLEDSSGNLLGRNSFEVRVCACPGRDRRTEEENLRKKGEPHHELPPGSTKRALPNNTSSSPQPKKKPLDGEYFTLQIRGRERFEMFRELNEALELKDAQAGKEPGGSRAHSSHLKSKKGQSTSRHKKLMFKTEGPDSD' ! assert_equal(seq, @obj.seq) ! assert_equal(seq, @obj.aaseq) end From nakao at pub.open-bio.org Wed Nov 23 05:12:12 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 05:07:45 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db/embl test_uniprot.rb, 1.1, 1.2 Message-ID: <200511231012.jANACCVL016350@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db/embl In directory pub.open-bio.org:/tmp/cvs-serv16340/test/unit/bio/db/embl Modified Files: test_uniprot.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_uniprot.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/embl/test_uniprot.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_uniprot.rb 27 Oct 2005 09:28:43 -0000 1.1 --- test_uniprot.rb 23 Nov 2005 10:12:09 -0000 1.2 *************** *** 41,63 **** end def test_id_line_entry_name ! assert_equal(@obj.id_line('ENTRY_NAME'), 'P53_HUMAN') end def test_id_line_data_class ! assert_equal(@obj.id_line('DATA_CLASS'), 'STANDARD') end def test_id_line_molecule_type ! assert_equal(@obj.id_line('MOLECULE_TYPE'), 'PRT') end def test_id_line_sequence_length ! assert_equal(@obj.id_line('SEQUENCE_LENGTH'), 393) end def test_ac ! assert_equal(@obj.ac, []) ! assert_equal(@obj.acccessions, []) end def test_accession ! assert_equal(@obj.accession, '') end --- 41,63 ---- end def test_id_line_entry_name ! assert_equal('P53_HUMAN', @obj.id_line('ENTRY_NAME')) end def test_id_line_data_class ! assert_equal('STANDARD', @obj.id_line('DATA_CLASS')) end def test_id_line_molecule_type ! assert_equal('PRT', @obj.id_line('MOLECULE_TYPE')) end def test_id_line_sequence_length ! assert_equal(393, @obj.id_line('SEQUENCE_LENGTH')) end def test_ac ! assert_equal([], @obj.ac) ! assert_equal([], @obj.acccessions) end def test_accession ! assert_equal('', @obj.accession) end *************** *** 67,95 **** def test_protein_name ! assert_equal(@obj.protein_name, "Cellular tumor antigen p53") end def test_synonyms ! assert_equal(@obj.synonyms, ["Tumor suppressor p53", "Phosphoprotein p53", "Antigen NY-CO-13"]) end def test_gn ! assert_equal(@obj.gn, [{:orfs=>[], :synonyms=>["P53"], :name=>"TP53", :loci=>[]}]) end def test_gn_uniprot_parser gn_uniprot_data = '' ! assert_equal(@obj.instance_eval(gn_uniprot_parser(gn_uniprot_data)), '') end # def test_gn_old_parser # gn_old_data = '' ! # assert_equal(@obj.instance_eval(gn_old_parser(gn_old_data)), '') # end def test_gene_names ! assert_equal(@obj.gene_names, ["TP53"]) end def test_gene_name ! assert_equal(@obj.gene_name, 'TP53') end --- 67,95 ---- def test_protein_name ! assert_equal("Cellular tumor antigen p53", @obj.protein_name) end def test_synonyms ! assert_equal(["Tumor suppressor p53", "Phosphoprotein p53", "Antigen NY-CO-13"], @obj.synonyms) end def test_gn ! assert_equal([{:orfs=>[], :synonyms=>["P53"], :name=>"TP53", :loci=>[]}], @obj.gn) end def test_gn_uniprot_parser gn_uniprot_data = '' ! assert_equal('', @obj.instance_eval(gn_uniprot_parser(gn_uniprot_data))) end # def test_gn_old_parser # gn_old_data = '' ! # assert_equal('', @obj.instance_eval(gn_old_parser(gn_old_data))) # end def test_gene_names ! assert_equal(["TP53"], @obj.gene_names) end def test_gene_name ! assert_equal('TP53', @obj.gene_name) end *************** *** 97,105 **** assert(@obj.os) end def test_os_access ! assert_equal(@obj.os(1), {'name' => '', 'os' => ''}) end def test_os_access2 ! assert_equal(@obj.os[1], {}) end --- 97,107 ---- assert(@obj.os) end + def test_os_access ! assert_equal({'name' => '', 'os' => ''}, @obj.os(1)) end + def test_os_access2 ! assert_equal({}, @obj.os[1]) end *************** *** 107,126 **** def test_cc data = '' ! assert_equal(@obj.instance_eval(cc_scan_alternative_products(data)), '') data = '' ! assert_equal(@obj.instance_eval(cc_scan_database(data)), '') data = '' ! assert_equal(@obj.instance_eval(cc_scan_mass_spectorometry(data)), '') ! assert_equal(@obj.cc, []) end def test_cc_database ! assert_equal(@obj.cc('DATABASE'), []) end def test_cc_alternative_products ! assert_equal(@obj.cc('ALTERNATIVE PRODUCTS'), {}) end def test_cc_mass_spectrometry ! assert_equal(@obj.cc('MASS SPECTROMETRY'), []) end --- 109,128 ---- def test_cc data = '' ! assert_equal('', @obj.instance_eval(cc_scan_alternative_products(data))) data = '' ! assert_equal('', @obj.instance_eval(cc_scan_database(data))) data = '' ! assert_equal('', @obj.instance_eval(cc_scan_mass_spectorometry(data))) ! assert_equal([], @obj.cc) end def test_cc_database ! assert_equal([], @obj.cc('DATABASE')) end def test_cc_alternative_products ! assert_equal({}, @obj.cc('ALTERNATIVE PRODUCTS')) end def test_cc_mass_spectrometry ! assert_equal([], @obj.cc('MASS SPECTROMETRY')) end *************** *** 133,137 **** END @obj.instance_eval('@orig["CC"] = "#{data}"') ! assert_equal(@obj.cc('INTERACTION'), '') end --- 135,139 ---- END @obj.instance_eval('@orig["CC"] = "#{data}"') ! assert_equal('', @obj.cc('INTERACTION')) end *************** *** 143,167 **** assert(@obj.ft) name = 'DNA_BIND' ! assert_equal(@obj.ft(name), []) end def test_sq_mw mw = 43653 ! assert_equal(@obj.sq('mw'), mw) ! assert_equal(@obj.sq('molecular'), mw) ! assert_equal(@obj.sq('weight'), mw) end def test_sq_len length = 393 ! assert_equal(@obj.sq('len'), length) ! assert_equal(@obj.sq('length'), length) ! assert_equal(@obj.sq('AA'), length) end def test_seq seq = 'MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGPDEAPRMPEAAPPVAPAPAAPTPAAPAPAPSWPLSSSVPSQKTYQGSYGFRLGFLHSGTAKSVTCTYSPALNKMFCQLAKTCPVQLWVDSTPPPGTRVRAMAIYKQSQHMTEVVRRCPHHERCSDSDGLAPPQHLIRVEGNLRVEYLDDRNTFRHSVVVPYEPPEVGSDCTTIHYNYMCNSSCMGGMNRRPILTIITLEDSSGNLLGRNSFEVRVCACPGRDRRTEEENLRKKGEPHHELPPGSTKRALPNNTSSSPQPKKKPLDGEYFTLQIRGRERFEMFRELNEALELKDAQAGKEPGGSRAHSSHLKSKKGQSTSRHKKLMFKTEGPDSD' ! assert_equal(@obj.seq, seq) ! assert_equal(@obj.aaseq, seq) end end --- 145,169 ---- assert(@obj.ft) name = 'DNA_BIND' ! assert_equal([], @obj.ft(name)) end def test_sq_mw mw = 43653 ! assert_equal(mw, @obj.sq('mw')) ! assert_equal(mw, @obj.sq('molecular')) ! assert_equal(mw, @obj.sq('weight')) end def test_sq_len length = 393 ! assert_equal(length, @obj.sq('len')) ! assert_equal(length, @obj.sq('length')) ! assert_equal(length, @obj.sq('AA')) end def test_seq seq = 'MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGPDEAPRMPEAAPPVAPAPAAPTPAAPAPAPSWPLSSSVPSQKTYQGSYGFRLGFLHSGTAKSVTCTYSPALNKMFCQLAKTCPVQLWVDSTPPPGTRVRAMAIYKQSQHMTEVVRRCPHHERCSDSDGLAPPQHLIRVEGNLRVEYLDDRNTFRHSVVVPYEPPEVGSDCTTIHYNYMCNSSCMGGMNRRPILTIITLEDSSGNLLGRNSFEVRVCACPGRDRRTEEENLRKKGEPHHELPPGSTKRALPNNTSSSPQPKKKPLDGEYFTLQIRGRERFEMFRELNEALELKDAQAGKEPGGSRAHSSHLKSKKGQSTSRHKKLMFKTEGPDSD' ! assert_equal(seq, @obj.seq) ! assert_equal(seq, @obj.aaseq) end end From nakao at pub.open-bio.org Wed Nov 23 06:21:17 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:16:53 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_fasta.rb,1.1,1.2 Message-ID: <200511231121.jANBLHVL016471@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory pub.open-bio.org:/tmp/cvs-serv16461/test/unit/bio/db Modified Files: test_fasta.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_fasta.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_fasta.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_fasta.rb 27 Oct 2005 14:21:23 -0000 1.1 --- test_fasta.rb 23 Nov 2005 11:21:15 -0000 1.2 *************** *** 32,37 **** def test_delimiter ! assert_equal(Bio::FastaFormat::DELIMITER, "\n>") ! assert_equal(Bio::FastaFormat::RS, "\n>") end --- 32,37 ---- def test_delimiter ! assert_equal("\n>", Bio::FastaFormat::DELIMITER) ! assert_equal("\n>", Bio::FastaFormat::RS) end *************** *** 68,137 **** def test_entry data = ">sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]\nMSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG\nVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME\nGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL\nKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC\nIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP\nQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES\n" ! assert_equal(@obj.entry, data) end def test_entry_id ! assert_equal(@obj.entry_id, 'sce:YBR160W') end def test_definition data = "sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]" ! assert_equal(@obj.definition, data) end def test_data data = "\nMSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG\nVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME\nGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL\nKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC\nIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP\nQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES\n" ! assert_equal(@obj.data, data) end def test_seq seq = 'MSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEGVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYMEGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNLKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGCIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFPQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES' ! assert_equal(@obj.seq, seq) end def test_length ! assert_equal(@obj.length, 298) end def test_naseq seq = 'msgelanykrlekvgegtygvvykaldlrpgqgqrvvalkkirlesedegvpstaireisllkelkddnivrlydivhsdahklylvfefldldlkrymegipkdqplgadivkkfmmqlckgiaychshrilhrdlkpqnllinkdgnlklgdfglarafgvplraytheivtlwyrapevllggkqystgvdtwsigcifaemcnrkpifsgdseidqifkifrvlgtpneaiwpdivylpdfkpsfpqwrrkdlsqvvpsldprgidlldkllaydpinrisarraaihpyfqes' ! assert_equal(@obj.naseq, seq) end def test_nalen ! assert_equal(@obj.nalen, 298) end def test_aaseq seq = "MSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEGVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYMEGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNLKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGCIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFPQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES" ! assert_equal(@obj.aaseq, seq) end def test_aalen ! assert_equal(@obj.aalen, 298) end def test_identifiers ! assert_equal(@obj.identifiers, '') end def test_gi ! assert_equal(@obj.gi, '') end def test_accession ! assert_equal(@obj.accession, '') end def test_accessions ! assert_equal(@obj.accessions, '') end def test_acc_version ! assert_equal(@obj.acc_version, '') end def test_locus ! assert_equal(@obj.locus, '') end --- 68,137 ---- def test_entry data = ">sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]\nMSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG\nVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME\nGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL\nKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC\nIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP\nQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES\n" ! assert_equal(data, @obj.entry) end def test_entry_id ! assert_equal('sce:YBR160W', @obj.entry_id) end def test_definition data = "sce:YBR160W CDC28, SRM5; cyclin-dependent protein kinase catalytic subunit [EC:2.7.1.-] [SP:CC28_YEAST]" ! assert_equal(data, @obj.definition) end def test_data data = "\nMSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEG\nVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYME\nGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNL\nKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGC\nIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFP\nQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES\n" ! assert_equal(data, @obj.data) end def test_seq seq = 'MSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEGVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYMEGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNLKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGCIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFPQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES' ! assert_equal(seq, @obj.seq) end def test_length ! assert_equal(298, @obj.length) end def test_naseq seq = 'msgelanykrlekvgegtygvvykaldlrpgqgqrvvalkkirlesedegvpstaireisllkelkddnivrlydivhsdahklylvfefldldlkrymegipkdqplgadivkkfmmqlckgiaychshrilhrdlkpqnllinkdgnlklgdfglarafgvplraytheivtlwyrapevllggkqystgvdtwsigcifaemcnrkpifsgdseidqifkifrvlgtpneaiwpdivylpdfkpsfpqwrrkdlsqvvpsldprgidlldkllaydpinrisarraaihpyfqes' ! assert_equal(seq, @obj.naseq) end def test_nalen ! assert_equal(298, @obj.nalen) end def test_aaseq seq = "MSGELANYKRLEKVGEGTYGVVYKALDLRPGQGQRVVALKKIRLESEDEGVPSTAIREISLLKELKDDNIVRLYDIVHSDAHKLYLVFEFLDLDLKRYMEGIPKDQPLGADIVKKFMMQLCKGIAYCHSHRILHRDLKPQNLLINKDGNLKLGDFGLARAFGVPLRAYTHEIVTLWYRAPEVLLGGKQYSTGVDTWSIGCIFAEMCNRKPIFSGDSEIDQIFKIFRVLGTPNEAIWPDIVYLPDFKPSFPQWRRKDLSQVVPSLDPRGIDLLDKLLAYDPINRISARRAAIHPYFQES" ! assert_equal(seq, @obj.aaseq) end def test_aalen ! assert_equal(298, @obj.aalen) end def test_identifiers ! assert_equal('', @obj.identifiers) end def test_gi ! assert_equal('', @obj.gi) end def test_accession ! assert_equal('', @obj.accession) end def test_accessions ! assert_equal('', @obj.accessions) end def test_acc_version ! assert_equal('', @obj.acc_version) end def test_locus ! assert_equal('', @obj.locus) end *************** *** 151,172 **** def test_entry ! assert_equal(@obj.entry, ">CRA3575282.F\n24 15 23 29 20 13 20 21 21 23 22 25 13 22 17 15 25 27 32 26 \n32 29 29 25\n") end def test_entry_id ! assert_equal(@obj.entry_id, 'CRA3575282.F') end def test_definition ! assert_equal(@obj.definition, 'CRA3575282.F') end def test_data data = [24, 15, 23, 29, 20, 13, 20, 21, 21, 23, 22, 25, 13, 22, 17, 15, 25, 27, 32, 26, 32, 29, 29, 25] ! assert_equal(@obj.data, data) end def test_length ! assert_equal(@obj.length, 24) end --- 151,172 ---- def test_entry ! assert_equal(">CRA3575282.F\n24 15 23 29 20 13 20 21 21 23 22 25 13 22 17 15 25 27 32 26 \n32 29 29 25\n", @obj.entry) end def test_entry_id ! assert_equal('CRA3575282.F', @obj.entry_id) end def test_definition ! assert_equal('CRA3575282.F', @obj.definition) end def test_data data = [24, 15, 23, 29, 20, 13, 20, 21, 21, 23, 22, 25, 13, 22, 17, 15, 25, 27, 32, 26, 32, 29, 29, 25] ! assert_equal(data, @obj.data) end def test_length ! assert_equal(24, @obj.length) end From nakao at pub.open-bio.org Wed Nov 23 06:29:18 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:24:50 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_gff.rb,1.1,1.2 Message-ID: <200511231129.jANBTIVL016511@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory pub.open-bio.org:/tmp/cvs-serv16501/test/unit/bio/db Modified Files: test_gff.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_gff.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_gff.rb 27 Oct 2005 09:27:52 -0000 1.1 --- test_gff.rb 23 Nov 2005 11:29:16 -0000 1.2 *************** *** 46,51 **** def test_records ! assert_equal(@obj.records.size, 8) ! assert_equal(@obj.records[0].class, Bio::GFF::Record) end --- 46,51 ---- def test_records ! assert_equal(8, @obj.records.size) ! assert_equal(Bio::GFF::Record, @obj.records[0].class) end *************** *** 55,59 **** class TestGFF2 < Test::Unit::TestCase def test_version ! assert_equal(Bio::GFF2::VERSION, 2) end end --- 55,59 ---- class TestGFF2 < Test::Unit::TestCase def test_version ! assert_equal(2, Bio::GFF2::VERSION) end end *************** *** 62,66 **** class TestGFF3 < Test::Unit::TestCase def test_version ! assert_equal(Bio::GFF3::VERSION, 3) end end --- 62,66 ---- class TestGFF3 < Test::Unit::TestCase def test_version ! assert_equal(3, Bio::GFF3::VERSION) end end *************** *** 77,118 **** def test_seqname ! assert_equal(@obj.seqname, 'I') end def test_source ! assert_equal(@obj.source, 'sgd') end def test_feature ! assert_equal(@obj.feature, 'gene') end def test_start ! assert_equal(@obj.start, '151453') end def test_end ! assert_equal(@obj.end, '151591') end def test_score ! assert_equal(@obj.score, '.') end def test_strand ! assert_equal(@obj.strand, '+') end def test_frame ! assert_equal(@obj.frame, '.') end def test_attributes at = {"Note"=>"Chromosome I Centromere", "Gene"=>"CEN1"} ! assert_equal(@obj.attributes, at) end def test_comments ! assert_equal(@obj.comments, '') end --- 77,118 ---- def test_seqname ! assert_equal('I', @obj.seqname) end def test_source ! assert_equal('sgd', @obj.source) end def test_feature ! assert_equal('gene', @obj.feature) end def test_start ! assert_equal('151453', @obj.start) end def test_end ! assert_equal('151591', @obj.end) end def test_score ! assert_equal('.', @obj.score) end def test_strand ! assert_equal('+', @obj.strand) end def test_frame ! assert_equal('.', @obj.frame) end def test_attributes at = {"Note"=>"Chromosome I Centromere", "Gene"=>"CEN1"} ! assert_equal(at, @obj.attributes) end def test_comments ! assert_equal('', @obj.comments) end *************** *** 131,135 **** record.seqname = name @obj.records << record ! assert_equal(@obj.records[0].seqname, name) end --- 131,135 ---- record.seqname = name @obj.records << record ! assert_equal(name, @obj.records[0].seqname) end From nakao at pub.open-bio.org Wed Nov 23 06:32:16 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:27:49 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/db test_prosite.rb,1.1,1.2 Message-ID: <200511231132.jANBWGVL016544@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/db In directory pub.open-bio.org:/tmp/cvs-serv16534/test/unit/bio/db Modified Files: test_prosite.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_prosite.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/db/test_prosite.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_prosite.rb 27 Oct 2005 17:17:49 -0000 1.1 --- test_prosite.rb 23 Nov 2005 11:32:13 -0000 1.2 *************** *** 32,41 **** def test_delimiter ! assert_equal(Bio::PROSITE::DELIMITER, "\n//\n") ! assert_equal(Bio::PROSITE::RS, "\n//\n") end def test_tagsize ! assert_equal(Bio::PROSITE::TAGSIZE, 5) end --- 32,41 ---- def test_delimiter ! assert_equal("\n//\n", Bio::PROSITE::DELIMITER) ! assert_equal("\n//\n", Bio::PROSITE::RS) end def test_tagsize ! assert_equal(5, Bio::PROSITE::TAGSIZE) end *************** *** 53,89 **** def test_name ! assert_equal(@obj.name, "G_PROTEIN_RECEP_F1_1") end def test_division data = "PATTERN" ! assert_equal(@obj.division, data) end def test_ac data = "PS00237" ! assert_equal(@obj.ac, data) end def test_dt ! assert_equal(@obj.dt, "APR-1990 (CREATED); NOV-1997 (DATA UPDATE); JUL-1998 (INFO UPDATE).") end def test_de data = "G-protein coupled receptors family 1 signature." ! assert_equal(@obj.de, data) end def test_pa pattern = "[GSTALIVMFYWC]-[GSTANCPDE]-{EDPKRH}-x(2)-[LIVMNQGA]-x(2)-[LIVMFT]-[GSTANC]-[LIVMFYWSTAC]-[DENH]-R-[FYWCSH]-x(2)-[LIVM]." ! assert_equal(@obj.pa, pattern) end def test_ma ! assert_equal(@obj.ma, '') end def test_ru ! assert_equal(@obj.ru, '') end --- 53,89 ---- def test_name ! assert_equal("G_PROTEIN_RECEP_F1_1", @obj.name) end def test_division data = "PATTERN" ! assert_equal(data, @obj.division) end def test_ac data = "PS00237" ! assert_equal(data, @obj.ac) end def test_dt ! assert_equal("APR-1990 (CREATED); NOV-1997 (DATA UPDATE); JUL-1998 (INFO UPDATE).", @obj.dt) end def test_de data = "G-protein coupled receptors family 1 signature." ! assert_equal(data, @obj.de) end def test_pa pattern = "[GSTALIVMFYWC]-[GSTANCPDE]-{EDPKRH}-x(2)-[LIVMNQGA]-x(2)-[LIVMFT]-[GSTANC]-[LIVMFYWSTAC]-[DENH]-R-[FYWCSH]-x(2)-[LIVM]." ! assert_equal(pattern, @obj.pa) end def test_ma ! assert_equal('', @obj.ma) end def test_ru ! assert_equal('', @obj.ru) end *************** *** 91,190 **** data = {"FALSE_NEG"=>112, "POSITIVE"=>[1057, 1057], "PARTIAL"=>48, "FALSE_POS"=>[64, 64], "RELEASE"=>["40.7", 103373], "TOTAL"=>[1121, 1121], "UNKNOWN"=>[0, 0]} ! assert_equal(@obj.nr, data) end def test_release ! assert_equal(@obj.release, ['40.7', 103373]) end def test_swissprot_release_number ! assert_equal(@obj.swissprot_release_number, '40.7') end def test_swissprot_release_sequences ! assert_equal(@obj.swissprot_release_sequences, 103373) end def test_total ! assert_equal(@obj.total, [1121, 1121]) end def test_total_hits ! assert_equal(@obj.total_hits, 1121) end def test_total_sequences ! assert_equal(@obj.total_sequences, 1121) end def test_positive ! assert_equal(@obj.positive, [1057, 1057]) end def test_positive_hits ! assert_equal(@obj.positive_hits, 1057) end def test_positive_sequences ! assert_equal(@obj.positive_sequences, 1057) end def test_unknown ! assert_equal(@obj.unknown, [0, 0]) end def test_unknown_hits ! assert_equal(@obj.unknown_hits, 0) end def test_unknown_sequences ! assert_equal(@obj.unknown_sequences, 0) end def test_false_pos ! assert_equal(@obj.false_pos, [64, 64]) end def test_false_positive_sequences ! assert_equal(@obj.false_positive_sequences, 64) end def test_false_neg ! assert_equal(@obj.false_neg, 112) end def test_partial ! assert_equal(@obj.partial, 48) end def test_cc ! assert_equal(@obj.cc, {"TAXO-RANGE"=>"??E?V", "MAX-REPEAT"=>"1"}) end def test_taxon_range ! assert_equal(@obj.taxon_range, '??E?V') end def test_max_repeat ! assert_equal(@obj.max_repeat, 1) end def test_site ! assert_equal(@obj.site, [0, nil]) end def test_skip_flag ! assert_equal(@obj.skip_flag, nil) end def test_dr ! assert_equal(@obj.dr.class, Hash) data = ['OPSD_LIMBE', 'T'] ! assert_equal(@obj.dr["O42427"], data) end def test_list_xref flag = '' ! assert_equal(@obj.list_xref(flag), []) end --- 91,190 ---- data = {"FALSE_NEG"=>112, "POSITIVE"=>[1057, 1057], "PARTIAL"=>48, "FALSE_POS"=>[64, 64], "RELEASE"=>["40.7", 103373], "TOTAL"=>[1121, 1121], "UNKNOWN"=>[0, 0]} ! assert_equal(data, @obj.nr) end def test_release ! assert_equal(['40.7', 103373], @obj.release) end def test_swissprot_release_number ! assert_equal('40.7', @obj.swissprot_release_number) end def test_swissprot_release_sequences ! assert_equal(103373, @obj.swissprot_release_sequences) end def test_total ! assert_equal([1121, 1121], @obj.total) end def test_total_hits ! assert_equal(1121, @obj.total_hits) end def test_total_sequences ! assert_equal(1121, @obj.total_sequences) end def test_positive ! assert_equal([1057, 1057], @obj.positive) end def test_positive_hits ! assert_equal(1057, @obj.positive_hits) end def test_positive_sequences ! assert_equal(1057, @obj.positive_sequences) end def test_unknown ! assert_equal([0, 0], @obj.unknown) end def test_unknown_hits ! assert_equal(0, @obj.unknown_hits) end def test_unknown_sequences ! assert_equal(0, @obj.unknown_sequences) end def test_false_pos ! assert_equal([64, 64], @obj.false_pos) end def test_false_positive_sequences ! assert_equal(64, @obj.false_positive_sequences) end def test_false_neg ! assert_equal(112, @obj.false_neg) end def test_partial ! assert_equal(48, @obj.partial) end def test_cc ! assert_equal({"TAXO-RANGE"=>"??E?V", "MAX-REPEAT"=>"1"}, @obj.cc) end def test_taxon_range ! assert_equal('??E?V', @obj.taxon_range) end def test_max_repeat ! assert_equal(1, @obj.max_repeat) end def test_site ! assert_equal([0, nil], @obj.site) end def test_skip_flag ! assert_equal(nil, @obj.skip_flag) end def test_dr ! assert_equal(Hash, @obj.dr.class) data = ['OPSD_LIMBE', 'T'] ! assert_equal(data, @obj.dr["O42427"]) end def test_list_xref flag = '' ! assert_equal([], @obj.list_xref(flag)) end *************** *** 1247,1251 **** "P23275", "Q01338"] ! assert_equal(@obj.list_truepositive, data) end --- 1247,1251 ---- "P23275", "Q01338"] ! assert_equal(data, @obj.list_truepositive) end *************** *** 1315,1319 **** "P34529", "Q00126"] ! assert_equal(@obj.list_falsenegative, data) end --- 1315,1319 ---- "P34529", "Q00126"] ! assert_equal(data, @obj.list_falsenegative) end *************** *** 1367,1371 **** "Q62953", "Q95195"] ! assert_equal(@obj.list_falsepositive, data) end --- 1367,1371 ---- "Q62953", "Q95195"] ! assert_equal(data, @obj.list_falsepositive) end *************** *** 1419,1442 **** "Q62953", "Q95195"] ! assert_equal(@obj.list_potentialhit, data) end def test_list_unknown data = [] ! assert_equal(@obj.list_unknown, data) end def test_pdb_xref data = ["1BOJ", "1BOK", "1F88"] ! assert_equal(@obj.pdb_xref, data) end def test_pdoc_xref data = "PDOC00210" ! assert_equal(@obj.pdoc_xref, data) end def test_pa2re ! assert_equal(@obj.pa2re, '') end --- 1419,1442 ---- "Q62953", "Q95195"] ! assert_equal(data, @obj.list_potentialhit) end def test_list_unknown data = [] ! assert_equal(data, @obj.list_unknown) end def test_pdb_xref data = ["1BOJ", "1BOK", "1F88"] ! assert_equal(data, @obj.pdb_xref) end def test_pdoc_xref data = "PDOC00210" ! assert_equal(data, @obj.pdoc_xref) end def test_pa2re ! assert_equal('', @obj.pa2re) end From nakao at pub.open-bio.org Wed Nov 23 06:40:47 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:36:22 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/shell/plugin test_seq.rb, 1.1, 1.2 Message-ID: <200511231140.jANBelVL016578@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv16568/test/unit/bio/shell/plugin Modified Files: test_seq.rb Log Message: * Fixed the order of argument of assert_equal. Index: test_seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/shell/plugin/test_seq.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_seq.rb 28 Oct 2005 02:03:34 -0000 1.1 --- test_seq.rb 23 Nov 2005 11:40:45 -0000 1.2 *************** *** 35,58 **** def test_naseq str = 'ACGT' ! assert_equal(naseq(str).class, Bio::Sequence::NA) ! assert_equal(naseq(str), Bio::Sequence::NA.new(str)) ! assert_equal(naseq(str), 'acgt') end def test_aaseq str = 'WD' ! assert_equal(aaseq(str).class, Bio::Sequence::AA) ! assert_equal(aaseq(str), Bio::Sequence::AA.new('WD')) ! assert_equal(aaseq(str), 'WD') end def test_revseq str = 'acgta' ! assert_equal(revseq(str), 'tacgt') end def test_translate str = 'ATGATG' ! assert_equal(translate(str), Bio::Sequence::AA.new('MM')) end --- 35,58 ---- def test_naseq str = 'ACGT' ! assert_equal(Bio::Sequence::NA, naseq(str).class) ! assert_equal(Bio::Sequence::NA.new(str), naseq(str)) ! assert_equal('acgt', naseq(str)) end def test_aaseq str = 'WD' ! assert_equal(Bio::Sequence::AA, aaseq(str).class) ! assert_equal(Bio::Sequence::AA.new('WD'), aaseq(str)) ! assert_equal('WD', aaseq(str)) end def test_revseq str = 'acgta' ! assert_equal('tacgt', revseq(str)) end def test_translate str = 'ATGATG' ! assert_equal(Bio::Sequence::AA.new('MM'), translate(str)) end *************** *** 60,64 **** str = 'ACGT' output = '' ! assert_equal(seq_report(str), output) end --- 60,64 ---- str = 'ACGT' output = '' ! assert_equal(output, seq_report(str)) end *************** *** 67,71 **** str = 'WD' output = '' ! assert_equal(seq_report(str), output) end --- 67,71 ---- str = 'WD' output = '' ! assert_equal(output, seq_report(str)) end *************** *** 89,93 **** // END ! assert_equal(na_report(naseq), output) end --- 89,93 ---- // END ! assert_equal(output, na_report(naseq)) end *************** *** 102,106 **** // END ! assert_equal(aa_report(aaseq), output) end --- 102,106 ---- // END ! assert_equal(output, aa_report(aaseq)) end *************** *** 125,129 **** at END ! assert_equal(double_helix(seq), output) end --- 125,129 ---- at END ! assert_equal(output, doublehelix(seq)) end From nakao at pub.open-bio.org Wed Nov 23 06:44:14 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:39:49 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_db.rb,1.1,1.2 Message-ID: <200511231144.jANBiEVL016606@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv16596/test/unit/bio Modified Files: test_db.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_db.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_db.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_db.rb 24 Sep 2005 23:23:00 -0000 1.1 --- test_db.rb 23 Nov 2005 11:44:12 -0000 1.2 *************** *** 45,57 **** def test_tags ! assert_equal(@obj.tags, ["TAG"]) end def test_exists ! assert_equal(@obj.exists?("TAG"), true) end def test_get ! assert_equal(@obj.get("TAG"), "TAG value1\n value2") end --- 45,57 ---- def test_tags ! assert_equal(["TAG"], @obj.tags) end def test_exists ! assert_equal(true, @obj.exists?("TAG")) end def test_get ! assert_equal("TAG value1\n value2", @obj.get("TAG")) end *************** *** 72,76 **** def test_fetch ! assert_equal(@obj.fetch("LOCUS"), 'locus') end --- 72,76 ---- def test_fetch ! assert_equal('locus', @obj.fetch("LOCUS")) end *************** *** 100,105 **** def test_fetch ! assert_equal(@obj.fetch("ID"), 'id') ! assert_equal(@obj.fetch("CC"), 'cc1 cc2') end --- 100,105 ---- def test_fetch ! assert_equal('id', @obj.fetch("ID")) ! assert_equal('cc1 cc2', @obj.fetch("CC")) end From nakao at pub.open-bio.org Wed Nov 23 06:47:14 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:42:49 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_feature.rb,1.1,1.2 Message-ID: <200511231147.jANBlEVL016625@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv16615/test/unit/bio Modified Files: test_feature.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_feature.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_feature.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_feature.rb 24 Sep 2005 14:20:18 -0000 1.1 --- test_feature.rb 23 Nov 2005 11:47:12 -0000 1.2 *************** *** 39,47 **** def test_qualifier ! assert_equal(@obj.qualifier, 'gene') end def test_value ! assert_equal(@obj.value, 'CDS') end end --- 39,47 ---- def test_qualifier ! assert_equal('gene', @obj.qualifier) end def test_value ! assert_equal('CDS', @obj.value) end end *************** *** 62,84 **** def test_feature ! assert_equal(@obj.feature, "source") end def test_position ! assert_equal(@obj.position, '1..615') end def test_qualifiers ! assert_equal(@obj.qualifiers, [@qualifier]) end def test_locations ! assert_equal(@obj.locations.first.from, 1) ! assert_equal(@obj.locations.first.to, 615) end def test_append_nil assert(@obj.append(nil)) ! assert_equal(@obj.qualifiers.size, 1) end --- 62,84 ---- def test_feature ! assert_equal("source", @obj.feature) end def test_position ! assert_equal('1..615', @obj.position) end def test_qualifiers ! assert_equal([@qualifier], @obj.qualifiers) end def test_locations ! assert_equal(1, @obj.locations.first.from) ! assert_equal(615, @obj.locations.first.to) end def test_append_nil assert(@obj.append(nil)) ! assert_equal(1, @obj.qualifiers.size) end *************** *** 86,95 **** qualifier = Bio::Feature::Qualifier.new('db_xref', 'taxon:3702') assert(@obj.append(qualifier)) ! assert_equal(@obj.qualifiers.last.qualifier, 'db_xref') end def test_each @obj.each do |qua| ! assert_equal(qua.value, 'Arabidopsis thaliana') end end --- 86,95 ---- qualifier = Bio::Feature::Qualifier.new('db_xref', 'taxon:3702') assert(@obj.append(qualifier)) ! assert_equal('db_xref', @obj.qualifiers.last.qualifier) end def test_each @obj.each do |qua| ! assert_equal('Arabidopsis thaliana', qua.value) end end *************** *** 97,101 **** def test_assoc @obj.append(Bio::Feature::Qualifier.new("organism", "Arabidopsis thaliana")) ! assert_equal(@obj.assoc, {"organism" => "Arabidopsis thaliana"}) end end --- 97,101 ---- def test_assoc @obj.append(Bio::Feature::Qualifier.new("organism", "Arabidopsis thaliana")) ! assert_equal({"organism" => "Arabidopsis thaliana"}, @obj.assoc) end end *************** *** 107,126 **** def test_features ! assert_equal(@obj.features.size, 1) end def test_append assert(@obj.append(Bio::Feature.new('gene', '1..615', []))) ! assert_equal(@obj.features.size, 2) end def test_each @obj.each do |feature| ! assert_equal(feature.feature, 'gene') end end def test_arg # def [](*arg) ! assert_equal(@obj[0].feature, 'gene') end end --- 107,126 ---- def test_features ! assert_equal(1, @obj.features.size) end def test_append assert(@obj.append(Bio::Feature.new('gene', '1..615', []))) ! assert_equal(2, @obj.features.size) end def test_each @obj.each do |feature| ! assert_equal('gene', feature.feature) end end def test_arg # def [](*arg) ! assert_equal('gene', @obj[0].feature) end end From nakao at pub.open-bio.org Wed Nov 23 06:49:52 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:45:25 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_shell.rb,1.1,1.2 Message-ID: <200511231149.jANBnqVL016642@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv16632/test/unit/bio Modified Files: test_shell.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_shell.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_shell.rb 27 Oct 2005 15:10:48 -0000 1.1 --- test_shell.rb 23 Nov 2005 11:49:50 -0000 1.2 *************** *** 32,40 **** def test_const_bioruby_config ! assert_equal($bioruby_config, {}) end def test_const_bioruby_cache ! assert_equal($bioruby_cache, {}) end --- 32,40 ---- def test_const_bioruby_config ! assert_equal({}, $bioruby_config) end def test_const_bioruby_cache ! assert_equal({}, $bioruby_cache) end From nakao at pub.open-bio.org Wed Nov 23 06:55:19 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Wed Nov 23 06:50:52 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/util test_contingency_table.rb, 1.1, 1.2 Message-ID: <200511231155.jANBtJVL016678@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/util In directory pub.open-bio.org:/tmp/cvs-serv16668/test/unit/bio/util Modified Files: test_contingency_table.rb Log Message: * Fixed the order of arguments of assert_equal. Index: test_contingency_table.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/util/test_contingency_table.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_contingency_table.rb 15 Nov 2005 16:42:54 -0000 1.1 --- test_contingency_table.rb 23 Nov 2005 11:55:17 -0000 1.2 *************** *** 84,96 **** ! #assert_equal(results[0][2], 2.4) ! assert_equal(results[0][2].to_s, '2.4') ! assert_equal(results[0][3].to_s, '0.534522483824849') ! assert_equal(results[5][2].to_s, '12.0') ! assert_equal(results[5][3].to_s, '0.816496580927726') ! assert_equal(results[9][2].to_s, '2.4') ! assert_equal(results[9][3].to_s, '0.534522483824849') ctable = Bio::ContingencyTable.new --- 84,96 ---- ! #assert_equal(2.4, results[0][2]) ! assert_equal('2.4', results[0][2].to_s) ! assert_equal('0.534522483824849', results[0][3].to_s) ! assert_equal('12.0', results[5][2].to_s) ! assert_equal('0.816496580927726', results[5][3].to_s) ! assert_equal('2.4', results[9][2].to_s) ! assert_equal('0.534522483824849', results[9][3].to_s) ctable = Bio::ContingencyTable.new *************** *** 98,104 **** ctable.table['a']['g'] = 2 ctable.table['g']['t'] = 3 ! assert_equal(ctable.chi_square.to_s, '1.28571428571429') ! assert_equal(ctable.row_sum_all, ctable.column_sum_all) ! assert_equal(ctable.table_sum_all, ctable.column_sum_all) end --- 98,104 ---- ctable.table['a']['g'] = 2 ctable.table['g']['t'] = 3 ! assert_equal('1.28571428571429', ctable.chi_square.to_s) ! assert_equal(ctable.column_sum_all, ctable.row_sum_all) ! assert_equal(ctable.column_sum_all, ctable.table_sum_all) end From k at pub.open-bio.org Thu Nov 24 11:19:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 11:15:20 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.7,1.8 Message-ID: <200511241619.jAOGJeVL021168@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv21154/lib/bio/shell Modified Files: core.rb Log Message: * load_object_file/save_objectfile : Every kind of object is now successfully restored. This idea is contributed by Koichi Sasada. (Previously, this method failed to restore the Bio::GenBank object etc. when it contains unescaped string. Other approach to accomplish this ploblem is to use String#dump method when loading) Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** core.rb 14 Nov 2005 02:01:54 -0000 1.7 --- core.rb 24 Nov 2005 16:19:38 -0000 1.8 *************** *** 282,287 **** hash.each do |k, v| begin ! # p [k, v, v.class, Marshal.load(v)] ! eval("#{k} = Marshal.load('#{v}')", bind) rescue puts "Warning: object '#{k}' couldn't be loaded : #{$!}" --- 282,287 ---- hash.each do |k, v| begin ! Thread.current[:restore_value] = v ! eval("#{k} = Thread.current[:restore_value]", bind) rescue puts "Warning: object '#{k}' couldn't be loaded : #{$!}" *************** *** 312,316 **** value = eval(elem, bind) if value ! hash[elem] = Marshal.dump(value) end end --- 312,316 ---- value = eval(elem, bind) if value ! hash[elem] = value end end *************** *** 326,329 **** --- 326,330 ---- end end + ### history From ngoto at pub.open-bio.org Thu Nov 24 11:21:02 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Thu Nov 24 11:16:31 2005 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.9,1.10 Message-ID: <200511241621.jAOGL2VL021180@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv21161 Modified Files: alignment.rb Log Message: completely rewritten. too many changes. changes will be described in the document later Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** alignment.rb 26 Sep 2005 13:00:04 -0000 1.9 --- alignment.rb 24 Nov 2005 16:21:00 -0000 1.10 *************** *** 1,7 **** # ! # bio/alignment.rb - multiple alignment of sequences # ! # Copyright (C) 2003 GOTO Naohisa # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public --- 1,13 ---- # ! # = bio/alignment.rb - multiple alignment of sequences [...2932 lines suppressed...] ! # Please refer document of OriginalAlignment.new. ! def self.new(*arg) ! OriginalAlignment.new(*arg) ! end ! # creates a new Bio::Alignment::OriginalAlignment object. ! # Please refer document of OriginalAlignment.new2. ! def self.new2(*arg) ! OriginalAlignment.new2(*arg) ! end ! # creates a new Bio::Alignment::OriginalAlignment object. ! # Please refer document of OriginalAlignment.readfiles. ! def self.readfiles(*files) ! OriginalAlignment.readfiles(*files) ! end ! end #class Alignment ! end #module Bio From k at pub.open-bio.org Thu Nov 24 11:57:46 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 11:53:10 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.8,1.9 Message-ID: <200511241657.jAOGvkVL021336@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv21332/lib/bio/shell Modified Files: core.rb Log Message: * fixed to check whether the object can be dumped by Marshal Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** core.rb 24 Nov 2005 16:19:38 -0000 1.8 --- core.rb 24 Nov 2005 16:57:43 -0000 1.9 *************** *** 312,316 **** value = eval(elem, bind) if value ! hash[elem] = value end end --- 312,321 ---- value = eval(elem, bind) if value ! begin ! Marshal.dump(value) ! hash[elem] = value ! rescue ! # value could not be dumped. ! end end end From k at pub.open-bio.org Thu Nov 24 14:30:09 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 14:25:38 2005 Subject: [BioRuby-cvs] bioruby/bin bioruby,1.6,1.7 Message-ID: <200511241930.jAOJU9VL021783@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/bin In directory pub.open-bio.org:/tmp/cvs-serv21764/bin Modified Files: bioruby Log Message: * global variable $bioruby_config and $bioruby_cache are removed (changed to use Bio::Shell::Core::Config & Cache, which have accessor methods like Bio::Shell.config(param, value), Bio::Shell.cache(param, value)) Index: bioruby =================================================================== RCS file: /home/repository/bioruby/bioruby/bin/bioruby,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bioruby 14 Nov 2005 02:01:53 -0000 1.6 --- bioruby 24 Nov 2005 19:30:07 -0000 1.7 *************** *** 48,54 **** begin require 'irb/completion' ! $bioruby_cache[:READLINE] = true rescue LoadError ! $bioruby_cache[:READLINE] = false end --- 48,54 ---- begin require 'irb/completion' ! Bio::Shell.cache(:readline, true) rescue LoadError ! Bio::Shell.cache(:readline, false) end *************** *** 72,81 **** :RETURN => " ==> %s\n" } ! if $bioruby_config[:COLOR] IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR else IRB.conf[:PROMPT_MODE] = :BIORUBY end ! IRB.conf[:ECHO] = $bioruby_config[:ECHO] || false # irb/input-method.rb >= v1.5 (not in 1.8.2) --- 72,81 ---- :RETURN => " ==> %s\n" } ! if Bio::Shell.config(:color) IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR else IRB.conf[:PROMPT_MODE] = :BIORUBY end ! IRB.conf[:ECHO] = Bio::Shell.config(:echo) || false # irb/input-method.rb >= v1.5 (not in 1.8.2) From k at pub.open-bio.org Thu Nov 24 14:30:10 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 14:25:40 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.3,1.4 Message-ID: <200511241930.jAOJUAVL021790@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv21764/lib/bio/shell/plugin Modified Files: codon.rb Log Message: * global variable $bioruby_config and $bioruby_cache are removed (changed to use Bio::Shell::Core::Config & Cache, which have accessor methods like Bio::Shell.config(param, value), Bio::Shell.cache(param, value)) Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** codon.rb 14 Nov 2005 02:01:54 -0000 1.3 --- codon.rb 24 Nov 2005 19:30:08 -0000 1.4 *************** *** 155,159 **** def codontable(num = 1) ! cct = ColoredCodonTable.new(num, $bioruby_config[:COLOR]) display cct.output return cct.table --- 155,159 ---- def codontable(num = 1) ! cct = ColoredCodonTable.new(num, Bio::Shell.config(:color)) display cct.output return cct.table From k at pub.open-bio.org Thu Nov 24 14:30:10 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 14:26:09 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb, 1.9, 1.10 session.rb, 1.5, 1.6 Message-ID: <200511241930.jAOJUAVL021787@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv21764/lib/bio/shell Modified Files: core.rb session.rb Log Message: * global variable $bioruby_config and $bioruby_cache are removed (changed to use Bio::Shell::Core::Config & Cache, which have accessor methods like Bio::Shell.config(param, value), Bio::Shell.cache(param, value)) Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** session.rb 14 Nov 2005 02:01:54 -0000 1.5 --- session.rb 24 Nov 2005 19:30:08 -0000 1.6 *************** *** 48,61 **** end ### config def config(mode = :show, *opts) ! Bio::Shell.config(mode, *opts) end ! ### script ! def script(mode = nil) ! Bio::Shell.script(mode) end --- 48,82 ---- end + ### script + + def script(mode = nil) + Bio::Shell.script(mode) + end + ### config def config(mode = :show, *opts) ! case mode ! when :show, "show" ! Bio::Shell.config_show ! when :echo, "echo" ! Bio::Shell.config_echo ! when :color, "color" ! Bio::Shell.config_color ! when :pager, "pager" ! Bio::Shell.config_pager(*opts) ! when :message, "message" ! Bio::Shell.config_message(*opts) ! end end ! def reload_config ! Bio::Shell.load_config ! end ! ### object ! ! def reload_object ! Bio::Shell.load_object end *************** *** 68,71 **** --- 89,100 ---- ### pager + def pager(cmd = nil) + unless Bio::Shell.config(:pager) + cmd = ENV['PAGER'] || cmd + end + Bio::Shell.config_pager(cmd) + puts "Pager is set to '#{cmd ? cmd : 'off'}'" + end + #-- # mysql> pager less *************** *** 73,78 **** def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html ! if $bioruby_config[:PAGER] ! pg = IO.popen($bioruby_config[:PAGER], "w") begin stdout_save = STDOUT.clone --- 102,107 ---- def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html ! if Bio::Shell.config(:pager) ! pg = IO.popen(Bio::Shell.config(:pager), "w") begin stdout_save = STDOUT.clone *************** *** 89,92 **** --- 118,141 ---- end + def less(file) + #Readline.completion_proc = proc {|p| + # Dir.glob("#{p}*") + #} + pager = ENV['PAGER'] || "less" + system("#{pager} #{file}") + end + + def head(file, num = 10) + str = "" + File.open(file) do |f| + num.times do + if line = f.gets + str << line + end + end + end + display str + end + ### file system *************** *** 125,140 **** display str end - end - - def head(file, num = 10) - str = "" - File.open(file) do |f| - num.times do - if line = f.gets - str << line - end - end - end - display str end --- 174,177 ---- Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** core.rb 24 Nov 2005 16:57:43 -0000 1.9 --- core.rb 24 Nov 2005 19:30:08 -0000 1.10 *************** *** 56,59 **** --- 56,81 ---- } + # A hash to store persistent configurations + Config = {} + + # A hash to store temporal (per session) configurations + Cache = {} + + attr_accessor :config, :cache + + def config(param, value = nil) + if value + Config[param] = value + end + return Config[param] + end + + def cache(param, value = nil) + if value + Cache[param] = value + end + return Cache[param] + end + ### save/restore the environment *************** *** 64,76 **** end - #-- - # *TODO* is this needed? (for reset) - #++ - def reload - load_config - load_plugin - load_object - end - def open load_object --- 86,89 ---- *************** *** 112,116 **** raise "BioRuby shell runs on Ruby version >= 1.8.2" end ! if $bioruby_config[:MARSHAL] and $bioruby_config[:MARSHAL] != MARSHAL raise "Marshal version mismatch" end --- 125,129 ---- raise "BioRuby shell runs on Ruby version >= 1.8.2" end ! if Config[:marshal] and Config[:marshal] != MARSHAL raise "Marshal version mismatch" end *************** *** 127,134 **** # 1. ask to save in SAVEDIR directory in the current directory # 2. otherwise save in USERDIR directory ! # 3. remember the choice in $bioruby_cache[:SAVEDIR] once per session def ask_save_dir ! if $bioruby_cache[:SAVEDIR] ! dir = $bioruby_cache[:SAVEDIR] else dir = SAVEDIR --- 140,147 ---- # 1. ask to save in SAVEDIR directory in the current directory # 2. otherwise save in USERDIR directory ! # 3. remember the choice in Cache[:savedir] once per session def ask_save_dir ! if Cache[:savedir] ! dir = Cache[:savedir] else dir = SAVEDIR *************** *** 145,149 **** end end ! $bioruby_cache[:SAVEDIR] = dir end return dir --- 158,162 ---- end end ! Cache[:savedir] = dir end return dir *************** *** 174,178 **** print "Loading config (#{file}) ... " if hash = YAML.load(File.read(file)) ! $bioruby_config.update(hash) end puts "done" --- 187,191 ---- print "Loading config (#{file}) ... " if hash = YAML.load(File.read(file)) ! Config.update(hash) end puts "done" *************** *** 189,193 **** print "Saving config (#{file}) ... " File.open(file, "w") do |f| ! f.puts $bioruby_config.to_yaml end puts "done" --- 202,206 ---- print "Saving config (#{file}) ... " File.open(file, "w") do |f| ! f.puts Config.to_yaml end puts "done" *************** *** 197,217 **** end - def config(mode, *opts) - case mode - when :show, "show" - config_show - when :echo, "echo" - config_echo - when :color, "color" - config_color - when :pager, "pager" - config_pager(*opts) - when :message, "message" - config_message(*opts) - end - end - def config_show ! $bioruby_config.each do |k, v| puts "#{k}\t= #{v.inspect}" end --- 210,215 ---- end def config_show ! Config.each do |k, v| puts "#{k}\t= #{v.inspect}" end *************** *** 220,225 **** def config_echo bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! $bioruby_config[:ECHO] ! $bioruby_config[:ECHO] = IRB.conf[:ECHO] = flag eval("conf.echo = #{flag}", bind) puts "Echo #{flag ? 'on' : 'off'}" --- 218,223 ---- def config_echo bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! Config[:echo] ! Config[:echo] = IRB.conf[:ECHO] = flag eval("conf.echo = #{flag}", bind) puts "Echo #{flag ? 'on' : 'off'}" *************** *** 228,233 **** def config_color bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! $bioruby_config[:COLOR] ! $bioruby_config[:COLOR] = flag if flag IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR --- 226,231 ---- def config_color bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! Config[:color] ! Config[:color] = flag if flag IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR *************** *** 240,249 **** def config_pager(cmd = nil) ! $bioruby_config[:PAGER] = cmd end def config_message(str = nil) str ||= Bio::Shell::Core::MESSAGE ! $bioruby_config[:MESSAGE] = str end --- 238,247 ---- def config_pager(cmd = nil) ! Config[:pager] = cmd end def config_message(str = nil) str ||= Bio::Shell::Core::MESSAGE ! Config[:message] = str end *************** *** 321,325 **** end Marshal.dump(hash, f) ! $bioruby_config[:MARSHAL] = MARSHAL rescue raise "Failed to dump (#{file}) : #{$!}" --- 319,323 ---- end Marshal.dump(hash, f) ! Config[:marshal] = MARSHAL rescue raise "Failed to dump (#{file}) : #{$!}" *************** *** 336,340 **** def load_history ! if $bioruby_cache[:READLINE] load_history_file(SITEDIR + HISTORY) load_history_file(USERDIR + HISTORY) --- 334,338 ---- def load_history ! if Cache[:readline] load_history_file(SITEDIR + HISTORY) load_history_file(USERDIR + HISTORY) *************** *** 354,358 **** def save_history ! if $bioruby_cache[:READLINE] dir = create_save_dir save_history_file(dir + HISTORY) --- 352,356 ---- def save_history ! if Cache[:readline] dir = create_save_dir save_history_file(dir + HISTORY) *************** *** 377,393 **** case mode when :begin, "begin", :start, "start" ! $bioruby_cache[:SCRIPT] = true script_begin when :end, "end", :stop, "stop" ! $bioruby_cache[:SCRIPT] = false script_end save_script else ! if $bioruby_cache[:SCRIPT] ! $bioruby_cache[:SCRIPT] = false script_end save_script else ! $bioruby_cache[:SCRIPT] = true script_begin end --- 375,391 ---- case mode when :begin, "begin", :start, "start" ! Cache[:script] = true script_begin when :end, "end", :stop, "stop" ! Cache[:script] = false script_end save_script else ! if Cache[:script] ! Cache[:script] = false script_end save_script else ! Cache[:script] = true script_begin end *************** *** 434,439 **** def splash_message ! $bioruby_config[:MESSAGE] ||= MESSAGE ! $bioruby_config[:MESSAGE].to_s.split(//).join(" ") end --- 432,437 ---- def splash_message ! Config[:message] ||= MESSAGE ! Config[:message].to_s.split(//).join(" ") end *************** *** 452,456 **** print "\n" ! if $bioruby_config[:COLOR] 0.step(l,2) do |i| l1 = l-i; l2 = l1/2; l4 = l2/2 --- 450,454 ---- print "\n" ! if Config[:color] 0.step(l,2) do |i| l1 = l-i; l2 = l1/2; l4 = l2/2 *************** *** 465,469 **** end end ! if $bioruby_config[:COLOR] print splash_message_color else --- 463,467 ---- end end ! if Config[:color] print splash_message_color else *************** *** 477,481 **** def closing_splash print "\n\n" ! if $bioruby_config[:COLOR] print splash_message_color else --- 475,479 ---- def closing_splash print "\n\n" ! if Config[:color] print splash_message_color else From k at pub.open-bio.org Thu Nov 24 14:30:09 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 14:26:14 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.7,1.8 Message-ID: <200511241930.jAOJU9VL021785@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv21764/lib/bio Modified Files: shell.rb Log Message: * global variable $bioruby_config and $bioruby_cache are removed (changed to use Bio::Shell::Core::Config & Cache, which have accessor methods like Bio::Shell.config(param, value), Bio::Shell.cache(param, value)) Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shell.rb 14 Nov 2005 02:01:54 -0000 1.7 --- shell.rb 24 Nov 2005 19:30:07 -0000 1.8 *************** *** 31,40 **** require 'pp' - # A hash to store persistent configurations - $bioruby_config = {} - - # A hash to store temporal (per session) configurations - $bioruby_cache = {} - module Bio::Shell --- 31,34 ---- From k at pub.open-bio.org Thu Nov 24 14:32:06 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 14:27:30 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.9,1.10 Message-ID: <200511241932.jAOJW6VL021865@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv21861/lib/bio/shell/plugin Modified Files: seq.rb Log Message: * variable name is changed for readability as commented by Trevor Wennblom Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** seq.rb 16 Nov 2005 04:03:23 -0000 1.9 --- seq.rb 24 Nov 2005 19:32:04 -0000 1.10 *************** *** 208,212 **** n = pos = 0 ! str = [] while n < self.length pos = self[n, size].rindex(separater) --- 208,212 ---- n = pos = 0 ! ary = [] while n < self.length pos = self[n, size].rindex(separater) *************** *** 217,228 **** if pos ! str << self[n, pos+separater.length] n += pos + separater.length else # line too long or the last line ! str << self[n, size] n += size end end ! str = str.join("\n") str[0,0] = prefix + ' ' * (indent - prefix.length) --- 217,228 ---- if pos ! ary << self[n, pos+separater.length] n += pos + separater.length else # line too long or the last line ! ary << self[n, size] n += size end end ! str = ary.join("\n") str[0,0] = prefix + ' ' * (indent - prefix.length) *************** *** 237,238 **** --- 237,239 ---- end end + From k at pub.open-bio.org Thu Nov 24 14:32:51 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Thu Nov 24 14:28:15 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin obda.rb,1.3,1.4 Message-ID: <200511241932.jAOJWpVL021934@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv21930/lib/bio/shell/plugin Modified Files: obda.rb Log Message: * setup_obda is renamed to obda and returns @obda Index: obda.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** obda.rb 14 Nov 2005 02:01:54 -0000 1.3 --- obda.rb 24 Nov 2005 19:32:49 -0000 1.4 *************** *** 33,45 **** private ! def setup_obda unless @obda @obda = Bio::Registry.new end end def obda_get_entry(dbname, entry_id) ! setup_obda ! db = @obda.get_database(dbname) entry = db.get_by_id(entry_id) if block_given? --- 33,45 ---- private ! def obda unless @obda @obda = Bio::Registry.new end + return @obda end def obda_get_entry(dbname, entry_id) ! db = obda.get_database(dbname) entry = db.get_by_id(entry_id) if block_given? From k at pub.open-bio.org Fri Nov 25 06:28:32 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 06:23:53 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io keggapi.rb,1.9,1.10 Message-ID: <200511251128.jAPBSWVL023769@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv23765/lib/ruby/bio/io Modified Files: keggapi.rb Log Message: * fixed bug in get_definitions Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/keggapi.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** keggapi.rb 26 Sep 2005 13:00:08 -0000 1.9 --- keggapi.rb 25 Nov 2005 11:28:30 -0000 1.10 *************** *** 146,150 **** 0.step(ary.length, step) do |i| str = ary[i, step].join(" ") ! if entry = @driver.send(:bget, str) result << entry.to_s end --- 146,150 ---- 0.step(ary.length, step) do |i| str = ary[i, step].join(" ") ! if entry = @driver.send(:btit, str) result << entry.to_s end *************** *** 160,164 **** results.each do |result| def result.filter(fields) ! fields.collect {|field| self.send(field)} end end --- 160,164 ---- results.each do |result| def result.filter(fields) ! fields.collect { |field| self.send(field) } end end From ngoto at pub.open-bio.org Fri Nov 25 10:36:45 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Nov 25 10:32:47 2005 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.10,1.11 Message-ID: <200511251536.jAPFajVL024181@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv24169 Modified Files: alignment.rb Log Message: many changes Bio::Alignment is changed to a module instead of class. GeneralExtension is changed to EnumerableExtension. CharacterProperty is changed to PropertyMethods. Many methods are changed. Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** alignment.rb 24 Nov 2005 16:21:00 -0000 1.10 --- alignment.rb 25 Nov 2005 15:36:43 -0000 1.11 *************** *** 25,31 **** #++ # ! # = About Bio::Alignment class # ! # Bio::Alignment is a multiple alignment container class. # # = References --- 25,31 ---- #++ # ! # = About Bio::Alignment # ! # Please refer document of Bio::Alignment module. # # = References *************** *** 33,52 **** # * Bio::Align::AlignI class of the BioPerl. # http://doc.bioperl.org/releases/bioperl-1.4/Bio/Align/AlignI.html ! # # * Bio::SimpleAlign class of the BioPerl. # http://doc.bioperl.org/releases/bioperl-1.4/Bio/SimpleAlign.html # - # require 'bio/sequence' module Bio - class Alignment ! # Bio::Alignment::CharacterProperty is a module to store # the gap character and so on. ! module CharacterProperty GAP_REGEXP = /[^a-zA-Z]/ GAP_CHAR = '-'.freeze MISSING_CHAR = '?'.freeze --- 33,95 ---- # * Bio::Align::AlignI class of the BioPerl. # http://doc.bioperl.org/releases/bioperl-1.4/Bio/Align/AlignI.html ! # # * Bio::SimpleAlign class of the BioPerl. # http://doc.bioperl.org/releases/bioperl-1.4/Bio/SimpleAlign.html # require 'bio/sequence' module Bio ! =begin rdoc ! ! = About Bio::Alignment ! ! Bio::Alignment is a namespace of classes/modules for multiple sequence ! alignment. ! ! = Multiple alignment container classes ! ! == Bio::Alignment::OriginalAlignment ! ! == Bio::Alignment::SequenceArray ! ! == Bio::Alignment::SequenceHash ! ! = Bio::Alignment::Site ! ! = Modules ! ! == Bio::Alignment::EnumerableExtension ! ! Mix-in for classes included Enumerable. ! ! == Bio::Alignment::ArrayExtension ! ! Mix-in for Array or Array-like classes. ! ! == Bio::Alignment::HashExtension ! ! Mix-in for Hash or Hash-like classes. ! ! == Bio::Alignment::SiteMethods ! ! == Bio::Alignment::PropertyMethods ! ! = Bio::Alignment::GAP ! ! = Compatibility from older BioRuby ! ! =end ! module Alignment ! ! # Bio::Alignment::PropertyMethods is a set of methods to treat # the gap character and so on. ! module PropertyMethods ! # regular expression for detecting gaps. GAP_REGEXP = /[^a-zA-Z]/ + # gap character GAP_CHAR = '-'.freeze + # missing character MISSING_CHAR = '?'.freeze *************** *** 79,84 **** attr_writer :missing_char ! # Returns character property defined in the object as an hash. ! def get_character_property ret = {} if defined? @gap_regexp --- 122,140 ---- attr_writer :missing_char ! # Returns class of the sequence. ! # If instance variable @seqclass (which can be ! # set by 'seqclass=' method) is set, simply returns the value. ! # Otherwise, returns the first sequence's class. ! # If no sequences are found, returns nil. ! def seqclass ! @seqclass or String ! end ! ! # The class of the sequence. ! # The value must be String or its derivatives. ! attr_writer :seqclass ! ! # Returns properties defined in the object as an hash. ! def get_all_property ret = {} if defined? @gap_regexp *************** *** 91,106 **** ret[:missing_char] = @missing_char end ret end ! # Sets character property from given hash. # hash would be a return value of get_character method. ! def set_character_property(hash) @gap_regexp = hash[:gap_regexp] if hash.has_key?(:gap_regexp) @gap_char = hash[:gap_char] if hash.has_key?(:gap_char) @missing_char = hash[:missing_char] if hash.has_key?(:missing_char) self end ! end #module ChacaterProperty # Bio::Alignment::SiteMethods is a set of methods for --- 147,166 ---- ret[:missing_char] = @missing_char end + if defined? @seqclass + ret[:seqclass] = @seqclass + end ret end ! # Sets properties from given hash. # hash would be a return value of get_character method. ! def set_all_property(hash) @gap_regexp = hash[:gap_regexp] if hash.has_key?(:gap_regexp) @gap_char = hash[:gap_char] if hash.has_key?(:gap_char) @missing_char = hash[:missing_char] if hash.has_key?(:missing_char) + @seqclass = hash[:seqclass] if hash.has_key?(:seqclass) self end ! end #module PropertyMethods # Bio::Alignment::SiteMethods is a set of methods for *************** *** 108,112 **** # It can also be used for extending an array of single-letter strings. module SiteMethods ! include CharacterProperty # If there are gaps, returns true. Otherwise, returns false. --- 168,172 ---- # It can also be used for extending an array of single-letter strings. module SiteMethods ! include PropertyMethods # If there are gaps, returns true. Otherwise, returns false. *************** *** 245,258 **** end #module Site ! # The module Bio::Alignment::GeneralExtension is a set of useful # methods for multiple sequence alignment. ! # It can be included to any classes or can be extended to any objects. ! # # The classes or objects must have methods defined in Enumerable, ! # and must have 'each_seq' method # which iterates over each sequence (or string) and yields ! # each sequence (or string) object. ! # Note that the 'each_seq' method would be called multiple times, ! # 'break' would be used in the given block and # destructive methods would be used to the sequences. # --- 305,324 ---- end #module Site ! # The module Bio::Alignment::EnumerableExtension is a set of useful # methods for multiple sequence alignment. ! # It can be included by any classes or can be extended to any objects. # The classes or objects must have methods defined in Enumerable, ! # and must have the each method # which iterates over each sequence (or string) and yields ! # a sequence (or string) object. ! # ! # Optionally, if each_seq method is defined, ! # which iterates over each sequence (or string) and yields ! # each sequence (or string) object, it is used instead of each. ! # ! # Note that the each or each_seq method would be ! # called multiple times. ! # This means that the module is not suitable for IO objects. ! # In addition, break would be used in the given block and # destructive methods would be used to the sequences. # *************** *** 261,266 **** # They have built-in 'each_seq' method. # ! module GeneralExtension ! include CharacterProperty # Returns class of the sequence. --- 327,341 ---- # They have built-in 'each_seq' method. # ! module EnumerableExtension ! include PropertyMethods ! ! # Iterates over each sequences. ! # Yields a sequence. ! # It acts same as Enumerable#each. ! # ! # You would redefine the method suitable for the class/object. ! def each_seq(&block) #:yields: seq ! each(&block) ! end # Returns class of the sequence. *************** *** 284,291 **** end - # The class of the sequence. - # The class is expected to be String or its derivatives. - attr_writer :seqclass - # Returns the alignment length. # Returns the longest length of the sequence in the alignment. --- 359,362 ---- *************** *** 305,311 **** # If the position is out of range, it returns the site # of which all are gaps. ! def alignment_site(position) site = Site.new - site.set_character_property(get_character_property) each_seq do |s| c = s[position, 1] --- 376,381 ---- # If the position is out of range, it returns the site # of which all are gaps. ! def _alignment_site(position) site = Site.new each_seq do |s| c = s[position, 1] *************** *** 317,320 **** --- 387,402 ---- site end + private :_alignment_site + + # Gets a site of the position. + # Returns a Bio::Alignment::Site object. + # + # If the position is out of range, it returns the site + # of which all are gaps. + def alignment_site(position) + site = _alignment_site(position) + site.set_all_property(get_all_property) + site + end # Iterates over each site of the alignment. *************** *** 322,327 **** # It returns self. def each_site (0...alignment_length).each do |i| ! site = alignment_site(i) yield(site) end --- 404,411 ---- # It returns self. def each_site + cp = get_all_property (0...alignment_length).each do |i| ! site = _alignment_site(i) ! site.set_all_property(cp) yield(site) end *************** *** 336,341 **** # start.step(stop, step) { |i| yield alignment_site(i) }. def each_site_step(start, stop, step = 1) start.step(stop, step) do |i| ! site = alignment_site(i) yield(site) end --- 420,427 ---- # start.step(stop, step) { |i| yield alignment_site(i) }. def each_site_step(start, stop, step = 1) + cp = get_all_property start.step(stop, step) do |i| ! site = _alignment_site(i) ! site.set_all_property(cp) yield(site) end *************** *** 351,356 **** # def alignment_collect ! a = Bio::Alignment::SequenceArray.new ! a.set_character_property(get_character_property) each_seq do |str| a << yield(str) --- 437,442 ---- # def alignment_collect ! a = SequenceArray.new ! a.set_all_property(get_all_property) each_seq do |str| a << yield(str) *************** *** 461,465 **** end end - alias consensus consensus_string # Returns the IUPAC consensus string of the alignment --- 547,550 ---- *************** *** 737,742 **** alias subseq alignment_subseq ! # Concatinates the given alignment. ! # The given alignment must have 'each_seq' method. # Returns self. # --- 822,829 ---- alias subseq alignment_subseq ! # Concatenates the given alignment. ! # align must have each_seq ! # or each method. ! # # Returns self. # *************** *** 748,761 **** # def alignment_concat(align) a = [] each_seq { |s| a << s } i = 0 ! align.each_seq do |seq| ! a[i].concat(seq) if a[i] i += 1 end self end ! end #module GeneralExtension # ClustalWFormatter is a module to create ClustalW-formatted text --- 835,859 ---- # def alignment_concat(align) + flag = nil a = [] each_seq { |s| a << s } i = 0 ! begin ! align.each_seq do |seq| ! flag = true ! a[i].concat(seq) if a[i] and seq ! i += 1 ! end ! return self ! rescue NoMethodError, ArgumentError => evar ! raise evar if flag ! end ! align.each do |seq| ! a[i].concat(seq) if a[i] and seq i += 1 end self end ! end #module EnumerableExtension # ClustalWFormatter is a module to create ClustalW-formatted text *************** *** 838,847 **** aln = [ "CLUSTAL (0.00) multiple sequence alignment\n\n" ] len = seqs.seq_length ! ! if !options.has_key?(:avoid_same_name) or options[:avoid_same_name] ! sn = avoid_same_name(names) ! else ! sn = names.collect { |x| x.to_s.gsub(/[\r\n\x00]/, ' ') } ! end if options[:replace_space] sn.collect! { |x| x.gsub(/\s/, '_') } --- 936,940 ---- aln = [ "CLUSTAL (0.00) multiple sequence alignment\n\n" ] len = seqs.seq_length ! sn = names.collect { |x| x.to_s.gsub(/[\r\n\x00]/, ' ') } if options[:replace_space] sn.collect! { |x| x.gsub(/\s/, '_') } *************** *** 853,856 **** --- 946,952 ---- sn.collect! { |x| x.split(/\s/)[0].to_s } end + if !options.has_key?(:avoid_same_name) or options[:avoid_same_name] + sn = avoid_same_name(sn) + end if sn.find { |x| x.length > 10 } then *************** *** 921,930 **** # (It can also be included in Array, though not recommended.) # ! # It possesses all methods defined in GeneralExtension. ! # For usage of methods, please refer to GeneralExtension. module ArrayExtension ! include GeneralExtension ! def each_seq(&block) each(&block) end --- 1017,1030 ---- # (It can also be included in Array, though not recommended.) # ! # It possesses all methods defined in EnumerableExtension. ! # For usage of methods, please refer to EnumerableExtension. module ArrayExtension ! include EnumerableExtension ! # Iterates over each sequences. ! # Yields a sequence. ! # ! # It works the same as Array#each. ! def each_seq(&block) #:yields: seq each(&block) end *************** *** 943,961 **** # (It can also be included in Hash, though not recommended.) # ! # It possesses all methods defined in GeneralExtension. ! # For usage of methods, please refer to GeneralExtension. # # Because the order of the objects in a hash is inconstant, # some methods strictly affected with the order of objects # might not work correctly, ! # e.g. GeneralExtension#convert_match, #convert_unmatch ! # and #alignment_concat. module HashExtension ! include GeneralExtension ! def each_seq(&block) each_value(&block) end include ClustalWFormatter # Returns a string of Clustal W formatted text of the alignment. --- 1043,1127 ---- # (It can also be included in Hash, though not recommended.) # ! # It possesses all methods defined in EnumerableExtension. ! # For usage of methods, please refer to EnumerableExtension. ! # ! # Because SequenceHash#alignment_collect is redefined, ! # some methods' return value's class are changed to ! # SequenceHash instead of SequenceArray. # # Because the order of the objects in a hash is inconstant, # some methods strictly affected with the order of objects # might not work correctly, ! # e.g. EnumerableExtension#convert_match and #convert_unmatch. module HashExtension ! include EnumerableExtension ! # Iterates over each sequences. ! # Yields a sequence. ! # ! # It works the same as Hash#each_value. ! def each_seq(&block) #:yields: seq each_value(&block) end + # Iterates over each sequence and each results running block + # are collected and returns a new alignment as a + # Bio::Alignment::SequenceHash object. + # + # Note that it would be redefined if you want to change + # return value's class. + # + def alignment_collect + a = SequenceHash.new + a.set_all_property(get_all_property) + each_pair do |key, str| + a.store(key, yield(str)) + end + a + end + + # Concatenates the given alignment. + # If align is a Hash (or SequenceHash), + # sequences of same keys are concatenated. + # Otherwise, align must have each_seq + # or each method and + # works same as EnumerableExtension#alignment_concat. + # + # Returns self. + # + # Note that it is a destructive method. + # + def alignment_concat(align) + flag = nil + begin + align.each_pair do |key, seq| + flag = true + if origseq = self[key] + origseq.concat(seq) + end + end + return self + rescue NoMethodError, ArgumentError =>evar + raise evar if flag + end + a = values + i = 0 + begin + align.each_seq do |seq| + flag = true + a[i].concat(seq) if a[i] and seq + i += 1 + end + return self + rescue NoMethodError, ArgumentError => evar + raise evar if flag + end + align.each do |seq| + a[i].concat(seq) if a[i] and seq + i += 1 + end + self + end + include ClustalWFormatter # Returns a string of Clustal W formatted text of the alignment. *************** *** 973,977 **** # multiple sequence alignment. # Since it inherits Array, it acts completely same as Array. ! # In addition, methods defined in ArrayExtension and GeneralExtension # can be used. class SequenceArray < Array --- 1139,1143 ---- # multiple sequence alignment. # Since it inherits Array, it acts completely same as Array. ! # In addition, methods defined in ArrayExtension and EnumerableExtension # can be used. class SequenceArray < Array *************** *** 982,986 **** # multiple sequence alignment. # Since it inherits Hash, it acts completely same as Hash. ! # In addition, methods defined in HashExtension and GeneralExtension # can be used. class SequenceHash < Hash --- 1148,1152 ---- # multiple sequence alignment. # Since it inherits Hash, it acts completely same as Hash. ! # In addition, methods defined in HashExtension and EnumerableExtension # can be used. class SequenceHash < Hash *************** *** 1030,1036 **** # Bio::Alignment::OriginalAlignment is # the BioRuby original multiple sequence alignment container class. ! # It includes GeneralExtension. # ! # It is recommended only to use methods defined in GeneralExtension # (and the each_seq method). # The method only defined in this class might be obsoleted in the future. --- 1196,1202 ---- # Bio::Alignment::OriginalAlignment is # the BioRuby original multiple sequence alignment container class. ! # It includes HashExtension. # ! # It is recommended only to use methods defined in EnumerableExtension # (and the each_seq method). # The method only defined in this class might be obsoleted in the future. *************** *** 1038,1053 **** class OriginalAlignment - # default value of gap regular expression - GAP_REGEXP = CharacterProperty::GAP_REGEXP - # default value of gap character - GAP_CHAR = CharacterProperty::GAP_CHAR - # default value of missing character - MISSING_CHAR = CharacterProperty::MISSING_CHAR - include Enumerable ! include GeneralExtension include OriginalPrivate # Read files and creates a new alignment object. def self.readfiles(*files) require 'bio/io/flatfile' --- 1204,1214 ---- class OriginalAlignment include Enumerable ! include HashExtension include OriginalPrivate # Read files and creates a new alignment object. + # + # It will be obsoleted. def self.readfiles(*files) require 'bio/io/flatfile' *************** *** 1062,1065 **** --- 1223,1228 ---- # Creates a new alignment object from given arguments. + # + # It will be obsoleted. def self.new2(*arg) self.new(arg) *************** *** 1067,1071 **** # Creates a new alignment object. ! # _seqs_ may be one of follows: # an array of sequences (or strings), # an array of sequence database objects, --- 1230,1234 ---- # Creates a new alignment object. ! # seqs may be one of follows: # an array of sequences (or strings), # an array of sequence database objects, *************** *** 1077,1081 **** end ! # compares object def ==(x) #(original) --- 1240,1245 ---- end ! # If x is the same value, returns true. ! # Otherwise, returns false. def ==(x) #(original) *************** *** 1093,1098 **** end ! # Adds sequences to the alignment. _seqs_ may be ! # _seqs_ may be one of follows: # an array of sequences (or strings), # an array of sequence database objects, --- 1257,1262 ---- end ! # Adds sequences to the alignment. ! # seqs may be one of follows: # an array of sequences (or strings), # an array of sequence database objects, *************** *** 1125,1129 **** end ! # sequence names attr_reader :keys --- 1289,1293 ---- end ! # identifiers (or definitions or names) of the sequences attr_reader :keys *************** *** 1141,1145 **** # stores a sequence with key # (name or definition of the sequence). ! # Unlike __store__ method, the method doesn't allow # same keys. # If the key is already used, returns nil. --- 1305,1309 ---- # stores a sequence with key # (name or definition of the sequence). ! # Unlike __store__ method, the method doesn't allow # same keys. # If the key is already used, returns nil. *************** *** 1259,1263 **** end end ! alias :each_seq :each # Iterates over each key and sequence. --- 1423,1427 ---- end end ! alias each_seq each # Iterates over each key and sequence. *************** *** 1288,1303 **** def new(*arg) na = self.class.new(*arg) ! if defined?(@seqclass) ! na.seqclass = @seqclass ! end ! if defined?(@gap_char) ! na.gap_char = @gap_char ! end ! if defined?(@gap_regexp) ! na.gap_regexp = @gap_regexp ! end ! if defined?(@missing_char) ! na.missing_char = @missing_char ! end na end --- 1452,1456 ---- def new(*arg) na = self.class.new(*arg) ! na.set_all_property(get_all_property) na end *************** *** 1366,1369 **** --- 1519,1524 ---- # If keys are given to the argument, sequences of given keys are # duplicated. + # + # It will be obsoleted. def isolate(*arg) #(original) *************** *** 1388,1394 **** # The method name 'collect_align' will be obsoleted. # Please use 'alignment_collect' instead. ! def collect_align #(original) ! na = self.new self.each_pair do |k, s| na.store(k, yield(s)) --- 1543,1550 ---- # The method name 'collect_align' will be obsoleted. # Please use 'alignment_collect' instead. ! def alignment_collect #(original) ! na = self.class.new ! na.set_all_property(get_all_property) self.each_pair do |k, s| na.store(k, yield(s)) *************** *** 1396,1402 **** na end ! alias alignment_collect collect_align # Removes empty sequences or nil in the alignment. def compact! #(Array-like) --- 1552,1559 ---- na end ! alias collect_align alignment_collect # Removes empty sequences or nil in the alignment. + # (Like Array#compact!) def compact! #(Array-like) *************** *** 1414,1417 **** --- 1571,1575 ---- # Removes empty sequences or nil and returns new alignment. + # (Like Array#compact) def compact #(Array-like) *************** *** 1466,1474 **** # If block is given, it acts like Array#select (Enumerable#select). # Returns a new alignment containing all sequences of the alignment ! # for which return value of given block is not false. # # If no block is given, it acts like the BioPerl's AlignI::select. # Returns a new alignment containing sequences of given keys. # def select(*arg) #(original) --- 1624,1633 ---- # If block is given, it acts like Array#select (Enumerable#select). # Returns a new alignment containing all sequences of the alignment ! # for which return value of given block is not false nor nil. # # If no block is given, it acts like the BioPerl's AlignI::select. # Returns a new alignment containing sequences of given keys. # + # The BioPerl's AlignI::select-like action will be obsoleted. def select(*arg) #(original) *************** *** 1491,1495 **** --- 1650,1659 ---- end + # The method name slice will be obsoleted. + # Please use alignment_slice instead. alias slice alignment_slice + + # The method name subseq will be obsoleted. + # Please use alignment_subseq instead. alias subseq alignment_subseq *************** *** 1565,1593 **** end - # Concatenates given alignment. - def alignment_concat(aln) - if aln.is_a?(self.class) then - aln.each_pair do |k, s| - self[k] << s - end - elsif aln.respond_to?(:each_seq) then - i = 0 - aln.each_seq do |s| - self.order(i) << s - i += 1 - end - else - i = 0 - aln.each do |s| - self.order(i) << s - i += 1 - end - end - self - end - # Replace the specified region of the alignment to aln. # aln:: String or Bio::Alignment object # arg:: same format as String#slice def replace_slice(aln, *arg) #(original) --- 1729,1737 ---- end # Replace the specified region of the alignment to aln. # aln:: String or Bio::Alignment object # arg:: same format as String#slice + # + # It will be obsoleted. def replace_slice(aln, *arg) #(original) *************** *** 1677,1684 **** include ClustalWFormatter def to_clustal(options = {}) clustalw_formatter(self, self.keys, options) end ! end #module Original # Bio::Alignment::GAP is a set of class methods for --- 1821,1833 ---- include ClustalWFormatter + # Returns a string of Clustal W formatted text of the alignment. def to_clustal(options = {}) clustalw_formatter(self, self.keys, options) end ! ! # The method name consensus will be obsoleted. ! # Please use consensus_string instead. ! alias consensus consensus_string ! end #class OriginalAlignment # Bio::Alignment::GAP is a set of class methods for *************** *** 1735,1739 **** OriginalAlignment.readfiles(*files) end ! end #class Alignment end #module Bio --- 1884,1888 ---- OriginalAlignment.readfiles(*files) end ! end #module Alignment end #module Bio From k at pub.open-bio.org Fri Nov 25 10:59:31 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 10:58:12 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/data na.rb,0.17,0.18 Message-ID: <200511251559.jAPFxVVL024419@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory pub.open-bio.org:/tmp/cvs-serv24413/lib/bio/data Modified Files: na.rb Log Message: * names other than atgc are added for bioruby shell Index: na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/na.rb,v retrieving revision 0.17 retrieving revision 0.18 diff -C2 -d -r0.17 -r0.18 *** na.rb 15 Nov 2005 12:43:37 -0000 0.17 --- na.rb 25 Nov 2005 15:59:29 -0000 0.18 *************** *** 70,84 **** NAMES = { ! 'y' => '[tc]', # pYrimidine ! 'r' => '[ag]', # puRine ! 'w' => '[at]', # Weak ! 's' => '[gc]', # Strong ! 'k' => '[tg]', # Keto ! 'm' => '[ac]', # aroMatic ! 'b' => '[tgc]', # not A ! 'd' => '[atg]', # not C ! 'h' => '[atc]', # not G ! 'v' => '[agc]', # not T 'n' => '[atgc]', --- 70,84 ---- NAMES = { ! 'y' => '[tc]', ! 'r' => '[ag]', ! 'w' => '[at]', ! 's' => '[gc]', ! 'k' => '[tg]', ! 'm' => '[ac]', ! 'b' => '[tgc]', ! 'd' => '[atg]', ! 'h' => '[atc]', ! 'v' => '[agc]', 'n' => '[atgc]', *************** *** 90,99 **** 'u' => 'u', ! 'A' => 'adenine', ! 'T' => 'thymine', ! 'G' => 'guanine', ! 'C' => 'cytosine', ! 'U' => 'uracil', } --- 90,110 ---- 'u' => 'u', ! 'A' => 'Adenine', ! 'T' => 'Thymine', ! 'G' => 'Guanine', ! 'C' => 'Cytosine', ! 'U' => 'Uracil', ! ! 'Y' => 'pYrimidine', ! 'R' => 'puRine', ! 'W' => 'Weak', ! 'S' => 'Strong', ! 'K' => 'Keto', ! 'M' => 'aroMatic', + 'B' => 'not A', + 'D' => 'not C', + 'H' => 'not G', + 'V' => 'not T', } From k at pub.open-bio.org Fri Nov 25 11:01:30 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 10:58:42 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.4,1.5 Message-ID: <200511251601.jAPG1UVL024501@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv24495/lib/bio/shell/plugin Modified Files: codon.rb Log Message: * changed to use Bio::NucleicAcid.names for full name of the nucleic acids * added functionality to display codon usage in the codon table Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** codon.rb 24 Nov 2005 19:30:08 -0000 1.4 --- codon.rb 25 Nov 2005 16:01:28 -0000 1.5 *************** *** 56,63 **** } ! def initialize(number, color = true) @aacode = Bio::AminoAcid.names @table = Bio::CodonTable[number] @number = number if color generate_colored_text --- 56,64 ---- } ! def initialize(number, color = true, cuhash = nil) @aacode = Bio::AminoAcid.names @table = Bio::CodonTable[number] @number = number + @cuhash = cuhash if color generate_colored_text *************** *** 72,80 **** if aa == '*' code = "STOP" ! aa = '' else code = @aacode[aa] end ! eval("@#{codon} = ' #{code} #{aa} '") end --- 73,86 ---- if aa == '*' code = "STOP" ! aa = '' unless @cuhash else code = @aacode[aa] end ! if @cuhash ! percent = @cuhash[codon].to_s.rjust(6) ! eval("@#{codon} = '#{aa}#{percent}'") ! else ! eval("@#{codon} = ' #{code} #{aa} '") ! end end *************** *** 90,105 **** @table.each do |codon, aa| property, = @@properties.detect {|key, list| list.include?(aa)} if aa == '*' color_code = "#{@@colors[:stop]}STOP" ! color_aa = "" else color_code = "#{@@colors[property]}#{@aacode[aa]}" if @table.start_codon?(codon) ! color_aa = "#{@@colors[:start]}#{aa}" else ! color_aa = "#{@@colors[:aa]}#{aa}" end end ! eval("@#{codon} = ' #{color_code} #{color_aa}#{@@colors[:text]} '") end --- 96,130 ---- @table.each do |codon, aa| property, = @@properties.detect {|key, list| list.include?(aa)} + if aa == '*' color_code = "#{@@colors[:stop]}STOP" ! if @cuhash ! color_aa = "#{@@colors[:stop]}#{aa}" ! else ! color_aa = '' ! end else color_code = "#{@@colors[property]}#{@aacode[aa]}" if @table.start_codon?(codon) ! if @cuhash ! color_aa = "#{@@colors[:aa]}#{aa}" ! else ! color_aa = "#{@@colors[:start]}#{aa}" ! end else ! if @cuhash ! color_aa = "#{@@colors[property]}#{aa}" ! else ! color_aa = "#{@@colors[:aa]}#{aa}" ! end end end ! ! if @cuhash ! percent = @cuhash[codon].to_s.rjust(6) ! eval("@#{codon} = '#{color_aa}#{@@colors[:text]}#{percent}'") ! else ! eval("@#{codon} = ' #{color_code} #{color_aa}#{@@colors[:text]} '") ! end end *************** *** 113,117 **** def output ! text = <<-END # # = Codon table #{@number} : #{@table.definition} --- 138,142 ---- def output ! header = <<-END # # = Codon table #{@number} : #{@table.definition} *************** *** 119,122 **** --- 144,149 ---- # hydrophilic: #{@hydrophilic} # hydrophobic: #{@hydrophobic} + END + table = <<-END # # *---------------------------------------------* *************** *** 147,150 **** --- 174,182 ---- # END + if @cuhash + text = table + else + text = header + table + end text.gsub(/^\s+#/, @@colors[:text]) end *************** *** 154,159 **** private def codontable(num = 1) ! cct = ColoredCodonTable.new(num, Bio::Shell.config(:color)) display cct.output return cct.table --- 186,195 ---- private + def codon_usage_table(num = 1, codon_usage = nil) + ColoredCodonTable.new(num, Bio::Shell.config(:color), codon_usage) + end + def codontable(num = 1) ! cct = codon_usage_table(num) display cct.output return cct.table *************** *** 177,201 **** def nucleicacids ! [ ! [ 'A', 'Adenine' ], ! [ 'T', 'Thymine' ], ! [ 'G', 'Guanine' ], ! [ 'C', 'Cytosine' ], ! [ 'U', 'Uracil' ], ! [ 'r', '[ag]', 'puRine' ], ! [ 'y', '[tc]', 'pYrimidine' ], ! [ 'w', '[at]', 'Weak' ], ! [ 's', '[gc]', 'Strong' ], ! [ 'k', '[tg]', 'Keto' ], ! [ 'm', '[ac]', 'aroMatic' ], ! [ 'b', '[tgc]', 'not A' ], ! [ 'v', '[agc]', 'not T' ], ! [ 'h', '[atc]', 'not G' ], ! [ 'd', '[atg]', 'not C' ], ! [ 'n', '[atgc]', 'any' ], ! ].each do |list| ! puts list.join("\t") end ! return Bio::NucleicAcid.names end --- 213,221 ---- def nucleicacids ! names = Bio::NucleicAcid.names ! %w(a t g c u r y w s k m b v h d n).each do |base| ! puts "#{base}\t#{names[base]}\t#{names[base.upcase]}" end ! return names end From k at pub.open-bio.org Fri Nov 25 10:59:32 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 10:59:24 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio/data test_na.rb,1.4,1.5 Message-ID: <200511251559.jAPFxWVL024423@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/data In directory pub.open-bio.org:/tmp/cvs-serv24413/test/unit/bio/data Modified Files: test_na.rb Log Message: * names other than atgc are added for bioruby shell Index: test_na.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/data/test_na.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_na.rb 23 Nov 2005 05:25:10 -0000 1.4 --- test_na.rb 25 Nov 2005 15:59:29 -0000 1.5 *************** *** 36,40 **** def test_NAMES_1_to_name ! assert_equal('adenine', Bio::NucleicAcid::NAMES['A']) end --- 36,40 ---- def test_NAMES_1_to_name ! assert_equal('Adenine', Bio::NucleicAcid::NAMES['A']) end *************** *** 73,77 **** def test_accessor ! assert_equal('adenine', @obj['A']) end --- 73,77 ---- def test_accessor ! assert_equal('Adenine', @obj['A']) end *************** *** 84,88 **** def test_name ! assert_equal('adenine', @obj.name('A')) end end --- 84,88 ---- def test_name ! assert_equal('Adenine', @obj.name('A')) end end From k at pub.open-bio.org Fri Nov 25 11:05:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 11:01:12 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.10,1.11 Message-ID: <200511251605.jAPG5hVL024583@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv24566/lib/bio/shell/plugin Modified Files: seq.rb Log Message: * seqstat method improved * truncate long sequence to display * compositions are pretty printed with percentage with names * codon usage is now displayed in the codon table (also in color mode) Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** seq.rb 24 Nov 2005 19:32:04 -0000 1.10 --- seq.rb 25 Nov 2005 16:05:41 -0000 1.11 *************** *** 29,32 **** --- 29,33 ---- require 'bio/sequence' require 'bio/util/color_scheme' + require 'bio/shell/plugin/codon' module Bio::Shell *************** *** 99,140 **** # Displays some basic properties of the sequence. def seqstat(str) seq = seq(str) ! rep = "" if seq.respond_to?(:complement) ! rep << "Sequence : #{seq.fold(71,21).strip}\n" ! rep << "Reverse complement : #{seq.complement.fold(71,21).strip}\n" ! rep << "Translation 1 : #{seq.translate.fold(71,21).strip}\n" ! rep << "Translation 2 : #{seq.translate(2).fold(71,21).strip}\n" ! rep << "Translation 3 : #{seq.translate(3).fold(71,21).strip}\n" ! rep << "Translation -1 : #{seq.translate(-1).fold(71,21).strip}\n" ! rep << "Translation -2 : #{seq.translate(-2).fold(71,21).strip}\n" ! rep << "Translation -3 : #{seq.translate(-3).fold(71,21).strip}\n" ! rep << "GC percent : #{seq.gc_percent} %\n" ! rep << "Composition : #{seq.composition.inspect}\n" ! begin ! rep << "Molecular weight : #{seq.molecular_weight}\n" ! rescue ! rep << "Molecular weight : #{$!}\n" end begin ! rep << "Complemnet weight : #{seq.complement.molecular_weight}\n" rescue ! rep << "Complement weight : #{$!}\n" end begin ! rep << "Protein weight : #{seq.translate.molecular_weight}\n" rescue ! rep << "Protein weight : #{$!}\n" end else ! rep << "Sequence : #{seq.fold(71,21).strip}\n" ! rep << "Composition : #{seq.composition.inspect}\n" begin ! rep << "Protein weight : #{seq.molecular_weight}\n" rescue ! rep << "Protein weight : #{$!}\n" end - # rep << "amino acid codes : #{seq.codes.inspect}\n" - # rep << "amino acid names : #{seq.names.inspect}\n" end rep << "//\n" --- 100,174 ---- # Displays some basic properties of the sequence. def seqstat(str) + max = 150 seq = seq(str) ! rep = "\n* * * Sequence statistics * * *\n\n" if seq.respond_to?(:complement) ! fwd = seq ! rev = seq.complement ! if seq.length > max ! dot = " ..." ! fwd = fwd.subseq(1, max) ! rev = rev.subseq(1, max) ! end ! rep << "5'->3' sequence : #{fwd.fold(70,20).strip}#{dot}\n" ! rep << "3'->5' sequence : #{rev.fold(70,20).strip}#{dot}\n" ! [ 1, 2, 3, -1, -2, -3 ].each do |frame| ! pep = fwd.translate(frame).fold(70,20).strip ! rep << "Translation #{frame.to_s.rjust(2)} : #{pep}#{dot}\n" ! end ! rep << "Length : #{seq.length} bp\n" ! rep << "GC percent : #{seq.gc_percent} %\n" ! ! ary = [] ! seq.composition.sort.each do |base, num| ! percent = format("%.2f", 100.0 * num / seq.length).rjust(6) ! count = num.to_s.rjust(seq.length.to_s.length) ! ary << " #{base} - #{count} (#{percent} %)\n" ! end ! rep << "Composition : #{ary.join.strip}\n" ! ! rep << "Codon usage :\n" ! hash = Hash.new("0.0%") ! seq.codon_usage.sort.each do |codon, num| ! percent = format("%.1f%", 100.0 * num / (seq.length / 3)) ! hash[codon] = percent end + rep << codon_usage_table(1, hash).output + begin ! rep << "Molecular weight : #{seq.molecular_weight}\n" rescue ! rep << "Molecular weight : #{$!}\n" end begin ! rep << "Protein weight : #{seq.translate.chomp('*').molecular_weight}\n" rescue ! rep << "Protein weight : #{$!}\n" end else ! pep = seq ! if seq.length > max ! dot = " ..." ! pep = seq.subseq(1, max) ! end ! rep << "N->C sequence : #{pep.fold(70,20).strip}#{dot}\n" ! rep << "Length : #{seq.length} aa\n" ! ! names = Bio::AminoAcid.names ! ary = [] ! seq.composition.sort.each do |aa, num| ! percent = format("%.2f", 100.0 * num / seq.length).rjust(6) ! count = num.to_s.rjust(seq.length.to_s.length) ! code = names[aa] ! name = names[names[aa]] ! ary << " #{aa} #{code} - #{count} (#{percent} %) #{name}\n" ! end ! rep << "Composition : #{ary.join.strip}\n" ! begin ! rep << "Protein weight : #{seq.molecular_weight}\n" rescue ! rep << "Protein weight : #{$!}\n" end end rep << "//\n" From k at pub.open-bio.org Fri Nov 25 11:47:12 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 11:42:37 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin flatfile.rb, 1.6, 1.7 midi.rb, 1.3, 1.4 seq.rb, 1.11, 1.12 Message-ID: <200511251647.jAPGlCVL024829@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv24818/lib/bio/shell/plugin Modified Files: flatfile.rb midi.rb seq.rb Log Message: * raise are changed to warn (not to hang bioruby shell as much as possible) Index: midi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/midi.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** midi.rb 5 Nov 2005 08:38:13 -0000 1.3 --- midi.rb 25 Nov 2005 16:47:10 -0000 1.4 *************** *** 421,425 **** puts "done" rescue ! raise "Failed to save (#{filename}) : #{$!}" end end --- 421,425 ---- puts "done" rescue ! warn "Error: Failed to save (#{filename}) : #{$!}" end end Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** flatfile.rb 16 Nov 2005 04:01:10 -0000 1.6 --- flatfile.rb 25 Nov 2005 16:47:10 -0000 1.7 *************** *** 97,101 **** puts "done" rescue ! raise "Failed to create index (#{idxdir}) : #{$!}" end end --- 97,101 ---- puts "done" rescue ! warn "Error: Failed to create index (#{idxdir}) : #{$!}" end end Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** seq.rb 25 Nov 2005 16:05:41 -0000 1.11 --- seq.rb 25 Nov 2005 16:47:10 -0000 1.12 *************** *** 223,227 **** # size : allowed length of the actual text unless (size = fill_column - indent) > 0 ! raise "[Error] indent > fill_column" end --- 223,229 ---- # size : allowed length of the actual text unless (size = fill_column - indent) > 0 ! warn "Error: indent > fill_column (indent is set to 0)" ! size = fill_column ! indent = 0 end *************** *** 238,242 **** # size : allowed length of the actual text unless (size = fill_column - indent) > 0 ! raise "[Error] indent > fill_column" end --- 240,246 ---- # size : allowed length of the actual text unless (size = fill_column - indent) > 0 ! warn "Error: indent > fill_column (indent is set to 0)" ! size = fill_column ! indent = 0 end From k at pub.open-bio.org Fri Nov 25 11:47:12 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 11:42:39 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.10,1.11 Message-ID: <200511251647.jAPGlCVL024825@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv24818/lib/bio/shell Modified Files: core.rb Log Message: * raise are changed to warn (not to hang bioruby shell as much as possible) Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** core.rb 24 Nov 2005 19:30:08 -0000 1.10 --- core.rb 25 Nov 2005 16:47:10 -0000 1.11 *************** *** 170,174 **** puts "done" rescue ! raise "Failed to create #{dir} : #{$!}" end end --- 170,174 ---- puts "done" rescue ! warn "Error: Failed to create #{dir} : #{$!}" end end *************** *** 206,210 **** puts "done" rescue ! raise "Failed to save (#{file}) : #{$!}" end end --- 206,210 ---- puts "done" rescue ! warn "Error: Failed to save (#{file}) : #{$!}" end end *************** *** 287,291 **** end rescue ! raise "Failed to load (#{file}) : #{$!}" end puts "done" --- 287,291 ---- end rescue ! warn "Error: Failed to load (#{file}) : #{$!}" end puts "done" *************** *** 321,330 **** Config[:marshal] = MARSHAL rescue ! raise "Failed to dump (#{file}) : #{$!}" end end puts "done" rescue ! raise "Failed to save (#{file}) : #{$!}" end end --- 321,330 ---- Config[:marshal] = MARSHAL rescue ! warn "Error: Failed to dump (#{file}) : #{$!}" end end puts "done" rescue ! warn "Error: Failed to save (#{file}) : #{$!}" end end *************** *** 366,370 **** puts "done" rescue ! raise "Failed to save (#{file}) : #{$!}" end end --- 366,370 ---- puts "done" rescue ! warn "Error: Failed to save (#{file}) : #{$!}" end end *************** *** 425,429 **** rescue @script_begin = nil ! raise "Failed to save (#{file}) : #{$!}" end end --- 425,429 ---- rescue @script_begin = nil ! warn "Error: Failed to save (#{file}) : #{$!}" end end From ngoto at pub.open-bio.org Fri Nov 25 11:50:41 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Nov 25 11:46:00 2005 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.11,1.12 Message-ID: <200511251650.jAPGofVL024864@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv24854 Modified Files: alignment.rb Log Message: adds some document Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** alignment.rb 25 Nov 2005 15:36:43 -0000 1.11 --- alignment.rb 25 Nov 2005 16:50:39 -0000 1.12 *************** *** 186,189 **** --- 186,191 ---- # Returns consensus character of the site. + # If consensus is found, eturns a single-letter string. + # If not, returns nil. def consensus_string(threshold = 1.0) return nil if self.size <= 0 *************** *** 220,224 **** ] ! # Returns an IUPAC consensus base for the site def consensus_iupac a = self.collect { |x| x.downcase }.sort.uniq --- 222,228 ---- ] ! # Returns an IUPAC consensus base for the site. ! # If consensus is found, eturns a single-letter string. ! # If not, returns nil. def consensus_iupac a = self.collect { |x| x.downcase }.sort.uniq From k at pub.open-bio.org Fri Nov 25 11:07:57 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 11:48:59 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin keggapi.rb,1.3,1.4 Message-ID: <200511251607.jAPG7vVL024673@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv24669/lib/bio/shell/plugin Modified Files: keggapi.rb Log Message: * some listing methods (orgs, pathways, dbs) are added * @keggapi is changed to be accessed as keggapi Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** keggapi.rb 14 Nov 2005 02:01:54 -0000 1.3 --- keggapi.rb 25 Nov 2005 16:07:55 -0000 1.4 *************** *** 33,45 **** private ! def setup_keggapi unless @keggapi @keggapi = Bio::KEGG::API.new end end def bfind(str) ! setup_keggapi ! result = @keggapi.bfind(str) display result return result --- 33,61 ---- private ! def keggapi unless @keggapi @keggapi = Bio::KEGG::API.new end + return @keggapi + end + + def _definition(list) + ary = [] + list.each do |entry| + ary << "#{entry.entry_id}:\t#{entry.definition}" + end + return ary + end + + # DBGET + + def binfo(db = "all") + result = keggapi.binfo(db) + display result + return result end def bfind(str) ! result = keggapi.bfind(str) display result return result *************** *** 47,70 **** def bget(str) ! setup_keggapi ! entry = @keggapi.bget(str) if block_given? ! yield entry else ! display entry end ! return entry end end =begin - --- list_databases - --- list_organisms - --- list_pathways(org) - --- binfo(string) - --- bfind(string) - --- bget(string) - --- btit(string) --- get_linkdb_by_entry(entry_id, db, start, max_results) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) --- 63,136 ---- def bget(str) ! result = keggapi.bget(str) if block_given? ! yield result else ! display result end ! return result ! end ! ! def btit(str) ! result = keggapi.btit(str) ! display result ! return result ! end ! ! def bconv(str) ! result = keggapi.bconv(str) ! display result ! return result ! end ! ! # DATABASES ! ! def keggdbs ! list = keggapi.list_databases ! result = _definition(list).join("\n") ! display result ! return result ! end ! ! def keggorgs ! list = keggapi.list_organisms ! result = _definition(list).sort.join("\n") ! display result ! return result ! end ! ! def keggpathways(org = "map") ! list = keggapi.list_pathways(org) ! result = _definition(list).join("\n") ! display result ! return result ! end ! ! #-- ! # *TODO* use kegg das instead? ! #++ ! def kegggenome(org) ! result = "" ! require 'net/ftp' ! Net::FTP.open("ftp.genome.jp", "anonymous") do |ftp| ! path = "/pub/kegg/genomes/#{org}" ! list = ftp.nlst(path) ! file = list.grep(/.*genome$/).shift ! if file ! base = File.basename(file) ! ftp.getbinaryfile(file, base) ! result = File.read(base) ! end ! end ! return result end + # def kegggene(genes_id) + # keggapi.bget() + # end + end =begin --- get_linkdb_by_entry(entry_id, db, start, max_results) --- get_best_best_neighbors_by_gene(genes_id, start, max_results) From ngoto at pub.open-bio.org Fri Nov 25 11:53:34 2005 From: ngoto at pub.open-bio.org (Naohisa Goto) Date: Fri Nov 25 11:49:10 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_alignment.rb,1.3,1.4 Message-ID: <200511251653.jAPGrYVL024904@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv24871/test/unit/bio Modified Files: test_alignment.rb Log Message: Added tests for Alignment::PropertyMethods, Alignment::Site Index: test_alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_alignment.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_alignment.rb 24 Sep 2005 03:12:55 -0000 1.3 --- test_alignment.rb 25 Nov 2005 16:53:32 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- # # Copyright (C) 2004 Moses Hohman + # 2005 Naohisa Goto # # This library is free software; you can redistribute it and/or *************** *** 29,32 **** --- 30,247 ---- module Bio + + class TestAlignmentPropertyMethods < Test::Unit::TestCase + + def setup + @obj = Object.new + @obj.extend(Alignment::PropertyMethods) + end + + def test_is_gap_default_false + assert_equal(false, @obj.is_gap?('a'), "\"a\" isn't a gap") + end + + def test_is_gap_default_true + assert_equal(true, @obj.is_gap?('-'), '"-" is a gap') + end + + def test_gap_regexp + assert_not_nil(@obj.gap_regexp) + end + + def test_gap_regexp_never_nil + @obj.gap_regexp = nil + assert_not_nil(@obj.gap_regexp) + end + + def test_gap_regexp=() + @obj.gap_regexp = /[^a-zA-Z0-9]/ + assert_equal(/[^a-zA-Z0-9]/, @obj.gap_regexp) + end + + def test_is_gap_nodefault_false + @obj.gap_regexp = /[^a-zA-Z0-9]/ + assert_equal(false, @obj.is_gap?('3')) + end + + def test_is_gap_nodefault_true + @obj.gap_regexp = /[^atgc]/ + assert_equal(true, @obj.is_gap?('z')) + end + + def test_gap_char_default + assert_not_nil(@obj.gap_char) + end + + def test_gap_char_never_nil + @obj.gap_char = nil + assert_not_nil(@obj.gap_char) + end + + def test_gap_char=() + @obj.gap_char = '#' + assert_equal('#', @obj.gap_char) + end + + def test_missing_char_default + assert_not_nil(@obj.missing_char) + end + + def test_missing_char_never_nil + @obj.missing_char = nil + assert_not_nil(@obj.missing_char) + end + + def test_missing_char=() + @obj.missing_char = '_' + assert_equal('_', @obj.missing_char) + end + + def test_seqclass_default + assert_not_nil(@obj.seqclass) + end + + def test_seqclass_never_nil + @obj.seqclass = nil + assert_not_nil(@obj.seqclass) + end + + def test_seqclass=() + @obj.seqclass = Sequence::NA + assert_equal(Sequence::NA, @obj.seqclass) + end + + def test_get_all_property_default + assert_equal({}, @obj.get_all_property) + end + + def test_get_all_property_nodefault + @obj.gap_regexp = /[^acgt]/ + @obj.gap_char = '#' + @obj.missing_char = '_' + @obj.seqclass = Sequence::NA + assert_equal({ :gap_regexp => /[^acgt]/, + :gap_char => '#', + :missing_char => '_', + :seqclass => Sequence::NA }, + @obj.get_all_property) + end + + def test_set_all_property + h = { :gap_regexp => /[^acgt]/, + :gap_char => '#', + :missing_char => '_', + :seqclass => Sequence::NA } + @obj.set_all_property(h) + assert_equal(h, @obj.get_all_property) + end + end #class TestAlignmentPropertyMethods + + + class TestAlignmentSite < Test::Unit::TestCase + + def test_has_gap_true + site = Alignment::Site[ 'a', '-', 'c', 'g', 't' ] + assert_equal(true, site.has_gap?) + end + + def test_has_gap_false + site = Alignment::Site[ 'a', 'c', 'g', 't' ] + assert_equal(false, site.has_gap?) + end + + def test_remove_gaps! + site = Alignment::Site[ 'a', '-', 'c', '-' ] + assert_equal(Alignment::Site['a', 'c'], site.remove_gaps!) + end + + def test_remove_gaps_bang_not_removed + site = Alignment::Site[ 'a', 'c'] + assert_equal(nil, site.remove_gaps!) + end + + def test_consensus_string_default + site = Alignment::Site[ 'a', 'a', 'a', 'a'] + assert_equal('a', site.consensus_string) + end + + def test_consensus_string_default_nil + site = Alignment::Site[ 'a', 'a', 'a', 'c'] + assert_nil(site.consensus_string) + end + + def test_consensus_string_50percent + site = Alignment::Site[ 'a', 'a', 'c', 'g'] + assert_equal('a', site.consensus_string(0.5)) + end + + def test_consensus_string_50percent_nil + site = Alignment::Site[ 'a', 'c', 'g', 't'] + assert_nil(site.consensus_string(0.5)) + end + + def test_consensus_iupac + data = { + 'a' => [ 'a' ], + 'c' => [ 'c' ], + 'g' => [ 'g' ], + 't' => [ 't' ], + 't' => [ 't', 'u' ], + 'm' => [ 'a', 'c' ], + 'r' => [ 'a', 'g' ], + 'w' => [ 'a', 't' ], + 's' => [ 'c', 'g' ], + 'y' => [ 'c', 't' ], + 'k' => [ 'g', 't' ], + 'v' => [ 'a', 'c', 'g' ], + 'h' => [ 'a', 'c', 't' ], + 'd' => [ 'a', 'g', 't' ], + 'b' => [ 'c', 'g', 't' ], + 'n' => [ 'a', 'c', 'g', 't' ], + nil => [ 'z', 'a' ] + } + data.each do |cons, testdata| + site = Alignment::Site[ *testdata ] + assert_equal(cons, site.consensus_iupac, + "IUPAC consensus of #{testdata.join(',')} is #{cons}") + end + end + + def test_match_line_amino_missing + site = Alignment::Site[ 'P', 'Q', 'R', 'S' ] + assert_equal(' ', site.match_line_amino) + end + + def test_match_line_amino_100percent + site = Alignment::Site[ 'M', 'M', 'M', 'M' ] + assert_equal('*', site.match_line_amino) + end + + def test_match_line_amino_strong + site = Alignment::Site[ 'N', 'E', 'Q', 'K' ] + assert_equal(':', site.match_line_amino) + end + + def test_match_line_amino_weak + site = Alignment::Site[ 'S', 'G', 'N', 'D' ] + assert_equal('.', site.match_line_amino) + end + + def test_match_line_nuc_missing + site = Alignment::Site[ 'A', 'C', 'G', 'T' ] + assert_equal(' ', site.match_line_nuc) + end + + def test_match_line_nuc_100percent + site = Alignment::Site[ 'G', 'G', 'G', 'G' ] + assert_equal('*', site.match_line_nuc) + end + end #class TestAlignmentSite + + + + + + class TestAlignment < Test::Unit::TestCase From k at pub.open-bio.org Fri Nov 25 12:26:56 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Fri Nov 25 12:22:16 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell session.rb,1.6,1.7 Message-ID: <200511251726.jAPHQuVL025302@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv25298/lib/bio/shell Modified Files: session.rb Log Message: * save file function is added Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** session.rb 24 Nov 2005 19:30:08 -0000 1.6 --- session.rb 25 Nov 2005 17:26:54 -0000 1.7 *************** *** 40,48 **** end ! def rm(name) # name = :hoge begin ! eval("#{name} = nil", conf.workspace.binding) rescue ! puts "Usage: rm :var (rm var is not valid)" end end --- 40,55 ---- end ! def rm(name) ! list = eval("local_variables", conf.workspace.binding).reject { |x| ! eval(x, conf.workspace.binding).nil? ! } begin ! if list.include?(name.to_s) ! eval("#{name} = nil", conf.workspace.binding) ! else ! raise ! end rescue ! warn "Usage: rm :var or rm 'var' (rm var is not valid)" end end *************** *** 54,57 **** --- 61,76 ---- end + ### object + + def reload_object + Bio::Shell.load_object + end + + ### plugin + + def reload_plugin + Bio::Shell.load_plugin + end + ### config *************** *** 75,90 **** end - ### object - - def reload_object - Bio::Shell.load_object - end - - ### plugin - - def reload_plugin - Bio::Shell.load_plugin - end - ### pager --- 94,97 ---- *************** *** 97,103 **** end - #-- - # mysql> pager less - #++ def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html --- 104,107 ---- *************** *** 119,125 **** def less(file) - #Readline.completion_proc = proc {|p| - # Dir.glob("#{p}*") - #} pager = ENV['PAGER'] || "less" system("#{pager} #{file}") --- 123,126 ---- *************** *** 136,139 **** --- 137,164 ---- end display str + end + + ### file save + + def save(file, *objs) + if File.exists?(file) + loop do + print "Overwrite existing #{file}? [y/n]: " + answer = gets + return if /^\s*[Nn]/.match(answer) + break if /^\s*[Yy]/.match(answer) + end + end + begin + print "Saving data (#{file}) ... " + File.open(file, "w") do |f| + objs.each do |obj| + f.puts obj.to_s + end + end + puts "done" + rescue + warn "Error: Failed to save (#{file}) : #{$!}" + end end From nakao at pub.open-bio.org Sat Nov 26 01:51:47 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sat Nov 26 01:47:13 2005 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_sequence.rb,1.4,1.5 Message-ID: <200511260651.jAQ6plVL026964@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory pub.open-bio.org:/tmp/cvs-serv26954/test/unit/bio Modified Files: test_sequence.rb Log Message: * Added test_translate_[123456]. * Chaged test_nucleic_acid_names. Index: test_sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/test_sequence.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_sequence.rb 25 Sep 2005 05:17:53 -0000 1.4 --- test_sequence.rb 26 Nov 2005 06:51:45 -0000 1.5 *************** *** 258,262 **** def test_nucleic_acid_names ! assert_equal(["adenine", "cytosine", "guanine", "thymine", "uracil"], Sequence::NA.new('acgtu').names) end --- 258,264 ---- def test_nucleic_acid_names ! # It is a Bio::NucleicAcid feature. ! # assert_equal(["adenine", "cytosine", "guanine", "thymine", "uracil"], Sequence::NA.new('acgtu').names) ! assert(Sequence::NA.new('acgtu').names) end *************** *** 352,354 **** --- 354,386 ---- end end + + + class TestNATranslate < Test::Unit::TestCase + def setup + @obj = Bio::Sequence::NA.new("AAA") + end + + def test_translate + assert_equal("K", @obj.translate) + end + def test_translate_1 + assert_equal("K", @obj.translate(1)) + end + def test_translate_2 + assert_equal("", @obj.translate(2)) + end + def test_translate_3 + assert_equal("", @obj.translate(3)) + end + def test_translate_4 + assert_equal("F", @obj.translate(4)) + end + def test_translate_5 + assert_equal("", @obj.translate(5)) + end + def test_translate_5 + assert_equal("", @obj.translate(6)) + end + end + end From nakao at pub.open-bio.org Sat Nov 26 04:37:13 2005 From: nakao at pub.open-bio.org (Mitsuteru C. Nakao) Date: Sat Nov 26 04:32:42 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io ddbjxml.rb,1.8,1.9 Message-ID: <200511260937.jAQ9bDVL027584@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv27574/lib/bio/io Modified Files: ddbjxml.rb Log Message: * Updated RDoc. Index: ddbjxml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ddbjxml.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ddbjxml.rb 14 Nov 2005 02:01:54 -0000 1.8 --- ddbjxml.rb 26 Nov 2005 09:37:11 -0000 1.9 *************** *** 34,41 **** --- 34,80 ---- class DDBJ + + # = Bio::DDBJ::XML + # + # Accessing the DDBJ web services at + # + # * http://xml.nig.ac.jp/ + # * http://xml.nig.ac.jp/wsdl/index.jsp + # class XML < Bio::SOAPWSDL BASE_URI = "http://xml.nig.ac.jp/wsdl/" + # = Blast + # + # BLAST Database Search + # + # * http://xml.nig.ac.jp/doc/Blast.txt + # + # == Examples + # + # serv = Bio::DDBJ::XML::Blast.new + # query = "MSSRIARALALVVTLLHLTRLALSTCPAACHCPLEAPKCAPGVGLVRDGCGCCKVCAKQL" + # + # report = serv.searchSimple('blastp', 'SWISS', query) + # Bio::Blast::Default::Report.new(report).each_hit do |hit| + # hit.hsps.find_all {|x| x.evalue < 0.1 }.each do |hsp| + # p [hsps.evalue, hsps.identity, hsps.definition] + # end + # end + # + # puts serv.searchParam('tblastn', 'ddbjvrl', query, '-m 8') + # + # == WSDL Methods + # + # * searchSimple(program, database, query) + # Returns a blast report in the default format. + # * searchParam(program, database, query, param) + # Blasts with param and returns a blast report. + # + # == References + # + # * http://xml.nig.ac.jp/doc/Blast.txt + # class Blast < XML SERVER_URI = BASE_URI + "Blast.wsdl" *************** *** 45,48 **** --- 84,124 ---- end + + # == ClustalW + # + # Multiple seaquece alignment using ClustalW. + # + # * http://xml.nig.ac.jp/doc/ClustalW.txt + # + # == Examples + # + # serv = Bio::DDBJ::XML::ClustalW.new + # + # query = < RABSTOUT rabbit Guinness receptor + # LKMHLMGHLKMGLKMGLKGMHLMHLKHMHLMTYTYTTYRRWPLWMWLPDFGHAS + # ADSCVCAHGFAVCACFAHFDVCFGAVCFHAVCFAHVCFAAAVCFAVCAC + # > MUSNOSE mouse nose drying factor + # mhkmmhkgmkhmhgmhmhglhmkmhlkmgkhmgkmkytytytryrwtqtqwtwyt + # fdgfdsgafdagfdgfsagdfavdfdvgavfsvfgvdfsvdgvagvfdv + # > HSHEAVEN human Guinness receptor repeat + # mhkmmhkgmkhmhgmhmhg lhmkmhlkmgkhmgkmk ytytytryrwtqtqwtwyt + # fdgfdsgafdagfdgfsag dfavdfdvgavfsvfgv dfsvdgvagvfdv + # mhkmmhkgmkhmhgmhmhg lhmkmhlkmgkhmgkmk ytytytryrwtqtqwtwyt + # fdgfdsgafdagfdgfsag dfavdfdvgavfsvfgv dfsvdgvagvfdv + # END + # + # puts serv.analyzeSimple(query) + # puts serv.analyzeParam(query, '-align -matrix=blosum') + # + # == WSDL Methods + # + # * analyzeSimple(query) + # * analyzeParam(query, param) + # + # == References + # + # * http://xml.nig.ac.jp/doc/ClustalW.txt + # class ClustalW < XML SERVER_URI = BASE_URI + "ClustalW.wsdl" *************** *** 51,55 **** end end ! class DDBJ < XML SERVER_URI = BASE_URI + "DDBJ.wsdl" --- 127,161 ---- end end ! ! ! # = DDBJ ! # ! # Retrieves a sequence entry from the DDBJ DNA Data Bank Japan. ! # ! # * http://xml.nig.ac.jp/doc/DDBJ.txt ! # ! # == Examples ! # ! # serv = Bio::DDBJ::XML::DDBJ.new ! # puts serv.getFFEntry('AB000050') ! # puts serv.getXMLEntry('AB000050') ! # puts serv.getFeatureInfo('AB000050', 'cds') ! # puts serv.getAllFeatures('AB000050') ! # puts serv.getRelatedFeatures('AL121903', '59000', '64000') ! # puts serv.getRelatedFeaturesSeq('AL121903', '59000', '64000') ! # ! # == WSDL Methods ! # ! # * getFFEntry(accession) ! # * getXMLEntry(accession) ! # * getFeatureInfo(accession, feature) ! # * getAllFeatures(accession) ! # * getRelatedFeatures(accession, start, stop) ! # * getRelatedFeaturesSeq(accession, start, stop) ! # ! # == References ! # ! # * http://xml.nig.ac.jp/doc/DDBJ.txt ! # class DDBJ < XML SERVER_URI = BASE_URI + "DDBJ.wsdl" *************** *** 58,62 **** end end ! class Fasta < XML SERVER_URI = BASE_URI + "Fasta.wsdl" --- 164,193 ---- end end ! ! ! # = Fasta ! # ! # Searching database using the Fasta package. ! # ! # * http://xml.nig.ac.jp/doc/Fasta.txt ! # ! # == Examples ! # ! # serv = Bio::DDBJ::XML::Fasta.new ! # query = ">Test\nMSDGAVQPDG GQPAVRNERA TGSGNGSGGG GGGGSGGVGI" ! # ! # puts serv.searchSimple('fasta34', 'PDB', query) ! # query = ">Test\nAGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" ! # puts serv.searchParam('fastx34_t', 'PDB', query, '-n') ! # ! # == WSDL Methods ! # ! # * searchSimple(program, database, query) ! # * searchParam(program, database, query, param) ! # ! # == References ! # ! # * http://xml.nig.ac.jp/doc/Fasta.txt ! # class Fasta < XML SERVER_URI = BASE_URI + "Fasta.wsdl" *************** *** 65,69 **** end end ! class GetEntry < XML SERVER_URI = BASE_URI + "GetEntry.wsdl" --- 196,249 ---- end end ! ! ! # = GetEntry ! # ! # Retrieves database entries. ! # ! # * http://xml.nig.ac.jp/doc/GetEntry.txt ! # ! # == Examples ! # ! # serv = Bio::DDBJ::XML::GetEntry.new ! # puts serv.getDDBJEntry('AB000050') ! # puts serv. getPDBEntry('1AAR') ! # ! # == WSDL Methods ! # ! # * getEntry(database, var, param1, param2) ! # * getEntry(database, var) ! # * getDDBJEntry(accession) ! # * getDDBJCONEntry(accession) ! # * getDDBJVerEntry(accession) ! # * getLocus_DDBJEntry(locus) ! # * getGene_DDBJEntry(gene) ! # * getProd_DDBJEntry(products) ! # * getPID_DDBJEntry(pid) ! # * getClone_DDBJEntry(clone) ! # * getXML_DDBJEntry(accession) ! # * getEMBLEntry(accession) ! # * getSWISSEntry(accession) ! # * getPIREntry(accession) ! # * getPRFEntry(accession) ! # * getPDBEntry(accession) ! # * getQVEntry(accession) ! # * getDADEntry(accession) ! # * getPID_DADEntry(pid) ! # * getFASTA_DDBJEntry(accession) ! # * getFASTA_DDBJCONEntry(accession) ! # * getFASTA_DDBJVerEntry(accession) ! # * getFASTA_DDBJSeqEntry(accession, start, end) ! # * getFASTA_DADEntry(accession) ! # * getFASTA_PIREntry(accession) ! # * getFASTA_SWISSEntry(accession) ! # * getFASTA_PDBEntry(accession) ! # * getFASTA_PRFEntry(accession) ! # * getFASTA_CDSEntry(accession) ! # ! # == References ! # ! # * http://xml.nig.ac.jp/doc/GetEntry.txt ! # class GetEntry < XML SERVER_URI = BASE_URI + "GetEntry.wsdl" *************** *** 72,76 **** end end ! class Gib < XML SERVER_URI = BASE_URI + "Gib.wsdl" --- 252,296 ---- end end ! ! ! # = Gib ! # ! # Genome Information broker ! # ! # * http://xml.nig.ac.jp/doc/Gib.txt ! # ! # == Examples ! # ! # serv = Bio::DDBJ::XML::Gib.new ! # puts serv.getOrganismList ! # puts serv.getChIDList ! # puts serv.getOrganismNameFromChid('Sent_CT18:') ! # puts serv.getChIDFromOrganismName('Aquifex aeolicus VF5') ! # puts serv.getAccession('Ecol_K12_MG1655:') ! # puts serv.getPieceNumber('Mgen_G37:') ! # puts serv.getDivision('Mgen_G37:') ! # puts serv.getType('Mgen_G37:') ! # puts serv.getCDS('Aaeo_VF5:ece1') ! # puts serv.getFlatFile('Nost_PCC7120:pCC7120zeta') ! # puts serv.getFastaFile('Nost_PCC7120:pCC7120zeta', 'cdsaa') ! # ! # == WSDL Methods ! # ! # * getOrganismList ! # * getChIDList ! # * getOrganismNameFromChid(chid) ! # * getChIDFromOrganismName(orgName) ! # * getAccession(chid) ! # * getPieceNumber(chid) ! # * getDivision(chid) ! # * getType(chid) ! # * getFlatFile(chid) ! # * getFastaFile(chid, type) ! # * getCDS(chid) ! # ! # == References ! # ! # * http://xml.nig.ac.jp/doc/Gib.txt ! # class Gib < XML SERVER_URI = BASE_URI + "Gib.wsdl" *************** *** 80,83 **** --- 300,325 ---- end + + # = Gtop + # + # GTOP: Gene to protein. + # + # * http://xml.nig.ac.jp/doc/Gtop.txt + # + # == Examples + # + # serv = Bio::DDBJ::XML::Gtop.new + # puts serv.getOrganismList + # puts serv.getMasterInfo('thrA', 'ecol0') + # + # == WSDL Methods + # + # * getOrganismList + # * getMasterInfo(orfID, organism) + # + # == References + # + # * http://xml.nig.ac.jp/doc/Gtop.txt + # class Gtop < XML SERVER_URI = BASE_URI + "Gtop.wsdl" *************** *** 87,90 **** --- 329,357 ---- end + + # == PML + # + # Variation database + # + # * http://xml.nig.ac.jp/doc/PML.txt + # + # == Examples + # + # serv = Bio::DDBJ::XML::PML.new + # puts serv.getVariation('1') + # + # == WSDL Methods + # + # * searchVariation(field, query, order) + # * searchVariationSimple(field, query) + # * searchFrequency(field, query, order) + # * searchFrequencySimple(field, query) + # * getVariation(variation_id) + # * getFrequency(variation_id, population_id) + # + # == References + # + # * http://xml.nig.ac.jp/doc/PML.txt + # class PML < XML SERVER_URI = BASE_URI + "PML.wsdl" *************** *** 94,97 **** --- 361,386 ---- end + + # = SRS + # + # Sequence Retrieving System + # + # * http://xml.nig.ac.jp/doc/SRS.txt + # + # == Examples + # + # serv = Bio::DDBJ::XML::SRS.new + # puts serv.searchSimple('[pathway-des:sugar]') + # puts serv.searchParam('[swissprot-des:cohesin]', '-f seq -sf fasta') + # + # == WSDL Methods + # + # * searchSimple(query) + # * searchParam(query, param) + # + # == Examples + # + # * http://xml.nig.ac.jp/doc/SRS.txt + # class SRS < XML SERVER_URI = BASE_URI + "SRS.wsdl" *************** *** 101,104 **** --- 390,424 ---- end + + # = TxSearch + # + # Searching taxonomy information. + # + # * http://xml.nig.ac.jp/doc/TxSearch.txt + # + # == Examples + # + # serv = Bio::DDBJ::XML::TxSearch.new + # puts serv.searchSimple('*coli') + # puts serv.searchSimple('*tardigrada*') + # puts serv.getTxId('Escherichia coli') + # puts serv.getTxName('562') + # + # query = ["Campylobacter coli", "Escherichia coli"].join("\n") + # rank = ["family", "genus"].join("\n") + # puts serv.searchLineage(query, rank, 'Bacteria') + # + # == WSDL Methdos + # + # * searchSimple(tx_Name) + # * searchParam(tx_Name, tx_Clas, tx_Rank, tx_Rmax, tx_Dcls) + # * getTxId(tx_Name) + # * getTxName(tx_Id) + # * searchLineage(query, ranks, superkingdom) + # + # == References + # + # * http://xml.nig.ac.jp/doc/TxSearch.txt + # class TxSearch < XML SERVER_URI = BASE_URI + "TxSearch.wsdl" *************** *** 292,425 **** end - - - - =begin - - = Bio::DDBJ::XML - - Accessing the DDBJ web services at - - * (()) - * (()) - - == Blast - - * (()) - - --- searchSimple(program, database, query) - --- searchParam(program, database, query, param) - - == ClustalW - - * (()) - - --- analyzeSimple(query) - --- analyzeParam(query, param) - - == DDBJ - - * (()) - - --- getFFEntry(accession) - --- getXMLEntry(accession) - --- getFeatureInfo(accession, feature) - --- getAllFeatures(accession) - --- getRelatedFeatures(accession, start, stop) - --- getRelatedFeaturesSeq(accession, start, stop) - - == Fasta - - * (()) - - --- searchSimple(program, database, query) - --- searchParam(program, database, query, param) - - == GetEntry - - * (()) - - --- getEntry(database, var, param1, param2) - --- getEntry(database, var) - --- getDDBJEntry(accession) - --- getDDBJCONEntry(accession) - --- getDDBJVerEntry(accession) - --- getLocus_DDBJEntry(locus) - --- getGene_DDBJEntry(gene) - --- getProd_DDBJEntry(products) - --- getPID_DDBJEntry(pid) - --- getClone_DDBJEntry(clone) - --- getXML_DDBJEntry(accession) - --- getEMBLEntry(accession) - --- getSWISSEntry(accession) - --- getPIREntry(accession) - --- getPRFEntry(accession) - --- getPDBEntry(accession) - --- getQVEntry(accession) - --- getDADEntry(accession) - --- getPID_DADEntry(pid) - --- getFASTA_DDBJEntry(accession) - --- getFASTA_DDBJCONEntry(accession) - --- getFASTA_DDBJVerEntry(accession) - --- getFASTA_DDBJSeqEntry(accession, start, end) - --- getFASTA_DADEntry(accession) - --- getFASTA_PIREntry(accession) - --- getFASTA_SWISSEntry(accession) - --- getFASTA_PDBEntry(accession) - --- getFASTA_PRFEntry(accession) - --- getFASTA_CDSEntry(accession) - - == Gib - - * (()) - - --- getOrganismList - --- getChIDList - --- getOrganismNameFromChid(chid) - --- getChIDFromOrganismName(orgName) - --- getAccession(chid) - --- getPieceNumber(chid) - --- getDivision(chid) - --- getType(chid) - --- getFlatFile(chid) - --- getFastaFile(chid, type) - --- getCDS(chid) - - == Gtop - - * (()) - - --- getOrganismList - --- getMasterInfo(orfID, organism) - - == PML - - * (()) - - --- searchVariation(field, query, order) - --- searchVariationSimple(field, query) - --- searchFrequency(field, query, order) - --- searchFrequencySimple(field, query) - --- getVariation(variation_id) - --- getFrequency(variation_id, population_id) - - == SRS - - * (()) - - --- searchSimple(query) - --- searchParam(query, param) - - == TxSearch - - * (()) - - --- searchSimple(tx_Name) - --- searchParam(tx_Name, tx_Clas, tx_Rank, tx_Rmax, tx_Dcls) - --- getTxId(tx_Name) - --- getTxName(tx_Id) - --- searchLineage(query, ranks, superkingdom) - - =end - --- 612,614 ---- From k at pub.open-bio.org Sun Nov 27 10:01:19 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 09:56:45 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.5,1.6 Message-ID: <200511271501.jARF1JVL006851@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv6845/lib/bio/shell/plugin Modified Files: codon.rb Log Message: * codontables method is fixed (to follow changes of Bio::CodonTable::Definition -> DEFINITION) Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** codon.rb 25 Nov 2005 16:01:28 -0000 1.5 --- codon.rb 27 Nov 2005 15:01:17 -0000 1.6 *************** *** 197,201 **** def codontables ! Bio::CodonTable::Definitions.sort.each do |i, definition| puts "#{i}\t#{definition}" end --- 197,201 ---- def codontables ! Bio::CodonTable::DEFINITIONS.sort.each do |i, definition| puts "#{i}\t#{definition}" end From k at pub.open-bio.org Sun Nov 27 10:46:03 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 10:41:17 2005 Subject: [BioRuby-cvs] bioruby/lib/bio sequence.rb,0.48,0.49 Message-ID: <200511271546.jARFk3VL006959@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv6955/lib/bio Modified Files: sequence.rb Log Message: * fixed a bug in translate(2) or translate(-2) Index: sequence.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v retrieving revision 0.48 retrieving revision 0.49 diff -C2 -d -r0.48 -r0.49 *** sequence.rb 22 Nov 2005 00:32:59 -0000 0.48 --- sequence.rb 27 Nov 2005 15:46:01 -0000 0.49 *************** *** 310,325 **** case frame when 1, 2, 3 ! frame -= 1 when 4, 5, 6 ! frame -= 4 naseq.complement! when -1, -2, -3 ! frame = -1 - frame naseq.complement! else ! frame = 0 end ! nalen = naseq.length - (naseq.length - frame) % 3 ! aaseq = naseq[frame, nalen].gsub(/.{3}/) {|codon| ct[codon] or unknown} return Bio::Sequence::AA.new(aaseq) end --- 310,326 ---- case frame when 1, 2, 3 ! from = frame - 1 when 4, 5, 6 ! from = frame - 4 naseq.complement! when -1, -2, -3 ! from = -1 - frame naseq.complement! else ! from = 0 end ! nalen = naseq.length - from ! nalen -= nalen % 3 ! aaseq = naseq[from, nalen].gsub(/.{3}/) {|codon| ct[codon] or unknown} return Bio::Sequence::AA.new(aaseq) end From k at pub.open-bio.org Sun Nov 27 12:39:02 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 12:34:30 2005 Subject: [BioRuby-cvs] bioruby/bin bioruby,1.7,1.8 Message-ID: <200511271739.jARHd2VL007345@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/bin In directory pub.open-bio.org:/tmp/cvs-serv7339/bin Modified Files: bioruby Log Message: * Bio::Shell::Core::Config and Bio::Shell::Core::Cache are changed to @config and @cache which are initialized in Bio::Shell.setup as a Hash and have accessors (Bio::Shell.config, Bio::Shell.cache). Index: bioruby =================================================================== RCS file: /home/repository/bioruby/bioruby/bin/bioruby,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bioruby 24 Nov 2005 19:30:07 -0000 1.7 --- bioruby 27 Nov 2005 17:39:00 -0000 1.8 *************** *** 48,54 **** begin require 'irb/completion' ! Bio::Shell.cache(:readline, true) rescue LoadError ! Bio::Shell.cache(:readline, false) end --- 48,54 ---- begin require 'irb/completion' ! Bio::Shell.cache[:readline] = true rescue LoadError ! Bio::Shell.cache[:readline] = false end *************** *** 72,81 **** :RETURN => " ==> %s\n" } ! if Bio::Shell.config(:color) IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR else IRB.conf[:PROMPT_MODE] = :BIORUBY end ! IRB.conf[:ECHO] = Bio::Shell.config(:echo) || false # irb/input-method.rb >= v1.5 (not in 1.8.2) --- 72,81 ---- :RETURN => " ==> %s\n" } ! if Bio::Shell.config[:color] IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR else IRB.conf[:PROMPT_MODE] = :BIORUBY end ! IRB.conf[:ECHO] = Bio::Shell.config[:echo] || false # irb/input-method.rb >= v1.5 (not in 1.8.2) From k at pub.open-bio.org Sun Nov 27 12:39:03 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 12:34:34 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb, 1.11, 1.12 session.rb, 1.7, 1.8 Message-ID: <200511271739.jARHd3VL007347@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv7339/lib/bio/shell Modified Files: core.rb session.rb Log Message: * Bio::Shell::Core::Config and Bio::Shell::Core::Cache are changed to @config and @cache which are initialized in Bio::Shell.setup as a Hash and have accessors (Bio::Shell.config, Bio::Shell.cache). Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** session.rb 25 Nov 2005 17:26:54 -0000 1.7 --- session.rb 27 Nov 2005 17:39:00 -0000 1.8 *************** *** 97,101 **** def pager(cmd = nil) ! unless Bio::Shell.config(:pager) cmd = ENV['PAGER'] || cmd end --- 97,101 ---- def pager(cmd = nil) ! unless Bio::Shell.config[:pager] cmd = ENV['PAGER'] || cmd end *************** *** 106,111 **** def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html ! if Bio::Shell.config(:pager) ! pg = IO.popen(Bio::Shell.config(:pager), "w") begin stdout_save = STDOUT.clone --- 106,111 ---- def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html ! if Bio::Shell.config[:pager] ! pg = IO.popen(Bio::Shell.config[:pager], "w") begin stdout_save = STDOUT.clone Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** core.rb 25 Nov 2005 16:47:10 -0000 1.11 --- core.rb 27 Nov 2005 17:39:00 -0000 1.12 *************** *** 56,88 **** } - # A hash to store persistent configurations - Config = {} - - # A hash to store temporal (per session) configurations - Cache = {} - - attr_accessor :config, :cache - - def config(param, value = nil) - if value - Config[param] = value - end - return Config[param] - end - - def cache(param, value = nil) - if value - Cache[param] = value - end - return Cache[param] - end - ### save/restore the environment def setup load_config load_plugin version_check end def open --- 56,74 ---- } ### save/restore the environment def setup + @config = {} + @cache = {} load_config load_plugin version_check end + + # A hash to store persistent configurations + attr_accessor :config + + # A hash to store temporal (per session) configurations + attr_accessor :cache def open *************** *** 125,129 **** raise "BioRuby shell runs on Ruby version >= 1.8.2" end ! if Config[:marshal] and Config[:marshal] != MARSHAL raise "Marshal version mismatch" end --- 111,115 ---- raise "BioRuby shell runs on Ruby version >= 1.8.2" end ! if @config[:marshal] and @config[:marshal] != MARSHAL raise "Marshal version mismatch" end *************** *** 140,147 **** # 1. ask to save in SAVEDIR directory in the current directory # 2. otherwise save in USERDIR directory ! # 3. remember the choice in Cache[:savedir] once per session def ask_save_dir ! if Cache[:savedir] ! dir = Cache[:savedir] else dir = SAVEDIR --- 126,133 ---- # 1. ask to save in SAVEDIR directory in the current directory # 2. otherwise save in USERDIR directory ! # 3. remember the choice in @cache[:savedir] once per session def ask_save_dir ! if @cache[:savedir] ! dir = @cache[:savedir] else dir = SAVEDIR *************** *** 158,162 **** end end ! Cache[:savedir] = dir end return dir --- 144,148 ---- end end ! @cache[:savedir] = dir end return dir *************** *** 187,191 **** print "Loading config (#{file}) ... " if hash = YAML.load(File.read(file)) ! Config.update(hash) end puts "done" --- 173,177 ---- print "Loading config (#{file}) ... " if hash = YAML.load(File.read(file)) ! @config.update(hash) end puts "done" *************** *** 202,206 **** print "Saving config (#{file}) ... " File.open(file, "w") do |f| ! f.puts Config.to_yaml end puts "done" --- 188,192 ---- print "Saving config (#{file}) ... " File.open(file, "w") do |f| ! f.puts @config.to_yaml end puts "done" *************** *** 211,215 **** def config_show ! Config.each do |k, v| puts "#{k}\t= #{v.inspect}" end --- 197,201 ---- def config_show ! @config.each do |k, v| puts "#{k}\t= #{v.inspect}" end *************** *** 218,223 **** def config_echo bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! Config[:echo] ! Config[:echo] = IRB.conf[:ECHO] = flag eval("conf.echo = #{flag}", bind) puts "Echo #{flag ? 'on' : 'off'}" --- 204,209 ---- def config_echo bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! @config[:echo] ! @config[:echo] = IRB.conf[:ECHO] = flag eval("conf.echo = #{flag}", bind) puts "Echo #{flag ? 'on' : 'off'}" *************** *** 226,231 **** def config_color bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! Config[:color] ! Config[:color] = flag if flag IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR --- 212,217 ---- def config_color bind = IRB.conf[:MAIN_CONTEXT].workspace.binding ! flag = ! @config[:color] ! @config[:color] = flag if flag IRB.conf[:PROMPT_MODE] = :BIORUBY_COLOR *************** *** 238,247 **** def config_pager(cmd = nil) ! Config[:pager] = cmd end def config_message(str = nil) str ||= Bio::Shell::Core::MESSAGE ! Config[:message] = str end --- 224,233 ---- def config_pager(cmd = nil) ! @config[:pager] = cmd end def config_message(str = nil) str ||= Bio::Shell::Core::MESSAGE ! @config[:message] = str end *************** *** 319,323 **** end Marshal.dump(hash, f) ! Config[:marshal] = MARSHAL rescue warn "Error: Failed to dump (#{file}) : #{$!}" --- 305,309 ---- end Marshal.dump(hash, f) ! @config[:marshal] = MARSHAL rescue warn "Error: Failed to dump (#{file}) : #{$!}" *************** *** 334,338 **** def load_history ! if Cache[:readline] load_history_file(SITEDIR + HISTORY) load_history_file(USERDIR + HISTORY) --- 320,324 ---- def load_history ! if @cache[:readline] load_history_file(SITEDIR + HISTORY) load_history_file(USERDIR + HISTORY) *************** *** 352,356 **** def save_history ! if Cache[:readline] dir = create_save_dir save_history_file(dir + HISTORY) --- 338,342 ---- def save_history ! if @cache[:readline] dir = create_save_dir save_history_file(dir + HISTORY) *************** *** 375,391 **** case mode when :begin, "begin", :start, "start" ! Cache[:script] = true script_begin when :end, "end", :stop, "stop" ! Cache[:script] = false script_end save_script else ! if Cache[:script] ! Cache[:script] = false script_end save_script else ! Cache[:script] = true script_begin end --- 361,377 ---- case mode when :begin, "begin", :start, "start" ! @cache[:script] = true script_begin when :end, "end", :stop, "stop" ! @cache[:script] = false script_end save_script else ! if @cache[:script] ! @cache[:script] = false script_end save_script else ! @cache[:script] = true script_begin end *************** *** 432,437 **** def splash_message ! Config[:message] ||= MESSAGE ! Config[:message].to_s.split(//).join(" ") end --- 418,423 ---- def splash_message ! @config[:message] ||= MESSAGE ! @config[:message].to_s.split(//).join(" ") end *************** *** 450,454 **** print "\n" ! if Config[:color] 0.step(l,2) do |i| l1 = l-i; l2 = l1/2; l4 = l2/2 --- 436,440 ---- print "\n" ! if @config[:color] 0.step(l,2) do |i| l1 = l-i; l2 = l1/2; l4 = l2/2 *************** *** 463,467 **** end end ! if Config[:color] print splash_message_color else --- 449,453 ---- end end ! if @config[:color] print splash_message_color else *************** *** 475,479 **** def closing_splash print "\n\n" ! if Config[:color] print splash_message_color else --- 461,465 ---- def closing_splash print "\n\n" ! if @config[:color] print splash_message_color else From k at pub.open-bio.org Sun Nov 27 14:55:41 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 14:50:51 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io registry.rb,1.14,1.15 Message-ID: <200511271955.jARJtfVL007592@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv7586/lib/bio/io Modified Files: registry.rb Log Message: * added accessor for the list of databases (@databases) * converted to RDoc and added description Index: registry.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/registry.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** registry.rb 26 Sep 2005 13:00:08 -0000 1.14 --- registry.rb 27 Nov 2005 19:55:39 -0000 1.15 *************** *** 1,7 **** # ! # bio/io/registry.rb - BioDirectory Registry module # ! # Copyright (C) 2002 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public --- 1,86 ---- # ! # = bio/io/registry.rb - OBDA BioRegistry module # ! # Copyright:: Copyright (C) 2002, 2003, 2004, 2005 ! # Toshiaki Katayama ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # BioRegistry read the OBDA (Open Bio Database Access) configuration file ! # (seqdatabase.ini) and create a registry object. OBDA is created during ! # the BioHackathon held in Tucson and South Africa in 2002 as a project ! # independent set of protocols to access biological databases. The spec ! # is refined in the BioHackathon 2003 held in Singapore. ! # ! # By using the OBDA, user can access to the database by get_database method ! # without knowing where and how the database is stored, and each database ! # has the get_by_id method to obtain a sequence entry. ! # ! # Sample configuration file is distributed with BioRuby package which ! # consists of stanza format entries as following: ! # ! # VERSION=1.00 ! # ! # [myembl] ! # protocol=biofetch ! # location=http://www.ebi.ac.uk/cgi-bin/dbfetch ! # dbname=embl ! # ! # [mysp] ! # protocol=biosql ! # location=db.bioruby.org ! # dbname=biosql ! # driver=mysql ! # user=root ! # pass= ! # biodbname=swissprot ! # ! # The first line means that this configration file is version 1.00. ! # ! # The [myembl] line defines a user defined database name 'myembl' and ! # following block indicates how the database can be accessed. ! # In this example, the 'myembl' database is accecced via the OBDA's ! # BioFetch protocol to the dbfetch server at EBI, where the EMBL ! # database is accessed by the name 'embl' on the server side. # + # The [mysp] line defines another database 'mysp' which accesses the + # RDB (Relational Database) at the db.bioruby.org via the OBDA's + # BioSQL protocol. This BioSQL server is running MySQL database as + # its backend and stores the SwissProt database by the name 'swissprot' + # and which can be accessed by 'root' user without password. + # Note that the db.bioruby.org server is a dummy for the explanation. + # + # The configuration file is searched by the following order. + # + # 1. Local file name given to the Bio::Registry.new(filename). + # + # 2. Remote or local file list given by the environmenetal variable + # 'OBDA_SEARCH_PATH', which is a '+' separated string of the + # remote (HTTP) and/or local files. + # + # e.g. OBDA_SEARCH_PATH="http://example.org/obda.ini+$HOME/lib/myobda.ini" + # + # 3. Local file "$HOME/.bioinformatics/seqdatabase.ini" in the user's + # home directory. + # + # 4. Local file "/etc/bioinformatics/seqdatabase.ini" in the system + # configuration directry. + # + # All these configuration files are loaded. If there are database + # definitions having the same name, the first one is used. + # + # If none of these files can be found, Bio::Registry.new will try + # to use http://www.open-bio.org/registry/seqdatabase.ini file. + # + # == References + # + # * http://obda.open-bio.org/ + # * http://cvs.open-bio.org/cgi-bin/viewcvs/viewcvs.cgi/obda-specs/?cvsroot=obf-common + # * http://www.open-bio.org/registry/seqdatabase.ini + # + #-- # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public *************** *** 18,189 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # require 'uri' require 'net/http' ! require 'bio/io/sql' ! require 'bio/io/fetch' ! require 'bio/io/flatfile/index' ! require 'bio/io/flatfile/bdb' ! #require 'bio/io/corba' ! #require 'bio/io/xembl' module Bio ! class Registry ! def initialize(file = nil) ! @registry = Array.new ! read_local(file) if file ! env_path = ENV['OBDA_SEARCH_PATH'] ! if env_path and env_path.size > 0 ! read_env(env_path) ! else ! read_local("#{ENV['HOME']}/.bioinformatics/seqdatabase.ini") ! read_local("/etc/bioinformatics/seqdatabase.ini") ! if @registry.empty? ! read_remote("http://www.open-bio.org/registry/seqdatabase.ini") ! end ! end ! end ! def get_database(dbname) ! @registry.each do |db| ! if db.database == dbname.downcase ! case db.protocol ! when 'biofetch' ! return serv_biofetch(db) ! when 'biosql' ! return serv_biosql(db) ! when 'flat', 'index-flat', 'index-berkeleydb' ! return serv_flat(db) ! when 'bsane-corba', 'biocorba' ! raise NotImplementedError ! when 'xembl' ! raise NotImplementedError ! end ! end end - return nil end ! alias db get_database ! def query(dbname) ! @registry.each do |db| ! return db if db.database == dbname.downcase ! end ! end ! private ! def read_env(path) ! path.split('+').each do |elem| ! if /:/.match(elem) ! read_remote(elem) ! else ! read_local(elem) end end end ! def read_local(file) ! if File.readable?(file) ! stanza = File.open(file).read ! parse_stanza(stanza) ! end end ! def read_remote(url) ! schema, user, host, port, reg, path, = URI.split(url) ! Net::HTTP.start(host, port) do |http| ! response, = http.get(path) ! parse_stanza(response.body) ! end ! end ! def parse_stanza(stanza) ! return unless stanza ! if stanza[/.*/] =~ /VERSION\s*=\s*(\S+)/ ! @spec_version = $1 # for internal use (may differ on each file) ! stanza[/.*/] = '' # remove VERSION line ! end ! stanza.each_line do |line| ! case line ! when /^\[(.*)\]/ ! dbname = $1.downcase ! db = Bio::Registry::DB.new($1) ! @registry.push(db) ! when /=/ ! tag, value = line.chomp.split(/\s*=\s*/) ! @registry.last[tag] = value ! end end end ! def serv_biofetch(db) ! serv = Bio::Fetch.new(db.location) ! serv.database = db.dbname ! return serv end ! def serv_biosql(db) ! location, port = db.location.split(':') ! port = db.port unless port ! case db.driver ! when /mysql/i ! driver = 'Mysql' ! when /pg|postgres/i ! driver = 'Pg' ! when /oracle/ ! when /sybase/ ! when /sqlserver/ ! when /access/ ! when /csv/ ! when /informix/ ! when /odbc/ ! when /rdb/ end ! dbi = [ "dbi", driver, db.dbname, location ].compact.join(':') ! dbi += ';port=' + port if port ! serv = Bio::SQL.new(dbi, db.user, db.pass) ! # We can not manage biodbname (for name space) in BioSQL yet. ! # use db.biodbname here!! ! return serv end ! def serv_flat(db) ! path = db.location ! path = File.join(path, db.dbname) if db.dbname ! serv = Bio::FlatFileIndex.open(path) ! return serv ! end ! class DB ! def initialize(dbname) ! @database = dbname ! @property = Hash.new ! end ! attr_reader :database - def method_missing(meth_id) - @property[meth_id.id2name] - end ! def []=(tag, value) ! @property[tag] = value ! end end end ! end --- 97,280 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # require 'uri' require 'net/http' ! module Bio ! autoload :Fetch, 'bio/io/fetch' ! autoload :SQL, 'bio/io/sql' ! autoload :FlatFile, 'bio/io/flatfile' ! autoload :FlatFileIndex, 'bio/io/flatfile/index' ! class Registry ! def initialize(file = nil) ! @spec_version = nil ! @databases = Array.new ! read_local(file) if file ! env_path = ENV['OBDA_SEARCH_PATH'] ! if env_path and env_path.size > 0 ! read_env(env_path) ! else ! read_local("#{ENV['HOME']}/.bioinformatics/seqdatabase.ini") ! read_local("/etc/bioinformatics/seqdatabase.ini") ! if @databases.empty? ! read_remote("http://www.open-bio.org/registry/seqdatabase.ini") end end ! end ! # Version string of the first configulation file ! attr_reader :spec_version ! # List of databases (Array of Bio::Registry::DB) ! attr_reader :databases ! # Returns a dababase handle (Bio::SQL, Bio::Fetch etc.) or nil ! # if not found (case insensitive). ! # The handles should have get_by_id method. ! def get_database(dbname) ! @databases.each do |db| ! if db.database == dbname.downcase ! case db.protocol ! when 'biofetch' ! return serv_biofetch(db) ! when 'biosql' ! return serv_biosql(db) ! when 'flat', 'index-flat', 'index-berkeleydb' ! return serv_flat(db) ! when 'bsane-corba', 'biocorba' ! raise NotImplementedError ! when 'xembl' ! raise NotImplementedError end end end + return nil + end + alias db get_database ! # Returns a Registry::DB object corresponding to the first dbname ! # entry in the registry records (case insensitive). ! def query(dbname) ! @databases.each do |db| ! return db if db.database == dbname.downcase end + end ! private ! def read_env(path) ! path.split('+').each do |elem| ! if /:/.match(elem) ! read_remote(elem) ! else ! read_local(elem) end end + end ! def read_local(file) ! if File.readable?(file) ! stanza = File.read(file) ! parse_stanza(stanza) end + end ! def read_remote(url) ! schema, user, host, port, reg, path, = URI.split(url) ! Net::HTTP.start(host, port) do |http| ! response, = http.get(path) ! parse_stanza(response.body) ! end ! end ! def parse_stanza(stanza) ! return unless stanza ! if stanza[/.*/] =~ /VERSION\s*=\s*(\S+)/ ! @spec_version ||= $1 # for internal use (may differ on each file) ! stanza[/.*/] = '' # remove VERSION line ! end ! stanza.each_line do |line| ! case line ! when /^\[(.*)\]/ ! dbname = $1.downcase ! db = Bio::Registry::DB.new($1) ! @databases.push(db) ! when /=/ ! tag, value = line.chomp.split(/\s*=\s*/) ! @databases.last[tag] = value end + end + end ! def serv_biofetch(db) ! serv = Bio::Fetch.new(db.location) ! serv.database = db.dbname ! return serv ! end ! def serv_biosql(db) ! location, port = db.location.split(':') ! port = db.port unless port ! case db.driver ! when /mysql/i ! driver = 'Mysql' ! when /pg|postgres/i ! driver = 'Pg' ! when /oracle/ ! when /sybase/ ! when /sqlserver/ ! when /access/ ! when /csv/ ! when /informix/ ! when /odbc/ ! when /rdb/ end ! dbi = [ "dbi", driver, db.dbname, location ].compact.join(':') ! dbi += ';port=' + port if port ! serv = Bio::SQL.new(dbi, db.user, db.pass) + # We can not manage biodbname (for name space) in BioSQL yet. + # use db.biodbname here!! ! return serv ! end ! def serv_flat(db) ! path = db.location ! path = File.join(path, db.dbname) if db.dbname ! serv = Bio::FlatFileIndex.open(path) ! return serv ! end ! class DB ! ! def initialize(dbname) ! @database = dbname ! @property = Hash.new ! end ! attr_reader :database ! ! def method_missing(meth_id) ! @property[meth_id.id2name] ! end + def []=(tag, value) + @property[tag] = value end end ! end # class Registry ! ! end # module Bio *************** *** 215,249 **** end - - =begin - - = Bio::Registry - - --- Bio::Registry.new(file = nil) - - --- Bio::Registry#get_database(dbname) - --- Bio::Registry#db(dbname) - - Returns a dababase handle (Bio::SQL, Bio::Fetch etc.) or nil - if not found (case insensitive). - The handles should have get_by_id method. - - --- Bio::Registry#query(dbname) - - Returns a Registry::DB object corresponding to the first dbname - entry in the registry records (case insensitive). - - == Bio::Registry::DB - - --- Bio::Registry::DB.new(dbname) - - --- Bio::Registry::DB#database - - == SEE ALSO - - * (()) - * (()) - * (()) - - =end --- 306,308 ---- From k at pub.open-bio.org Sun Nov 27 21:02:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 20:57:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io fetch.rb,1.2,1.3 Message-ID: <200511280202.jAS22eVL008184@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory pub.open-bio.org:/tmp/cvs-serv8180/bio/io Modified Files: fetch.rb Log Message: * converted to RDoc format * databases, formats, maxids methods are added Index: fetch.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fetch.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** fetch.rb 21 Feb 2004 19:40:34 -0000 1.2 --- fetch.rb 28 Nov 2005 02:02:38 -0000 1.3 *************** *** 1,6 **** # ! # bio/io/biofetch.rb - BioFetch access module # ! # Copyright (C) 2002 KATAYAMA Toshiaki # # This library is free software; you can redistribute it and/or --- 1,12 ---- # ! # = bio/io/biofetch.rb - BioFetch access module # ! # Copyright:: Copyright (C) 2002, 2005 ! # Toshiaki Katayama ! # Licence:: LGPL ! # ! # $Id$ ! # ! #-- # # This library is free software; you can redistribute it and/or *************** *** 18,22 **** # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 24,28 ---- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! #++ # *************** *** 26,57 **** module Bio ! class Fetch ! def initialize(url = 'http://bioruby.org/cgi-bin/biofetch.rb') ! schema, user, @host, @port, reg, @path, = URI.split(url) ! end ! attr_accessor :database ! def get_by_id(id) ! fetch(@database, id) ! end ! def fetch(db, id, style = 'raw', format = nil) ! data = [ "db=#{db}", "id=#{id}", "style=#{style}" ] ! data.push("format=#{format}") if format ! data = data.join('&') ! responce, result = Net::HTTP.new(@host, @port).post(@path, data) ! return result ! end ! def self.query(*args) ! self.new.fetch(*args) end end end --- 32,97 ---- module Bio ! class Fetch ! # Create a new Bio::Fetch server object. ! # Use Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch') to connect ! # to EBI BioFetch server. ! def initialize(url = 'http://bioruby.org/cgi-bin/biofetch.rb') ! schema, user, @host, @port, reg, @path, = URI.split(url) ! end ! # Set default database to dbname (prepare for get_by_id). ! attr_accessor :database ! # Get raw database entry by id (mainly used by Bio::Registry). ! def get_by_id(id) ! fetch(@database, id) ! end ! # Fetch a database entry as specified by database (db), entry id (id), ! # 'raw' text or 'html' (style), and format. When using BioRuby's ! # BioFetch server, value for the format should not be set. ! def fetch(db, id, style = 'raw', format = nil) ! data = [ "db=#{db}", "id=#{id}", "style=#{style}" ] ! data.push("format=#{format}") if format ! data = data.join('&') ! responce, result = Net::HTTP.new(@host, @port).post(@path, data) ! return result ! end ! ! # Short cut for using BioRuby's BioFetch server. You can fetch an entry ! # without creating instance of BioFetch server. ! def self.query(*args) ! self.new.fetch(*args) ! end ! ! # What databases are available? ! def databases ! query = "info=dbs" ! responce, result = Net::HTTP.new(@host, @port).post(@path, query) ! return result ! end ! ! # What formats does the database X have? ! def formats(database = @database) ! if database ! query = "info=formats;db=#{database}" ! responce, result = Net::HTTP.new(@host, @port).post(@path, query) ! return result end + end + # How many entries can be retrieved simultaneously? + def maxids + query = "info=maxids" + responce, result = Net::HTTP.new(@host, @port).post(@path, query) + return result end end + end # module Bio + *************** *** 72,104 **** end - - =begin - - = Bio::Fetch - - --- Bio::Fetch.new(url = 'http://bioruby.org/cgi-bin/biofetch.rb') - - Use Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch') to connect - to EBI BioFetch server. - - --- Bio::Fetch#fetch(db, id, style = 'raw', format = nil) - - Fetch a database entry as specified by database (db), entry id (id), - 'raw' text or 'html' (style), and format. When using BioRuby's - BioFetch server, value for the format should not be set. - - --- Bio::Fetch#database=(dbname) - - Set default database to dbname (prepare for get_by_id). - - --- Bio::Fetch#get_by_id(id) - - Get raw database entry by id (mainly used by Bio::Registry). - - --- Bio::Fetch.query(db, id, style = 'raw', format = nil) - - Short cut for using BioRuby's BioFetch server. You can fetch an entry - without creating instance of BioFetch server. - - =end --- 112,114 ---- From k at pub.open-bio.org Sun Nov 27 21:05:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 21:00:45 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.8,1.9 Message-ID: <200511280205.jAS25hVL008278@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv8272/bio Modified Files: shell.rb Log Message: * bio/shell/access.rb is added which defines meta access methods such as seq and ent Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shell.rb 24 Nov 2005 19:30:07 -0000 1.8 --- shell.rb 28 Nov 2005 02:05:40 -0000 1.9 *************** *** 29,32 **** --- 29,33 ---- require 'bio' require 'yaml' + require 'open-uri' require 'pp' *************** *** 41,44 **** --- 42,46 ---- require 'bio/shell/plugin/obda' require 'bio/shell/plugin/keggapi' + require 'bio/shell/access' extend Core From k at pub.open-bio.org Sun Nov 27 21:05:43 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 21:00:46 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell access.rb,NONE,1.1 Message-ID: <200511280205.jAS25hVL008282@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv8272/bio/shell Added Files: access.rb Log Message: * bio/shell/access.rb is added which defines meta access methods such as seq and ent --- NEW FILE: access.rb --- # # = bio/shell/access.rb - database access module # # Copyright:: Copyright (C) 2005 # Toshiaki Katayama # License:: LGPL # # $Id: access.rb,v 1.1 2005/11/28 02:05:41 k Exp $ # #-- # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #++ # module Bio::Shell # Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid) # sequence from # * String -- "atgcatgc" or "MQKKP" # * File -- "gbvrl.gbk" (only the first entry is used) # * ID -- "embl:BUM" (entry is retrieved by the OBDA) def seq(arg) if arg.kind_of?(Bio::Sequence) s = arg elsif arg.respond_to?(:gets) or File.exists?(arg) entry = flatauto(arg) elsif arg[/:/] str = ent(arg) entry = parse(str) else tmp = arg end if entry.respond_to?(:seq) tmp = entry.seq elsif entry.respond_to?(:naseq) s = entry.naseq elsif entry.respond_to?(:aaseq) s = entry.aaseq end if tmp and tmp.is_a?(String) and not tmp.empty? s = Bio::Sequence.auto(tmp) end return s || "" end def ent(arg) db, entry_id = arg.to_s.strip.split(/:/) if Bio::Shell.find_flat_dir(db) entry = flatsearch(db, entry_id) eleif obdadbs.include?(db) entry = obda_get_entry(db, entry_id) else entry = bget(arg) end return entry end end From k at pub.open-bio.org Sun Nov 27 21:06:49 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 21:01:53 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.12,1.13 Message-ID: <200511280206.jAS26nVL008351@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv8347/bio/shell/plugin Modified Files: seq.rb Log Message: * seq method is moved to bio/shell/access Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** seq.rb 25 Nov 2005 16:47:10 -0000 1.12 --- seq.rb 28 Nov 2005 02:06:47 -0000 1.13 *************** *** 29,33 **** require 'bio/sequence' require 'bio/util/color_scheme' - require 'bio/shell/plugin/codon' module Bio::Shell --- 29,32 ---- *************** *** 35,72 **** private - # Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid) - # sequence from - # * String -- "atgcatgc" or "MQKKP" - # * File -- "gbvrl.gbk" (only the first entry is used) - # * ID -- "embl:BUM" (entry is retrieved by the OBDA) - def seq(arg) - if arg.kind_of?(Bio::Sequence) - s = arg - elsif arg.respond_to?(:gets) or File.exists?(arg) - entry = flatauto(arg) - elsif arg[/:/] - db, entry_id = arg.split(/:/) - str = obda_get_entry(db, entry_id) - entry = parse(str) - else - tmp = arg - end - - if entry.respond_to?(:seq) - tmp = entry.seq - elsif entry.respond_to?(:naseq) - s = entry.naseq - elsif entry.respond_to?(:aaseq) - s = entry.aaseq - end - - if tmp and tmp.is_a?(String) and not tmp.empty? - s = Bio::Sequence.auto(tmp) - end - - return s || "" - end - - # Convert sequence to colored HTML string def htmlseq(str) --- 34,37 ---- *************** *** 134,137 **** --- 99,105 ---- hash[codon] = percent end + #-- + #*TODO* how to hide this method + #++ rep << codon_usage_table(1, hash).output From k at pub.open-bio.org Sun Nov 27 21:08:24 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 21:03:25 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.12,1.13 Message-ID: <200511280208.jAS28OVL008443@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv8437/bio/shell Modified Files: core.rb Log Message: * directory preparation for bioflat is separated to bio/shell/core Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** core.rb 27 Nov 2005 17:39:00 -0000 1.12 --- core.rb 28 Nov 2005 02:08:22 -0000 1.13 *************** *** 161,164 **** --- 161,184 ---- end + ### bioflat + + def create_flat_dir(dbname) + if prefix = create_save_dir + return prefix + BIOFLAT + dbname.to_s + else + return nil + end + end + + def find_flat_dir(dbname) + dir = SAVEDIR + BIOFLAT + dbname.to_s + dir = USERDIR + BIOFLAT + dbname.to_s unless File.exists?(dir) + if File.exists?(dir) + return dir + else + return nil + end + end + ### config *************** *** 315,319 **** end end - ### history --- 335,338 ---- From k at pub.open-bio.org Sun Nov 27 21:08:24 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 21:03:29 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin flatfile.rb,1.7,1.8 Message-ID: <200511280208.jAS28OVL008447@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv8437/bio/shell/plugin Modified Files: flatfile.rb Log Message: * directory preparation for bioflat is separated to bio/shell/core Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** flatfile.rb 25 Nov 2005 16:47:10 -0000 1.7 --- flatfile.rb 28 Nov 2005 02:08:22 -0000 1.8 *************** *** 89,107 **** def flatindex(dbname, *flatfiles) ! prefix = Bio::Shell.create_save_dir + Core::BIOFLAT ! idxdir = prefix + dbname.to_s begin ! print "Creating BioFlat index (#{idxdir}) ... " bdb = format = options = nil ! Bio::FlatFileIndex.makeindex(bdb, idxdir, format, options, *flatfiles) puts "done" rescue ! warn "Error: Failed to create index (#{idxdir}) : #{$!}" end end def flatsearch(dbname, keyword) ! dir = Core::SAVEDIR + Core::BIOFLAT + dbname.to_s ! dir = Core::USERDIR + Core::BIOFLAT + dbname.to_s unless File.exists?(dir) Bio::FlatFileIndex.open(dir) do |db| if results = db.include?(keyword) --- 89,109 ---- def flatindex(dbname, *flatfiles) ! dir = Bio::Shell.create_flat_dir(dbname) begin ! print "Creating BioFlat index (#{dir}) ... " bdb = format = options = nil ! Bio::FlatFileIndex.makeindex(bdb, dir, format, options, *flatfiles) puts "done" rescue ! warn "Error: Failed to create index (#{dir}) : #{$!}" end end def flatsearch(dbname, keyword) ! dir = Bio::Shell.find_flat_dir(dbname) ! unless dir ! warn "Error: Failed to open database (#{dbname})" ! return ! end Bio::FlatFileIndex.open(dir) do |db| if results = db.include?(keyword) *************** *** 114,126 **** end end - - =begin - def bioflat_namespaces(dbname) - dir = Core::SAVEDIR + Core::BIOFLAT + dbname.to_s - db = Bio::FlatFileIndex.open(dir) - display db.namespaces.inspect - db.close - end - =end end --- 116,119 ---- From k at pub.open-bio.org Sun Nov 27 21:09:54 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 21:04:58 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin obda.rb,1.4,1.5 Message-ID: <200511280209.jAS29sVL008568@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv8554/bio/shell/plugin Modified Files: obda.rb Log Message: * obdadbs, bioflat methods are added Index: obda.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** obda.rb 24 Nov 2005 19:32:49 -0000 1.4 --- obda.rb 28 Nov 2005 02:09:52 -0000 1.5 *************** *** 42,45 **** --- 42,49 ---- def obda_get_entry(dbname, entry_id) db = obda.get_database(dbname) + unless db + warn "Error: No such database (#{dbname})" + return + end entry = db.get_by_id(entry_id) if block_given? *************** *** 51,55 **** end ! end --- 55,71 ---- end ! def obdadbs ! result = obda.databases.map {|db| db.database} ! display result ! return result ! end + def biofetch(db, id, style = 'raw', format = 'default') + serv = Bio::Fetch.new("http://www.ebi.ac.uk/cgi-bin/dbfetch") + result = serv.fetch(db, id, style, format) + display result + return result + end + + end From k at pub.open-bio.org Sun Nov 27 23:57:35 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 23:52:41 2005 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.57,1.58 Message-ID: <200511280457.jAS4vZVL009051@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory pub.open-bio.org:/tmp/cvs-serv9041/lib Modified Files: bio.rb Log Message: * Bio::TF* is renamed to Bio::TRANSFAC::* Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** bio.rb 4 Nov 2005 17:34:42 -0000 1.57 --- bio.rb 28 Nov 2005 04:57:32 -0000 1.58 *************** *** 133,146 **** autoload :FastaDefline, 'bio/db/fasta' # change to FastaFormat::Defline autoload :GFF, 'bio/db/gff' - autoload :GFF2, 'bio/db/gff' # change to GFF::GFF2, improve - autoload :GFF3, 'bio/db/gff' # change to GFF::GFF3, improve autoload :AAindex, 'bio/db/aaindex' autoload :TRANSFAC, 'bio/db/transfac' - autoload :TFMATRIX, 'bio/db/transfac' # change to TRANSFAC::MATRIX - autoload :TFSITE, 'bio/db/transfac' # change to TRANSFAC::SITE - autoload :TFFACTOR, 'bio/db/transfac' # change to TRANSFAC::FACTOR - autoload :TFCELL, 'bio/db/transfac' # change to TRANSFAC::CELL - autoload :TFCLASS, 'bio/db/transfac' # change to TRANSFAC::CLASS - autoload :TFGENE, 'bio/db/transfac' # change to TRANSFAC::GENE autoload :PROSITE, 'bio/db/prosite' autoload :LITDB, 'bio/db/litdb' --- 133,138 ---- From k at pub.open-bio.org Sun Nov 27 23:57:34 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 23:52:43 2005 Subject: [BioRuby-cvs] bioruby/doc Changes-0.7.rd,1.8,1.9 Message-ID: <200511280457.jAS4vYVL009049@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/doc In directory pub.open-bio.org:/tmp/cvs-serv9041/doc Modified Files: Changes-0.7.rd Log Message: * Bio::TF* is renamed to Bio::TRANSFAC::* Index: Changes-0.7.rd =================================================================== RCS file: /home/repository/bioruby/bioruby/doc/Changes-0.7.rd,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Changes-0.7.rd 15 Nov 2005 12:50:25 -0000 1.8 --- Changes-0.7.rd 28 Nov 2005 04:57:32 -0000 1.9 *************** *** 151,154 **** --- 151,168 ---- instead of a Hash of a entry ID string. + --- Bio::TRANSFAC + + * Bio::TFMATRIX is renamed to Bio::TRANSFAC::MATRIX + * Bio::TFSITE is renamed to Bio::TRANSFAC::SITE + * Bio::TFFACTOR is renamed to Bio::TRANSFAC::FACTOR + * Bio::TFCELL is renamed to Bio::TRANSFAC::CELL + * Bio::TFCLASS is renamed to Bio::TRANSFAC::CLASS + * Bio::TFGENE is renamed to Bio::TRANSFAC::GENE + + --- Bio::GFF + + * Bio::GFF2 is renamed to Bio::GFF::GFF2 + * Bio::GFF3 is renamed to Bio::GFF::GFF3 + === Deleted files From k at pub.open-bio.org Sun Nov 27 23:57:35 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Sun Nov 27 23:52:59 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/db transfac.rb,1.9,1.10 Message-ID: <200511280457.jAS4vZVL009053@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory pub.open-bio.org:/tmp/cvs-serv9041/lib/bio/db Modified Files: transfac.rb Log Message: * Bio::TF* is renamed to Bio::TRANSFAC::* Index: transfac.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/transfac.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** transfac.rb 8 Sep 2005 01:22:11 -0000 1.9 --- transfac.rb 28 Nov 2005 04:57:33 -0000 1.10 *************** *** 26,104 **** module Bio ! class TRANSFAC < EMBLDB ! ! DELIMITER = RS = "\n//\n" ! TAGSIZE = 4 ! def initialize(entry) ! super(entry, TAGSIZE) ! end ! # AC Accession number (1 per entry) ! # ! # AC T00001 in the case of FACTOR ! # AC M00001 in the case of MATRIX ! # AC R00001 in the case of SITE ! # AC G000001 in the case of GENE ! # AC C00001 in the case of CLASS ! # AC 00001 in the case of CELL ! # ! def ac ! unless @data['AC'] ! @data['AC'] = fetch('AC') ! end ! @data['AC'] ! end ! alias entry_id ac ! # DT Date (1 per entry) ! # ! # DT DD.MM.YYYY (created); ewi. ! # DT DD.MM.YYYY (updated); mpr. ! # ! def dt ! field_fetch('DT') end ! alias date dt ! def cc ! field_fetch('CC') ! end ! alias comment cc ! def os ! field_fetch('OS') ! end ! alias org_species os ! def oc ! field_fetch('OC') ! end ! alias org_class oc ! def rn ! field_fetch('RN') ! end ! alias ref_no rn ! def ra ! field_fetch('RA') ! end ! alias ref_authors ra ! def rt ! field_fetch('RT') ! end ! alias ref_title rt ! def rl ! field_fetch('RL') ! end ! alias ref_data rl end ! class TFMATRIX < TRANSFAC def initialize(entry) --- 26,102 ---- module Bio ! class TRANSFAC < EMBLDB ! DELIMITER = RS = "\n//\n" ! TAGSIZE = 4 ! def initialize(entry) ! super(entry, TAGSIZE) ! end ! # AC Accession number (1 per entry) ! # ! # AC T00001 in the case of FACTOR ! # AC M00001 in the case of MATRIX ! # AC R00001 in the case of SITE ! # AC G000001 in the case of GENE ! # AC C00001 in the case of CLASS ! # AC 00001 in the case of CELL ! # ! def ac ! unless @data['AC'] ! @data['AC'] = fetch('AC') end ! @data['AC'] ! end ! alias entry_id ac ! # DT Date (1 per entry) ! # ! # DT DD.MM.YYYY (created); ewi. ! # DT DD.MM.YYYY (updated); mpr. ! # ! def dt ! field_fetch('DT') ! end ! alias date dt ! def cc ! field_fetch('CC') ! end ! alias comment cc ! def os ! field_fetch('OS') ! end ! alias org_species os ! def oc ! field_fetch('OC') ! end ! alias org_class oc ! def rn ! field_fetch('RN') ! end ! alias ref_no rn ! def ra ! field_fetch('RA') ! end ! alias ref_authors ra ! def rt ! field_fetch('RT') ! end ! alias ref_title rt + def rl + field_fetch('RL') end + alias ref_data rl ! class MATRIX < TRANSFAC def initialize(entry) *************** *** 151,155 **** ! class TFSITE < TRANSFAC def initialize(entry) --- 149,153 ---- ! class SITE < TRANSFAC def initialize(entry) *************** *** 209,213 **** ! class TFFACTOR < TRANSFAC def initialize(entry) --- 207,211 ---- ! class FACTOR < TRANSFAC def initialize(entry) *************** *** 303,307 **** ! class TFCELL < TRANSFAC def initialize(entry) --- 301,305 ---- ! class CELL < TRANSFAC def initialize(entry) *************** *** 317,321 **** ! class TFCLASS < TRANSFAC def initialize(entry) --- 315,319 ---- ! class CLASS < TRANSFAC def initialize(entry) *************** *** 346,350 **** ! class TFGENE < TRANSFAC def initialize(entry) --- 344,348 ---- ! class GENE < TRANSFAC def initialize(entry) *************** *** 384,387 **** end ! end --- 382,387 ---- end ! end # class TRANSFAC ! ! end # module Bio From k at pub.open-bio.org Mon Nov 28 00:08:28 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 00:03:31 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/io/flatfile index.rb,1.14,1.15 Message-ID: <200511280508.jAS58SVL009114@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io/flatfile In directory pub.open-bio.org:/tmp/cvs-serv9110/lib/bio/io/flatfile Modified Files: index.rb Log Message: * temporal fix to make Bio::FlatFileIndex.makeindex work Index: index.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile/index.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** index.rb 26 Sep 2005 13:00:08 -0000 1.14 --- index.rb 28 Nov 2005 05:08:26 -0000 1.15 *************** *** 21,24 **** --- 21,26 ---- # + require 'bio/io/flatfile/indexer' + module Bio class FlatFileIndex From k at pub.open-bio.org Mon Nov 28 02:03:30 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 01:58:52 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell core.rb,1.13,1.14 Message-ID: <200511280703.jAS73UVL009462@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv9454/lib/bio/shell Modified Files: core.rb Log Message: * open/close is renamed to load/save * other method names are unified in core.rb for clean up Index: core.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/core.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** core.rb 28 Nov 2005 02:08:22 -0000 1.13 --- core.rb 28 Nov 2005 07:03:28 -0000 1.14 *************** *** 61,67 **** @config = {} @cache = {} load_config load_plugin - version_check end --- 61,68 ---- @config = {} @cache = {} + check_version + check_marshal load_config load_plugin end *************** *** 72,76 **** attr_accessor :cache ! def open load_object load_history --- 73,77 ---- attr_accessor :cache ! def load load_object load_history *************** *** 78,82 **** end ! def close closing_splash save_history --- 79,83 ---- end ! def save closing_splash save_history *************** *** 86,98 **** #-- ! # *TODO* This works, but sometimes causes terminal collapse ! # how about to suppress loading messages? ! # or try to load @keggapi and @obda during this? #++ ! def opening_thread begin t1 = Thread.new do ! load_object ! load_history end t2 = Thread.new do --- 87,109 ---- #-- ! # *TODO* How to prevent terminal collapse and suppress loading messages? #++ ! def load_thread ! message = '' begin t1 = Thread.new do ! require 'stringio' ! sio = StringIO.new('') ! begin ! stdout_save = STDOUT.clone ! STDOUT.reopen(sio) ! load_object ! load_history ! ensure ! STDOUT.reopen(stdout_save) ! stdout_save.close ! message = sio.read ! sio.close ! end end t2 = Thread.new do *************** *** 103,114 **** rescue end end ### setup ! def version_check if RUBY_VERSION < "1.8.2" raise "BioRuby shell runs on Ruby version >= 1.8.2" end if @config[:marshal] and @config[:marshal] != MARSHAL raise "Marshal version mismatch" --- 114,129 ---- rescue end + puts message end ### setup ! def check_version if RUBY_VERSION < "1.8.2" raise "BioRuby shell runs on Ruby version >= 1.8.2" end + end + + def check_marshal if @config[:marshal] and @config[:marshal] != MARSHAL raise "Marshal version mismatch" *************** *** 165,169 **** def create_flat_dir(dbname) if prefix = create_save_dir ! return prefix + BIOFLAT + dbname.to_s else return nil --- 180,184 ---- def create_flat_dir(dbname) if prefix = create_save_dir ! return prefix + BIOFLAT + dbname.to_s.strip else return nil *************** *** 172,177 **** def find_flat_dir(dbname) ! dir = SAVEDIR + BIOFLAT + dbname.to_s ! dir = USERDIR + BIOFLAT + dbname.to_s unless File.exists?(dir) if File.exists?(dir) return dir --- 187,192 ---- def find_flat_dir(dbname) ! dir = SAVEDIR + BIOFLAT + dbname.to_s.strip ! dir = USERDIR + BIOFLAT + dbname.to_s.strip unless File.exists?(dir) if File.exists?(dir) return dir *************** *** 448,470 **** end ! def opening_splash s = splash_message l = s.length c = ESC_SEQ x = " " print "\n" if @config[:color] ! 0.step(l,2) do |i| ! l1 = l-i; l2 = l1/2; l4 = l2/2 ! print "#{c[:n]}#{s[0,i]}#{x*l1}#{c[:y]}#{s[i,1]}\r" ! sleep(0.001) ! print "#{c[:n]}#{s[0,i]}#{x*l2}#{c[:g]}#{s[i,1]}#{x*(l1-l2)}\r" ! sleep(0.002) ! print "#{c[:n]}#{s[0,i]}#{x*l4}#{c[:r]}#{s[i,1]}#{x*(l2-l4)}\r" ! sleep(0.004) ! print "#{c[:n]}#{s[0,i+1]}#{x*l4}\r" ! sleep(0.008) ! end end if @config[:color] --- 463,488 ---- end ! def splash_message_action s = splash_message l = s.length c = ESC_SEQ x = " " + 0.step(l,2) do |i| + l1 = l-i; l2 = l1/2; l4 = l2/2 + STDERR.print "#{c[:n]}#{s[0,i]}#{x*l1}#{c[:y]}#{s[i,1]}\r" + sleep(0.001) + STDERR.print "#{c[:n]}#{s[0,i]}#{x*l2}#{c[:g]}#{s[i,1]}#{x*(l1-l2)}\r" + sleep(0.002) + STDERR.print "#{c[:n]}#{s[0,i]}#{x*l4}#{c[:r]}#{s[i,1]}#{x*(l2-l4)}\r" + sleep(0.004) + STDERR.print "#{c[:n]}#{s[0,i+1]}#{x*l4}\r" + sleep(0.008) + end + end + def opening_splash print "\n" if @config[:color] ! splash_message_action end if @config[:color] From k at pub.open-bio.org Mon Nov 28 02:03:30 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 01:58:57 2005 Subject: [BioRuby-cvs] bioruby/bin bioruby,1.8,1.9 Message-ID: <200511280703.jAS73UVL009460@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/bin In directory pub.open-bio.org:/tmp/cvs-serv9454/bin Modified Files: bioruby Log Message: * open/close is renamed to load/save * other method names are unified in core.rb for clean up Index: bioruby =================================================================== RCS file: /home/repository/bioruby/bioruby/bin/bioruby,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bioruby 27 Nov 2005 17:39:00 -0000 1.8 --- bioruby 28 Nov 2005 07:03:28 -0000 1.9 *************** *** 93,97 **** # loading workspace and command history ! Bio::Shell.open Signal.trap("SIGINT") do --- 93,97 ---- # loading workspace and command history ! Bio::Shell.load Signal.trap("SIGINT") do *************** *** 104,107 **** # saving workspace, command history and configuration before exit ! Bio::Shell.close --- 104,107 ---- # saving workspace, command history and configuration before exit ! Bio::Shell.save From k at pub.open-bio.org Mon Nov 28 02:06:34 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:01:38 2005 Subject: [BioRuby-cvs] bioruby/lib/bio shell.rb,1.9,1.10 Message-ID: <200511280706.jAS76YVL009514@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv9508/lib/bio Modified Files: shell.rb Log Message: * Bio::Shell::Private module is reserved for plugin specific helper methods. these methods should prefix the plugin file name (e.g. methods for keggapi.rb should be named as Bio::Shell::Private#keggapi_foobar and can be accessed by Bio::Shell.keggapi_foobar) Index: shell.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shell.rb 28 Nov 2005 02:05:40 -0000 1.9 --- shell.rb 28 Nov 2005 07:06:32 -0000 1.10 *************** *** 36,39 **** --- 36,40 ---- require 'bio/shell/core' require 'bio/shell/session' + require 'bio/shell/access' require 'bio/shell/plugin/seq' require 'bio/shell/plugin/midi' *************** *** 42,48 **** require 'bio/shell/plugin/obda' require 'bio/shell/plugin/keggapi' - require 'bio/shell/access' extend Core end --- 43,49 ---- require 'bio/shell/plugin/obda' require 'bio/shell/plugin/keggapi' extend Core + extend Private end From k at pub.open-bio.org Mon Nov 28 02:09:36 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:04:41 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell access.rb,1.1,1.2 Message-ID: <200511280709.jAS79aVL009604@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv9600/bio/shell Modified Files: access.rb Log Message: * fixed to make private methods * ent method is changed to accept local file also (like seq method). Index: access.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/access.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** access.rb 28 Nov 2005 02:05:41 -0000 1.1 --- access.rb 28 Nov 2005 07:09:34 -0000 1.2 *************** *** 29,32 **** --- 29,34 ---- module Bio::Shell + private + # Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid) # sequence from *************** *** 35,74 **** # * ID -- "embl:BUM" (entry is retrieved by the OBDA) def seq(arg) if arg.kind_of?(Bio::Sequence) ! s = arg elsif arg.respond_to?(:gets) or File.exists?(arg) ! entry = flatauto(arg) elsif arg[/:/] str = ent(arg) ! entry = parse(str) else tmp = arg end ! if entry.respond_to?(:seq) ! tmp = entry.seq ! elsif entry.respond_to?(:naseq) ! s = entry.naseq ! elsif entry.respond_to?(:aaseq) ! s = entry.aaseq end if tmp and tmp.is_a?(String) and not tmp.empty? ! s = Bio::Sequence.auto(tmp) end ! return s || "" end def ent(arg) db, entry_id = arg.to_s.strip.split(/:/) ! if Bio::Shell.find_flat_dir(db) entry = flatsearch(db, entry_id) ! eleif obdadbs.include?(db) ! entry = obda_get_entry(db, entry_id) else entry = bget(arg) end return entry end --- 37,84 ---- # * ID -- "embl:BUM" (entry is retrieved by the OBDA) def seq(arg) + seq = "" + if arg.kind_of?(Bio::Sequence) ! seq = arg elsif arg.respond_to?(:gets) or File.exists?(arg) ! ent = flatauto(arg) elsif arg[/:/] str = ent(arg) ! ent = flatparse(str) else tmp = arg end ! if ent.respond_to?(:seq) ! tmp = ent.seq ! elsif ent.respond_to?(:naseq) ! seq = ent.naseq ! elsif ent.respond_to?(:aaseq) ! seq = ent.aaseq end if tmp and tmp.is_a?(String) and not tmp.empty? ! seq = Bio::Sequence.auto(tmp) end ! return seq end def ent(arg) + entry = "" + db, entry_id = arg.to_s.strip.split(/:/) ! if arg.respond_to?(:gets) or File.exists?(arg) ! entry = flatfile(arg) ! elsif Bio::Shell.find_flat_dir(db) entry = flatsearch(db, entry_id) ! elsif obdadbs.include?(db) ! entry = obdaentry(db, entry_id) else entry = bget(arg) end + + display entry return entry end From k at pub.open-bio.org Mon Nov 28 02:11:02 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:06:08 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell session.rb,1.8,1.9 Message-ID: <200511280711.jAS7B2VL009729@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv9725/bio/shell Modified Files: session.rb Log Message: * save method is renamed to savefile * head method also accepts object (not only the filename) Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** session.rb 27 Nov 2005 17:39:00 -0000 1.8 --- session.rb 28 Nov 2005 07:10:59 -0000 1.9 *************** *** 104,108 **** end ! def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html if Bio::Shell.config[:pager] --- 104,108 ---- end ! def display(*obj) # *TODO* spec? # The original idea is from http://sheepman.parfait.ne.jp/20050215.html if Bio::Shell.config[:pager] *************** *** 127,138 **** end ! def head(file, num = 10) str = "" ! File.open(file) do |f| ! num.times do ! if line = f.gets ! str << line end end end display str --- 127,145 ---- end ! def head(arg, num = 10) str = "" ! if File.exists?(arg) ! File.open(arg) do |file| ! num.times do ! if line = file.gets ! str << line ! end end end + else + arg.to_s.each_with_index do |line, i| + break if i >= num + str << line + end end display str *************** *** 141,145 **** ### file save ! def save(file, *objs) if File.exists?(file) loop do --- 148,152 ---- ### file save ! def savefile(file, *objs) if File.exists?(file) loop do From k at pub.open-bio.org Mon Nov 28 02:12:05 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:07:13 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb,1.6,1.7 Message-ID: <200511280712.jAS7C5VL009798@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv9794/bio/shell/plugin Modified Files: codon.rb Log Message: * codon_usage_table command is integrated to codontable method Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** codon.rb 27 Nov 2005 15:01:17 -0000 1.6 --- codon.rb 28 Nov 2005 07:12:03 -0000 1.7 *************** *** 56,65 **** } ! def initialize(number, color = true, cuhash = nil) @aacode = Bio::AminoAcid.names @table = Bio::CodonTable[number] @number = number @cuhash = cuhash ! if color generate_colored_text else --- 56,65 ---- } ! def initialize(number, cuhash = nil) @aacode = Bio::AminoAcid.names @table = Bio::CodonTable[number] @number = number @cuhash = cuhash ! if Bio::Shell.config[:color] generate_colored_text else *************** *** 186,197 **** private ! def codon_usage_table(num = 1, codon_usage = nil) ! ColoredCodonTable.new(num, Bio::Shell.config(:color), codon_usage) ! end ! ! def codontable(num = 1) ! cct = codon_usage_table(num) ! display cct.output ! return cct.table end --- 186,193 ---- private ! def codontable(num = 1, codon_usage = nil) ! cct = ColoredCodonTable.new(num, codon_usage) ! display cct.output unless codon_usage ! return cct end From k at pub.open-bio.org Mon Nov 28 02:13:57 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:09:06 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin seq.rb,1.13,1.14 Message-ID: <200511280713.jAS7DvVL009846@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv9842/bio/shell/plugin Modified Files: seq.rb Log Message: * seqstat method is adapted to the change of Bio::Sequence#translate * codon_usage_table method is integrated to codontable method (in plugin/codon.rb) Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** seq.rb 28 Nov 2005 02:06:47 -0000 1.13 --- seq.rb 28 Nov 2005 07:13:55 -0000 1.14 *************** *** 79,83 **** rep << "3'->5' sequence : #{rev.fold(70,20).strip}#{dot}\n" [ 1, 2, 3, -1, -2, -3 ].each do |frame| ! pep = fwd.translate(frame).fold(70,20).strip rep << "Translation #{frame.to_s.rjust(2)} : #{pep}#{dot}\n" end --- 79,83 ---- rep << "3'->5' sequence : #{rev.fold(70,20).strip}#{dot}\n" [ 1, 2, 3, -1, -2, -3 ].each do |frame| ! pep = seq.subseq(1, max+2).translate(frame).fold(70,20).strip rep << "Translation #{frame.to_s.rjust(2)} : #{pep}#{dot}\n" end *************** *** 99,106 **** hash[codon] = percent end ! #-- ! #*TODO* how to hide this method ! #++ ! rep << codon_usage_table(1, hash).output begin --- 99,103 ---- hash[codon] = percent end ! rep << codontable(1, hash).output #*TODO* how to hide? begin From k at pub.open-bio.org Mon Nov 28 02:14:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:09:42 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin flatfile.rb,1.8,1.9 Message-ID: <200511280714.jAS7EeVL009915@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv9911/bio/shell/plugin Modified Files: flatfile.rb Log Message: * parse method is renamed to flatparse Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** flatfile.rb 28 Nov 2005 02:08:22 -0000 1.8 --- flatfile.rb 28 Nov 2005 07:14:37 -0000 1.9 *************** *** 66,70 **** end ! def parse(entry) if cls = Bio::FlatFile.autodetect(entry) return cls.new(entry) --- 66,70 ---- end ! def flatparse(entry) if cls = Bio::FlatFile.autodetect(entry) return cls.new(entry) From k at pub.open-bio.org Mon Nov 28 02:15:32 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:10:38 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin obda.rb,1.5,1.6 Message-ID: <200511280715.jAS7FWVL009986@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv9982/bio/shell/plugin Modified Files: obda.rb Log Message: * obda_get_entry is renamed to obdaentry Index: obda.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** obda.rb 28 Nov 2005 02:09:52 -0000 1.5 --- obda.rb 28 Nov 2005 07:15:30 -0000 1.6 *************** *** 40,44 **** end ! def obda_get_entry(dbname, entry_id) db = obda.get_database(dbname) unless db --- 40,44 ---- end ! def obdaentry(dbname, entry_id) db = obda.get_database(dbname) unless db *************** *** 50,56 **** yield entry else ! display entry end - return entry end --- 50,55 ---- yield entry else ! return entry end end From k at pub.open-bio.org Mon Nov 28 02:17:15 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:12:23 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin midi.rb,1.4,1.5 Message-ID: <200511280717.jAS7HFVL010076@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv10072/bio/shell/plugin Modified Files: midi.rb Log Message: * MidiTrack class is backed under the Bio::Sequence::NA Index: midi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/midi.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** midi.rb 25 Nov 2005 16:47:10 -0000 1.4 --- midi.rb 28 Nov 2005 07:17:13 -0000 1.5 *************** *** 36,360 **** #++ ! class MidiTrack ! ! MidiProg = [ ! "Acoustic Grand Piano", ! "Bright Acoustic Piano", ! "Electric grand Piano", ! "Honky Tonk Piano", ! "Eiectric Piano 1", ! "Electric Piano 2", ! "Harpsichord", ! "Clavinet", ! "Celesra", ! "Glockenspiel", ! "Music Box", ! "Vibraphone", ! "Marimba", ! "Xylophone", ! "Tubular bells", ! "Dulcimer", ! "Drawbar Organ", ! "Percussive Organ", ! "Rock Organ", ! "Church Organ", ! "Reed Organ", ! "Accordion", ! "Harmonica", ! "Tango Accordion", ! "Nylon Accustic Guitar", ! "Steel Acoustic Guitar", ! "Jazz Electric Guitar", ! "Ciean Electric Guitar", ! "Muted Electric Guitar", ! "Overdrive Guitar", ! "Distorted Guitar", ! "Guitar Harmonics", ! "Acoustic Bass", ! "Electric Fingered Bass", ! "Electric Picked Bass", ! "Fretless Bass", ! "Slap Bass 1", ! "Slap Bass 2", ! "Syn Bass 1", ! "Syn Bass 2", ! "Violin", ! "Viola", ! "Cello", ! "Contrabass", ! "Tremolo Strings", ! "Pizzicato Strings", ! "Orchestral Harp", ! "Timpani", ! "String Ensemble 1", ! "String Ensemble 2 (Slow)", ! "Syn Strings 1", ! "Syn Strings 2", ! "Choir Aahs", ! "Voice Oohs", ! "Syn Choir", ! "Orchestral Hit", ! "Trumpet", ! "Trombone", ! "Tuba", ! "Muted Trumpet", ! "French Horn", ! "Brass Section", ! "Syn Brass 1", ! "Syn Brass 2", ! "Soprano Sax", ! "Alto Sax", ! "Tenor Sax", ! "Baritone Sax", ! "Oboe", ! "English Horn", ! "Bassoon", ! "Clarinet", ! "Piccolo", ! "Flute", ! "Recorder", ! "Pan Flute", ! "Bottle Blow", ! "Shakuhachi", ! "Whistle", ! "Ocarina", ! "Syn Square Wave", ! "Syn Sawtooth Wave", ! "Syn Calliope", ! "Syn Chiff", ! "Syn Charang", ! "Syn Voice", ! "Syn Fifths Sawtooth Wave", ! "Syn Brass & Lead", ! "New Age Syn Pad", ! "Warm Syn Pad", ! "Polysynth Syn Pad", ! "Choir Syn Pad", ! "Bowed Syn Pad", ! "Metal Syn Pad", ! "Halo Syn Pad", ! "Sweep Syn Pad", ! "SFX Rain", ! "SFX Soundtrack", ! "SFX Crystal", ! "SFX Atmosphere", ! "SFX Brightness", ! "SFX Goblins", ! "SFX Echoes", ! "SFX Sci-fi", ! "Sitar", ! "Banjo", ! "Shamisen", ! "Koto", ! "Kalimba", ! "Bag Pipe", ! "Fiddle", ! "Shanai", ! "Tinkle Bell", ! "Agogo", ! "Steel Drums", ! "Woodblock", ! "Taiko Drum", ! "Melodic Tom", ! "Syn Drum", ! "Reverse Cymbal", ! "Guitar Fret Noise", ! "Breath Noise", ! "Seashore", ! "Bird Tweet", ! "Telephone Ring", ! "Helicopter", ! "Applause", ! "Gun Shot" ! ] ! ! Styles = { ! # "Ohno" => { ! # # http://home.hiroshima-u.ac.jp/cato/bunkakoryuron.html ! # }, ! "Ichinose" => { ! :tempo => 120, ! :scale => [0, 2, 4, 5, 7, 9, 11], ! :tones => [ ! {:prog => 9, :base => 60, :range => 2}, ! {:prog => 13, :base => 48, :range => 2}, ! {:prog => 41, :base => 48, :range => 2}, ! {:prog => 44, :base => 36, :range => 2}, ! ] ! }, ! "Okinawan" => { ! :tempo => 180, ! :scale => [0,4,5,7,11], ! :tones => [ ! {:prog => MidiProg.index("Harpsichord"), :base => 60, :range => 2}, ! {:prog => MidiProg.index("Dulcimer"), :base => 48, :range => 2}, ! {:prog => MidiProg.index("Fretless Base"), :base => 36, :range => 1}, ! ] ! }, ! "Major" => { ! :scale => [0,2,4,5,7,9,11], ! }, ! "Minor" => { ! :scale => [0,2,3,5,7,9,10], ! }, ! "Harmonic minor" => { ! :scale => [0,2,3,5,7,9,11], ! }, ! "Whole tone" => { ! :scale => [0,2,4,6,8,10], ! }, ! "Half tone" => { ! :scale => [0,1,2,3,4,5,6,7,8,9,10,11], ! }, ! "Indian" => { ! :scale => [0,1,4,5,7,8,11], ! }, ! "Arabic" => { ! :scale => [0,2,3,6,7,8,11], ! }, ! "Spanish" => { ! :scale => [0,1,3,4,5,7,8,10], ! }, ! "Japanese" => { ! :scale => [0,2,5,7,9], ! }, ! } ! ! def initialize(channel = 0, program = nil, base = nil, range = nil, scale = nil) ! @channel = channel & 0xff ! @program = program || 0 ! @base = base || 60 ! @range = range || 2 ! @scale = scale || [0, 2, 4, 5, 7, 9, 11] ! @tunes = [] ! @tune = 0 ! @code = [] ! @time = 0 ! @range.times do |i| ! @scale.each do |c| ! @tunes.push c + i * 12 ! end ! end ! @ttype = { ! 'aa' => 1, 'at' => 0, 'ac' => 3, 'ag' => -1, ! 'ta' => 0, 'tt' => -1, 'tc' => 1, 'tg' => -2, ! 'ca' => 2, 'ct' => 1, 'cc' => 2, 'cg' => 6, ! 'ga' => -1, 'gt' => -3, 'gc' => 0, 'gg' => -2, ! } ! @dtype = [ ! { 'aa' => 2, 'at' => 4, 'ac' => 4, 'ag' => 2, ! 'ta' => 2, 'tt' => 4, 'tc' => 4, 'tg' => 2, ! 'ca' => 2, 'ct' => 3, 'cc' => 1, 'cg' => 2, ! 'ga' => 1, 'gt' => 2, 'gc' => 2, 'gg' => 3, }, ! { 'aa' => 3, 'at' => 3, 'ac' => 2, 'ag' => 3, ! 'ta' => 3, 'tt' => 3, 'tc' => 2, 'tg' => 2, ! 'ca' => 3, 'ct' => 2, 'cc' => 1, 'cg' => 1, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, }, ! { 'aa' => 2, 'at' => 2, 'ac' => 2, 'ag' => 2, ! 'ta' => 1, 'tt' => 1, 'tc' => 2, 'tg' => 2, ! 'ca' => 2, 'ct' => 2, 'cc' => 2, 'cg' => 3, ! 'ga' => 2, 'gt' => 2, 'gc' => 3, 'gg' => 1, }, ! { 'aa' => 1, 'at' => 1, 'ac' => 1, 'ag' => 1, ! 'ta' => 1, 'tt' => 1, 'tc' => 1, 'tg' => 1, ! 'ca' => 1, 'ct' => 1, 'cc' => 1, 'cg' => 3, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, }, ! ] ! @code.concat [0x00, 0xc0 | (@channel & 0xff)] ! @code.concat icode(@program & 0xff, 1) ! end ! def icode(num, n) ! code = [] ! n.times do |i| ! code.push num & 0xff ! num >>= 8 end - code.reverse - end ! def rcode(num) ! code = [] ! code.push num & 0x7f ! while num > 0x7f ! num >>= 7 ! code.push num & 0x7f | 0x80 end - code.reverse - end ! def c2s(code) ! ans = "" ! code.each do |c| ! ans += c.chr end - ans - end ! def push(s) ! tt = @time % 4 ! t = @ttype[s[0, 2]] ! d = @dtype[tt][s[2, 2]] ! if !t.nil? && !d.nil? ! @tune += t ! @tune %= @tunes.length ! if tt == 0 ! vel = 90 ! elsif tt == 1 && d > 1 ! vel = 100 ! elsif tt == 2 ! vel = 60 ! else ! vel = 50 end ! @code.concat rcode(1) ! @code.concat [0x90 | @channel, @tunes[@tune] + @base, vel] ! @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, @tunes[@tune] + @base, 0] ! @time += d end - end ! def push_silent(d) ! @code.concat rcode(1) ! @code.concat [0x90 | @channel, 0, 0] ! @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, 0, 0] ! @time += d; ! end ! def encode ! ans ="MTrk" ! ans += c2s(icode(@code.length + 4, 4)) ! ans += c2s(@code) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end ! def header(num, tempo = 120) ! ans = "MThd" ! ans += c2s(icode(6, 4)) ! ans += c2s(icode(1, 2)) ! ans += c2s(icode(num + 1, 2)) ! ans += c2s(icode(480, 2)) ! ans += "MTrk" ! ans += c2s(icode(11, 4)) ! ans += c2s([0x00, 0xff, 0x51, 0x03]) ! ans += c2s(icode(60000000 / tempo, 3)) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end ! end # MidiTrack - class Bio::Sequence::NA # style: --- 36,360 ---- #++ ! class Bio::Sequence::NA ! class MidiTrack ! MidiProg = [ ! "Acoustic Grand Piano", ! "Bright Acoustic Piano", ! "Electric grand Piano", ! "Honky Tonk Piano", ! "Eiectric Piano 1", ! "Electric Piano 2", ! "Harpsichord", ! "Clavinet", ! "Celesra", ! "Glockenspiel", ! "Music Box", ! "Vibraphone", ! "Marimba", ! "Xylophone", ! "Tubular bells", ! "Dulcimer", ! "Drawbar Organ", ! "Percussive Organ", ! "Rock Organ", ! "Church Organ", ! "Reed Organ", ! "Accordion", ! "Harmonica", ! "Tango Accordion", ! "Nylon Accustic Guitar", ! "Steel Acoustic Guitar", ! "Jazz Electric Guitar", ! "Ciean Electric Guitar", ! "Muted Electric Guitar", ! "Overdrive Guitar", ! "Distorted Guitar", ! "Guitar Harmonics", ! "Acoustic Bass", ! "Electric Fingered Bass", ! "Electric Picked Bass", ! "Fretless Bass", ! "Slap Bass 1", ! "Slap Bass 2", ! "Syn Bass 1", ! "Syn Bass 2", ! "Violin", ! "Viola", ! "Cello", ! "Contrabass", ! "Tremolo Strings", ! "Pizzicato Strings", ! "Orchestral Harp", ! "Timpani", ! "String Ensemble 1", ! "String Ensemble 2 (Slow)", ! "Syn Strings 1", ! "Syn Strings 2", ! "Choir Aahs", ! "Voice Oohs", ! "Syn Choir", ! "Orchestral Hit", ! "Trumpet", ! "Trombone", ! "Tuba", ! "Muted Trumpet", ! "French Horn", ! "Brass Section", ! "Syn Brass 1", ! "Syn Brass 2", ! "Soprano Sax", ! "Alto Sax", ! "Tenor Sax", ! "Baritone Sax", ! "Oboe", ! "English Horn", ! "Bassoon", ! "Clarinet", ! "Piccolo", ! "Flute", ! "Recorder", ! "Pan Flute", ! "Bottle Blow", ! "Shakuhachi", ! "Whistle", ! "Ocarina", ! "Syn Square Wave", ! "Syn Sawtooth Wave", ! "Syn Calliope", ! "Syn Chiff", ! "Syn Charang", ! "Syn Voice", ! "Syn Fifths Sawtooth Wave", ! "Syn Brass & Lead", ! "New Age Syn Pad", ! "Warm Syn Pad", ! "Polysynth Syn Pad", ! "Choir Syn Pad", ! "Bowed Syn Pad", ! "Metal Syn Pad", ! "Halo Syn Pad", ! "Sweep Syn Pad", ! "SFX Rain", ! "SFX Soundtrack", ! "SFX Crystal", ! "SFX Atmosphere", ! "SFX Brightness", ! "SFX Goblins", ! "SFX Echoes", ! "SFX Sci-fi", ! "Sitar", ! "Banjo", ! "Shamisen", ! "Koto", ! "Kalimba", ! "Bag Pipe", ! "Fiddle", ! "Shanai", ! "Tinkle Bell", ! "Agogo", ! "Steel Drums", ! "Woodblock", ! "Taiko Drum", ! "Melodic Tom", ! "Syn Drum", ! "Reverse Cymbal", ! "Guitar Fret Noise", ! "Breath Noise", ! "Seashore", ! "Bird Tweet", ! "Telephone Ring", ! "Helicopter", ! "Applause", ! "Gun Shot" ! ] ! Styles = { ! # "Ohno" => { ! # # http://home.hiroshima-u.ac.jp/cato/bunkakoryuron.html ! # }, ! "Ichinose" => { ! :tempo => 120, ! :scale => [0, 2, 4, 5, 7, 9, 11], ! :tones => [ ! {:prog => 9, :base => 60, :range => 2}, ! {:prog => 13, :base => 48, :range => 2}, ! {:prog => 41, :base => 48, :range => 2}, ! {:prog => 44, :base => 36, :range => 2}, ! ] }, ! "Okinawan" => { ! :tempo => 180, ! :scale => [0,4,5,7,11], ! :tones => [ ! {:prog => MidiProg.index("Harpsichord"), :base => 60, :range => 2}, ! {:prog => MidiProg.index("Dulcimer"), :base => 48, :range => 2}, ! {:prog => MidiProg.index("Fretless Base"), :base => 36, :range => 1}, ! ] }, ! "Major" => { ! :scale => [0,2,4,5,7,9,11], }, ! "Minor" => { ! :scale => [0,2,3,5,7,9,10], }, ! "Harmonic minor" => { ! :scale => [0,2,3,5,7,9,11], ! }, ! "Whole tone" => { ! :scale => [0,2,4,6,8,10], ! }, ! "Half tone" => { ! :scale => [0,1,2,3,4,5,6,7,8,9,10,11], ! }, ! "Indian" => { ! :scale => [0,1,4,5,7,8,11], ! }, ! "Arabic" => { ! :scale => [0,2,3,6,7,8,11], ! }, ! "Spanish" => { ! :scale => [0,1,3,4,5,7,8,10], ! }, ! "Japanese" => { ! :scale => [0,2,5,7,9], ! }, ! } ! def initialize(channel = 0, program = nil, base = nil, range = nil, scale = nil) ! @channel = channel & 0xff ! @program = program || 0 ! @base = base || 60 ! @range = range || 2 ! @scale = scale || [0, 2, 4, 5, 7, 9, 11] ! @tunes = [] ! @tune = 0 ! @code = [] ! @time = 0 ! ! @range.times do |i| ! @scale.each do |c| ! @tunes.push c + i * 12 ! end ! end ! ! @ttype = { ! 'aa' => 1, 'at' => 0, 'ac' => 3, 'ag' => -1, ! 'ta' => 0, 'tt' => -1, 'tc' => 1, 'tg' => -2, ! 'ca' => 2, 'ct' => 1, 'cc' => 2, 'cg' => 6, ! 'ga' => -1, 'gt' => -3, 'gc' => 0, 'gg' => -2, ! } ! @dtype = [ ! { 'aa' => 2, 'at' => 4, 'ac' => 4, 'ag' => 2, ! 'ta' => 2, 'tt' => 4, 'tc' => 4, 'tg' => 2, ! 'ca' => 2, 'ct' => 3, 'cc' => 1, 'cg' => 2, ! 'ga' => 1, 'gt' => 2, 'gc' => 2, 'gg' => 3, ! }, ! { 'aa' => 3, 'at' => 3, 'ac' => 2, 'ag' => 3, ! 'ta' => 3, 'tt' => 3, 'tc' => 2, 'tg' => 2, ! 'ca' => 3, 'ct' => 2, 'cc' => 1, 'cg' => 1, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, ! }, ! { 'aa' => 2, 'at' => 2, 'ac' => 2, 'ag' => 2, ! 'ta' => 1, 'tt' => 1, 'tc' => 2, 'tg' => 2, ! 'ca' => 2, 'ct' => 2, 'cc' => 2, 'cg' => 3, ! 'ga' => 2, 'gt' => 2, 'gc' => 3, 'gg' => 1, ! }, ! { 'aa' => 1, 'at' => 1, 'ac' => 1, 'ag' => 1, ! 'ta' => 1, 'tt' => 1, 'tc' => 1, 'tg' => 1, ! 'ca' => 1, 'ct' => 1, 'cc' => 1, 'cg' => 3, ! 'ga' => 1, 'gt' => 1, 'gc' => 1, 'gg' => 1, ! }, ! ] ! ! @code.concat [0x00, 0xc0 | (@channel & 0xff)] ! @code.concat icode(@program & 0xff, 1) end ! def icode(num, n) ! code = [] ! n.times do |i| ! code.push num & 0xff ! num >>= 8 ! end ! code.reverse end ! def rcode(num) ! code = [] ! code.push num & 0x7f ! while num > 0x7f ! num >>= 7 ! code.push num & 0x7f | 0x80 ! end ! code.reverse end ! def c2s(code) ! ans = "" ! code.each do |c| ! ans += c.chr end ! ans end ! def push(s) ! tt = @time % 4 ! t = @ttype[s[0, 2]] ! d = @dtype[tt][s[2, 2]] ! if !t.nil? && !d.nil? ! @tune += t ! @tune %= @tunes.length ! if tt == 0 ! vel = 90 ! elsif tt == 1 && d > 1 ! vel = 100 ! elsif tt == 2 ! vel = 60 ! else ! vel = 50 ! end ! @code.concat rcode(1) ! @code.concat [0x90 | @channel, @tunes[@tune] + @base, vel] ! @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, @tunes[@tune] + @base, 0] ! @time += d ! end ! end ! def push_silent(d) ! @code.concat rcode(1) ! @code.concat [0x90 | @channel, 0, 0] ! @code.concat rcode(240 * d) ! @code.concat [0x80 | @channel, 0, 0] ! @time += d; ! end ! def encode ! ans ="MTrk" ! ans += c2s(icode(@code.length + 4, 4)) ! ans += c2s(@code) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end ! def header(num, tempo = 120) ! ans = "MThd" ! ans += c2s(icode(6, 4)) ! ans += c2s(icode(1, 2)) ! ans += c2s(icode(num + 1, 2)) ! ans += c2s(icode(480, 2)) ! ans += "MTrk" ! ans += c2s(icode(11, 4)) ! ans += c2s([0x00, 0xff, 0x51, 0x03]) ! ans += c2s(icode(60000000 / tempo, 3)) ! ans += c2s([0x00, 0xff, 0x2f, 0x00]) ! ans ! end + end # MidiTrack # style: *************** *** 413,417 **** private ! def midi(seq, filename, *args) begin print "Saving MIDI file (#{filename}) ... " --- 413,417 ---- private ! def midi(seq, filename, *args) # *TODO* interface? begin print "Saving MIDI file (#{filename}) ... " From k at pub.open-bio.org Mon Nov 28 02:18:16 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 02:13:19 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin keggapi.rb,1.4,1.5 Message-ID: <200511280718.jAS7IGVL010145@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv10141/bio/shell/plugin Modified Files: keggapi.rb Log Message: * improved to use Bio::Shell::Private module for not for public methods Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** keggapi.rb 25 Nov 2005 16:07:55 -0000 1.4 --- keggapi.rb 28 Nov 2005 07:18:14 -0000 1.5 *************** *** 31,34 **** --- 31,44 ---- module Bio::Shell + module Private + def keeggapi_definition2tab(list) + ary = [] + list.each do |entry| + ary << "#{entry.entry_id}:\t#{entry.definition}" + end + return ary + end + end + private *************** *** 40,51 **** end - def _definition(list) - ary = [] - list.each do |entry| - ary << "#{entry.entry_id}:\t#{entry.definition}" - end - return ary - end - # DBGET --- 50,53 ---- *************** *** 67,73 **** yield result else ! display result end - return result end --- 69,74 ---- yield result else ! return result end end *************** *** 88,92 **** def keggdbs list = keggapi.list_databases ! result = _definition(list).join("\n") display result return result --- 89,93 ---- def keggdbs list = keggapi.list_databases ! result = Bio::Shell.keggapi_definition2tab(list).join("\n") display result return result *************** *** 95,99 **** def keggorgs list = keggapi.list_organisms ! result = _definition(list).sort.join("\n") display result return result --- 96,100 ---- def keggorgs list = keggapi.list_organisms ! result = Bio::Shell.keggapi_definition2tab(list).sort.join("\n") display result return result *************** *** 102,114 **** def keggpathways(org = "map") list = keggapi.list_pathways(org) ! result = _definition(list).join("\n") display result return result end ! #-- ! # *TODO* use kegg das instead? ! #++ ! def kegggenome(org) result = "" require 'net/ftp' --- 103,113 ---- def keggpathways(org = "map") list = keggapi.list_pathways(org) ! result = Bio::Shell.keggapi_definition2tab(list).join("\n") display result return result end ! =begin ! def kegggenome(org) # *TODO* use das instead? result = "" require 'net/ftp' *************** *** 125,132 **** return result end ! ! # def kegggene(genes_id) ! # keggapi.bget() ! # end end --- 124,128 ---- return result end ! =end end From k at pub.open-bio.org Mon Nov 28 07:06:20 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 07:01:21 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin midi.rb,1.5,1.6 Message-ID: <200511281206.jASC6KVL011249@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv11245/plugin Modified Files: midi.rb Log Message: * midi method is renamed to midifile Index: midi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/midi.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** midi.rb 28 Nov 2005 07:17:13 -0000 1.5 --- midi.rb 28 Nov 2005 12:06:18 -0000 1.6 *************** *** 413,417 **** private ! def midi(seq, filename, *args) # *TODO* interface? begin print "Saving MIDI file (#{filename}) ... " --- 413,417 ---- private ! def midifile(filename, seq, *args) begin print "Saving MIDI file (#{filename}) ... " From k at pub.open-bio.org Mon Nov 28 07:07:44 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 07:02:46 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell access.rb, 1.2, 1.3 session.rb, 1.9, 1.10 Message-ID: <200511281207.jASC7iVL011299@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell In directory pub.open-bio.org:/tmp/cvs-serv11293 Modified Files: access.rb session.rb Log Message: * display is removed or changed to puts * removed require Index: access.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/access.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** access.rb 28 Nov 2005 07:09:34 -0000 1.2 --- access.rb 28 Nov 2005 12:07:42 -0000 1.3 *************** *** 33,42 **** # Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid) # sequence from ! # * String -- "atgcatgc" or "MQKKP" ! # * File -- "gbvrl.gbk" (only the first entry is used) ! # * ID -- "embl:BUM" (entry is retrieved by the OBDA) def seq(arg) seq = "" - if arg.kind_of?(Bio::Sequence) seq = arg --- 33,42 ---- # Obtain a Bio::Sequence::NA (DNA) or a Bio::Sequence::AA (Amino Acid) # sequence from ! # * String -- "atgcatgc" or "MQKKP" ! # * IO -- io = IO.popen("gzip -dc db.gz") (first entry only) ! # * "filename" -- "gbvrl.gbk" (first entry only) ! # * "db:entry" -- "embl:BUM" (entry is retrieved by the ent method) def seq(arg) seq = "" if arg.kind_of?(Bio::Sequence) seq = arg *************** *** 61,73 **** seq = Bio::Sequence.auto(tmp) end - return seq end def ent(arg) entry = "" - db, entry_id = arg.to_s.strip.split(/:/) - if arg.respond_to?(:gets) or File.exists?(arg) entry = flatfile(arg) --- 61,74 ---- seq = Bio::Sequence.auto(tmp) end return seq end + # Obtain a database entry from + # * IO -- IO object (first entry only) + # * "filename" -- local file (first entry only) + # * "db:entry" -- local bioflat, OBDA, KEGG API def ent(arg) entry = "" db, entry_id = arg.to_s.strip.split(/:/) if arg.respond_to?(:gets) or File.exists?(arg) entry = flatfile(arg) *************** *** 79,84 **** entry = bget(arg) end - - display entry return entry end --- 80,83 ---- Index: session.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/session.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** session.rb 28 Nov 2005 07:10:59 -0000 1.9 --- session.rb 28 Nov 2005 12:07:42 -0000 1.10 *************** *** 37,41 **** eval(x, conf.workspace.binding).nil? } ! display list.inspect end --- 37,41 ---- eval(x, conf.workspace.binding).nil? } ! puts list.inspect end *************** *** 104,108 **** end ! def display(*obj) # *TODO* spec? # The original idea is from http://sheepman.parfait.ne.jp/20050215.html if Bio::Shell.config[:pager] --- 104,108 ---- end ! def display(*obj) # The original idea is from http://sheepman.parfait.ne.jp/20050215.html if Bio::Shell.config[:pager] *************** *** 143,147 **** end end ! display str end --- 143,148 ---- end end ! puts str ! return str end *************** *** 176,184 **** Dir.chdir(dir) end ! display Dir.pwd.inspect end def pwd ! display Dir.pwd.inspect end --- 177,185 ---- Dir.chdir(dir) end ! puts Dir.pwd.inspect end def pwd ! puts Dir.pwd.inspect end *************** *** 204,208 **** str << format("%s %s%13d %s\n", mode, date, byte, name) } ! display str end end --- 205,210 ---- str << format("%s %s%13d %s\n", mode, date, byte, name) } ! puts str ! return str end end From k at pub.open-bio.org Mon Nov 28 07:07:44 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Mon Nov 28 07:02:51 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin codon.rb, 1.7, 1.8 flatfile.rb, 1.9, 1.10 keggapi.rb, 1.5, 1.6 obda.rb, 1.6, 1.7 seq.rb, 1.14, 1.15 Message-ID: <200511281207.jASC7iVL011304@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv11293/plugin Modified Files: codon.rb flatfile.rb keggapi.rb obda.rb seq.rb Log Message: * display is removed or changed to puts * removed require Index: obda.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** obda.rb 28 Nov 2005 07:15:30 -0000 1.6 --- obda.rb 28 Nov 2005 12:07:42 -0000 1.7 *************** *** 27,32 **** # - require 'bio/io/registry' - module Bio::Shell --- 27,30 ---- *************** *** 56,60 **** def obdadbs result = obda.databases.map {|db| db.database} - display result return result end --- 54,57 ---- *************** *** 63,67 **** serv = Bio::Fetch.new("http://www.ebi.ac.uk/cgi-bin/dbfetch") result = serv.fetch(db, id, style, format) - display result return result end --- 60,63 ---- Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** flatfile.rb 28 Nov 2005 07:14:37 -0000 1.9 --- flatfile.rb 28 Nov 2005 12:07:42 -0000 1.10 *************** *** 27,32 **** # - require 'bio/io/flatfile' - module Bio::Shell --- 27,30 ---- *************** *** 106,118 **** return end Bio::FlatFileIndex.open(dir) do |db| if results = db.include?(keyword) results.each do |entry_id| ! display db.search_primary(entry_id) end else ! display "No hits found" end end end --- 104,118 ---- return end + entry = '' Bio::FlatFileIndex.open(dir) do |db| if results = db.include?(keyword) results.each do |entry_id| ! entry << db.search_primary(entry_id) end else ! warn "Error: No hits found in #{dbname} (#{keyword})" end end + return entry end Index: codon.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/codon.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** codon.rb 28 Nov 2005 07:12:03 -0000 1.7 --- codon.rb 28 Nov 2005 12:07:42 -0000 1.8 *************** *** 27,34 **** # - require 'bio/data/codontable' - require 'bio/data/aa' - require 'bio/data/na' - module Bio::Shell --- 27,30 ---- *************** *** 188,193 **** def codontable(num = 1, codon_usage = nil) cct = ColoredCodonTable.new(num, codon_usage) ! display cct.output unless codon_usage ! return cct end --- 184,193 ---- def codontable(num = 1, codon_usage = nil) cct = ColoredCodonTable.new(num, codon_usage) ! if codon_usage ! return cct ! else ! puts cct.output ! return cct.table ! end end Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** keggapi.rb 28 Nov 2005 07:18:14 -0000 1.5 --- keggapi.rb 28 Nov 2005 12:07:42 -0000 1.6 *************** *** 27,36 **** # - require 'bio/io/keggapi' - module Bio::Shell module Private ! def keeggapi_definition2tab(list) ary = [] list.each do |entry| --- 27,34 ---- # module Bio::Shell module Private ! def keggapi_definition2tab(list) ary = [] list.each do |entry| *************** *** 54,58 **** def binfo(db = "all") result = keggapi.binfo(db) ! display result return result end --- 52,56 ---- def binfo(db = "all") result = keggapi.binfo(db) ! puts result return result end *************** *** 60,64 **** def bfind(str) result = keggapi.bfind(str) - display result return result end --- 58,61 ---- *************** *** 75,79 **** def btit(str) result = keggapi.btit(str) - display result return result end --- 72,75 ---- *************** *** 81,85 **** def bconv(str) result = keggapi.bconv(str) - display result return result end --- 77,80 ---- *************** *** 90,95 **** list = keggapi.list_databases result = Bio::Shell.keggapi_definition2tab(list).join("\n") ! display result ! return result end --- 85,90 ---- list = keggapi.list_databases result = Bio::Shell.keggapi_definition2tab(list).join("\n") ! puts result ! return list.map {|x| x.entry_id} end *************** *** 97,102 **** list = keggapi.list_organisms result = Bio::Shell.keggapi_definition2tab(list).sort.join("\n") ! display result ! return result end --- 92,97 ---- list = keggapi.list_organisms result = Bio::Shell.keggapi_definition2tab(list).sort.join("\n") ! puts result ! return list.map {|x| x.entry_id} end *************** *** 104,113 **** list = keggapi.list_pathways(org) result = Bio::Shell.keggapi_definition2tab(list).join("\n") ! display result ! return result end ! =begin ! def kegggenome(org) # *TODO* use das instead? result = "" require 'net/ftp' --- 99,107 ---- list = keggapi.list_pathways(org) result = Bio::Shell.keggapi_definition2tab(list).join("\n") ! puts result ! return list.map {|x| x.entry_id} end ! def kegggenomeseq(org) result = "" require 'net/ftp' *************** *** 117,128 **** file = list.grep(/.*genome$/).shift if file ! base = File.basename(file) ! ftp.getbinaryfile(file, base) ! result = File.read(base) end end return result end - =end end --- 111,121 ---- file = list.grep(/.*genome$/).shift if file ! open("ftp://ftp.genome.jp/#{file}") do |file| ! result = file.read ! end end end return result end end Index: seq.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/seq.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** seq.rb 28 Nov 2005 07:13:55 -0000 1.14 --- seq.rb 28 Nov 2005 12:07:42 -0000 1.15 *************** *** 27,33 **** # - require 'bio/sequence' - require 'bio/util/color_scheme' - module Bio::Shell --- 27,30 ---- *************** *** 138,142 **** end rep << "//\n" ! display rep end --- 135,140 ---- end rep << "//\n" ! puts rep ! return rep end *************** *** 146,157 **** seq = seq(str) if str.length < 16 ! display "Sequence must be longer than 16 bases." return end if ! seq.respond_to?(:complement) ! display "Sequence must be a DNA sequence." return end - helix = '' pairs = [ [5, 0], [4, 2], [3, 3], [2, 4], [1, 4], [0, 3], [0, 2], [1, 0] ] --- 144,154 ---- seq = seq(str) if str.length < 16 ! warn "Error: Sequence must be longer than 16 bases." return end if ! seq.respond_to?(:complement) ! warn "Error: Sequence must be a DNA sequence." return end pairs = [ [5, 0], [4, 2], [3, 3], [2, 4], [1, 4], [0, 3], [0, 2], [1, 0] ] *************** *** 159,170 **** pairs.each_with_index do |ij, x| base = subseq[x, 1] ! helix << ' ' * ij[0] + base + '-' * ij[1] + base.complement + "\n" end pairs.reverse.each_with_index do |ij, x| base = subseq[x + 8, 1] ! helix << ' ' * ij[0] + base.complement + '-' * ij[1] + base + "\n" end end - display helix end --- 156,166 ---- pairs.each_with_index do |ij, x| base = subseq[x, 1] ! puts ' ' * ij[0] + base + '-' * ij[1] + base.complement + "\n" end pairs.reverse.each_with_index do |ij, x| base = subseq[x + 8, 1] ! puts ' ' * ij[0] + base.complement + '-' * ij[1] + base + "\n" end end end From k at pub.open-bio.org Tue Nov 29 20:54:40 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 29 20:49:32 2005 Subject: [BioRuby-cvs] bioruby/lib/bio feature.rb,1.8,1.9 Message-ID: <200511300154.jAU1seVL017451@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory pub.open-bio.org:/tmp/cvs-serv17445 Modified Files: feature.rb Log Message: * Bio::Feature#to_hash, Bio::Feature#[] methods are added to replace Bio::Feature#assoc method (which returns incomplete value when the feature contains multiple qualifiers of the same name). * Bio::Feature#each method is improved to accept qualifier name * Bio::Features#first, Bio::Features#last methods are added. Index: feature.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/feature.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** feature.rb 4 Nov 2005 17:36:47 -0000 1.8 --- feature.rb 30 Nov 2005 01:54:38 -0000 1.9 *************** *** 99,104 **** # Iterates on each qualifier. ! def each @qualifiers.each do |x| yield x end --- 99,105 ---- # Iterates on each qualifier. ! def each(arg = nil) @qualifiers.each do |x| + next if arg and x.qualifier != arg yield x end *************** *** 107,110 **** --- 108,112 ---- # Returns a Hash constructed from qualifier objects. def assoc + STDERR.puts "Bio::Feature#assoc is deprecated, use Bio::Feature#to_hash instead" if $DEBUG hash = Hash.new @qualifiers.each do |x| *************** *** 114,117 **** --- 116,133 ---- end + # Returns a Hash constructed from qualifier objects. + def to_hash + hash = Hash.new + @qualifiers.each do |x| + hash[x.qualifier] ||= [] + hash[x.qualifier] << x.value + end + return hash + end + + # Short cut for the Bio::Feature#to_hash[key] + def [](key) + self.to_hash[key] + end # Container for the qualifier-value pair. *************** *** 143,146 **** --- 159,168 ---- attr_accessor :features + def to_gff + # *TODO* + # to generate Bio::GFF object and implement Bio::GFF#to_s or + # to generate GFF string in this method? + end + # Appends a Feature object to Features. def append(a) *************** *** 161,164 **** --- 183,196 ---- def [](*arg) @features[*arg] + end + + # Short cut for the Features#features.first + def first + @features.first + end + + # Short cut for the Features#features.last + def last + @features.last end From k at pub.open-bio.org Tue Nov 29 20:57:20 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 29 20:52:10 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin flatfile.rb,1.10,1.11 Message-ID: <200511300157.jAU1vKVL017658@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv17654/shell/plugin Modified Files: flatfile.rb Log Message: * bug fixed to make flatsearch work Index: flatfile.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** flatfile.rb 28 Nov 2005 12:07:42 -0000 1.10 --- flatfile.rb 30 Nov 2005 01:57:18 -0000 1.11 *************** *** 108,112 **** if results = db.include?(keyword) results.each do |entry_id| ! entry << db.search_primary(entry_id) end else --- 108,112 ---- if results = db.include?(keyword) results.each do |entry_id| ! entry << db.search_primary(entry_id).to_s end else From k at pub.open-bio.org Tue Nov 29 21:01:06 2005 From: k at pub.open-bio.org (Katayama Toshiaki) Date: Tue Nov 29 20:55:56 2005 Subject: [BioRuby-cvs] bioruby/lib/bio/shell/plugin keggapi.rb, 1.6, 1.7 obda.rb, 1.7, 1.8 Message-ID: <200511300201.jAU216VL017740@pub.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin In directory pub.open-bio.org:/tmp/cvs-serv17734/shell/plugin Modified Files: keggapi.rb obda.rb Log Message: * initialize routine simplified Index: obda.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/obda.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** obda.rb 28 Nov 2005 12:07:42 -0000 1.7 --- obda.rb 30 Nov 2005 02:01:04 -0000 1.8 *************** *** 32,39 **** def obda ! unless @obda ! @obda = Bio::Registry.new ! end ! return @obda end --- 32,36 ---- def obda ! @obda ||= Bio::Registry.new end Index: keggapi.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** keggapi.rb 28 Nov 2005 12:07:42 -0000 1.6 --- keggapi.rb 30 Nov 2005 02:01:04 -0000 1.7 *************** *** 42,49 **** def keggapi ! unless @keggapi ! @keggapi = Bio::KEGG::API.new ! end ! return @keggapi end --- 42,46 ---- def keggapi ! @keggapi ||= Bio::KEGG::API.new end