[BioRuby-cvs] bioruby/lib/bio/appl/blast wublast.rb,1.2,1.3

Naohisa Goto ngoto at pub.open-bio.org
Mon Oct 31 14:24:16 EST 2005


Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast
In directory pub.open-bio.org:/tmp/cvs-serv4472

Modified Files:
	wublast.rb 
Log Message:
Added Rdoc documentation.
Fixed bug in F0dbstat#parse_dbstat.
Catch up changes in format0.rb.


Index: wublast.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/wublast.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** wublast.rb	8 Sep 2005 01:22:08 -0000	1.2
--- wublast.rb	31 Oct 2005 19:24:14 -0000	1.3
***************
*** 1,7 ****
  #
! # bio/appl/blast/wublast.rb - WU-BLAST default output parser
  # 
! #   Copyright (C) 2003 GOTO Naohisa <ng at bioruby.org>
  #
  #  This library is free software; you can redistribute it and/or
  #  modify it under the terms of the GNU Lesser General Public
--- 1,9 ----
  #
! # = bio/appl/blast/wublast.rb - WU-BLAST default output parser
  # 
! # Copyright:: Copyright (C) 2003 GOTO Naohisa <ng at bioruby.org>
! # Licence:: LGPL
  #
+ #--
  #  This library is free software; you can redistribute it and/or
  #  modify it under the terms of the GNU Lesser General Public
***************
*** 17,32 ****
  #  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$
  #
  
  require 'bio/appl/blast/format0'
  
! module Bio
!   class Blast
!     module WU
  
        class Report < Default::Report
  
          def parameters
            parse_parameters
--- 19,52 ----
  #  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$
  #
+ #  WU-BLAST default output parser.
+ #
+ #  The parser is still incomplete and may contain many bugs,
+ #  because I didn't have WU-BLAST license.
+ #  It was tested under web-based WU-BLAST results and
+ #  obsolete version downloaded from http://blast.wustl.edu/ .
+ #
+ # = References
+ # * http://blast.wustl.edu/
+ # * http://www.ebi.ac.uk/blast2/
+ #
  
  require 'bio/appl/blast/format0'
  
! module Bio #:nodoc:
!   class Blast #:nodoc:
!     module WU #:nodoc:
  
+       # Bio::Blast::WU::Report parses WU-BLAST default output
+       # and stores information in the data.
+       # It may contain a Bio::Blast::WU::Report::Iteration object.
+       # Because it inherits Bio::Blast::Default::Report,
+       # please also refer Bio::Blast::Default::Report.
        class Report < Default::Report
  
+         # Returns parameters (???)
          def parameters
            parse_parameters
***************
*** 34,37 ****
--- 54,58 ----
          end
  
+         # Returns parameter matrix (???)
          def parameter_matrix
            parse_parameters
***************
*** 39,44 ****
--- 60,67 ----
          end
  
+         # Returns e-value threshold specified when BLAST was executed.
          def expect; parse_parameters; @parameters['E']; end
  
+         # Returns warning messages.
          def warnings
            unless defined?(@warnings)
***************
*** 49,52 ****
--- 72,76 ----
          end
  
+         # Returns notice messages.
          def notice
            unless defined?(@notice)
***************
*** 57,60 ****
--- 81,85 ----
  
          private
+         # Splits headers.
          def format0_split_headers(data)
            @f0header = data.shift
***************
*** 80,87 ****
--- 105,114 ----
          end
  
+         # Splits search data.
          def format0_split_search(data)
            [ Iteration.new(data) ]
          end
  
+         # Splits statistics parameters.
          def format0_split_stat_params(data)
            @f0warnings = []
***************
*** 100,106 ****
            @f0dbstat = F0dbstat.new(@f0wu_stats)
            itr = @iterations[0]
!           itr.f0dbstat = @f0dbstat if itr
          end
  
          def parse_parameters
            unless defined?(@parse_parameters)
--- 127,135 ----
            @f0dbstat = F0dbstat.new(@f0wu_stats)
            itr = @iterations[0]
!           x = @f0dbstat
!           itr.instance_eval { @f0dbstat = x } if itr
          end
  
+         # Splits parameters.
          def parse_parameters
            unless defined?(@parse_parameters)
***************
*** 126,130 ****
          end
  
!         class F0dbstat < Default::Report::F0dbstat
            def initialize(ary)
              @f0stat = ary
--- 155,161 ----
          end
  
!         # Stores database statistics.
!         # Internal use only. Users must not use the class.
!         class F0dbstat < Default::Report::F0dbstat #:nodoc:
            def initialize(ary)
              @f0stat = ary
***************
*** 132,145 ****
            end
  
            #undef :f0params
            #undef :matrix, :gap_open, :gap_extend,
            #  :eff_space, :expect, :sc_match, :sc_mismatch,
            #  :num_hits
  
            def parse_dbstat
              unless defined?(@parse_dbstat)
!               @f0stat.each do |x|
!                 parse_colon_separated(@hash, x)
!               end
                @database = @hash['Database']
                @posted_date = @hash['Posted']
--- 163,177 ----
            end
  
+           #--
            #undef :f0params
            #undef :matrix, :gap_open, :gap_extend,
            #  :eff_space, :expect, :sc_match, :sc_mismatch,
            #  :num_hits
+           #++
  
+           # Parses database statistics.
            def parse_dbstat
              unless defined?(@parse_dbstat)
!               parse_colon_separated_params(@hash, @f0stat)
                @database = @hash['Database']
                @posted_date = @hash['Posted']
***************
*** 157,167 ****
          end #class F0dbstat
  
!         class Frame
!         end #class FrameParams
  
          class Iteration < Default::Report::Iteration
            def initialize(data)
              @f0stat = []
!             @f0dbstat = nil
              @f0hitlist = []
              @hits = []
--- 189,212 ----
          end #class F0dbstat
  
!         #--
!         #class Frame
!         #end #class FrameParams
!         #++
  
+         # Iteration class for WU-BLAST report.
+         # Though WU-BLAST does not iterate like PSI-BLAST,
+         # Bio::Blast::WU::Report::Iteration aims to keep compatibility
+         # with Bio::Blast::Default::Report::* classes.
+         # It may contain some Bio::Blast::WU::Report::Hit objects.
+         # Because it inherits Bio::Blast::Default::Report::Iteration,
+         # please also refer Bio::Blast::Default::Report::Iteration.
          class Iteration < Default::Report::Iteration
+           # Creates a new Iteration object.
+           # It is designed to be called only internally from
+           # the Bio::Blast::WU::Report class.
+           # Users shall not use the method directly.
            def initialize(data)
              @f0stat = []
!             @f0dbstat = Default::Report::AlwaysNil.instance
              @f0hitlist = []
              @hits = []
***************
*** 183,186 ****
--- 228,232 ----
            end
  
+           # Returns warning messages.
            def warnings
              @f0warnings
***************
*** 188,191 ****
--- 234,238 ----
  
            private
+           # Parses hit list.
            def parse_hitlist
              unless defined?(@parse_hitlist)
***************
*** 232,236 ****
--- 279,292 ----
          end #class Iteration
  
+         # Bio::Blast::WU::Report::Hit contains information about a hit.
+         # It may contain some Bio::Blast::WU::Report::HSP objects.
+         #
+         # Because it inherits Bio::Blast::Default::Report::Hit,
+         # please also refer Bio::Blast::Default::Report::Hit.
          class Hit < Default::Report::Hit
+           # Creates a new Hit object.
+           # It is designed to be called only internally from the
+           # Bio::Blast::WU::Report::Iteration class.
+           # Users should not call the method directly.
            def initialize(data)
              @f0hitname = data.shift
***************
*** 250,266 ****
            end
  
            def score
              @score
            end
!           attr_reader :pvalue, :n_number
          end #class Hit
  
          class HSP < Default::Report::HSP
!           method_after_parse_score :pvalue, :p_sum_n
          end #class HSP
  
        end #class Report
  
        class Report_TBlast < Report
          DELIMITER = RS = "\nTBLAST"
        end #class Report_TBlast
--- 306,340 ----
            end
  
+           # Returns score.
            def score
              @score
            end
!           # p-value
!           attr_reader :pvalue
!           # n-number (???)
!           attr_reader :n_number
          end #class Hit
  
+         # Bio::Blast::WU::Report::HSP holds information about the hsp
+         # (high-scoring segment pair).
+         #
+         # Because it inherits Bio::Blast::Default::Report::HSP,
+         # please also refer Bio::Blast::Default::Report::HSP.
          class HSP < Default::Report::HSP
!           # p-value
!           attr_reader :pvalue if false #dummy
!           method_after_parse_score :pvalue
!           # p_sum_n (???)
!           attr_reader :p_sum_n if false #dummy
!           method_after_parse_score :p_sum_n
          end #class HSP
  
        end #class Report
  
+       # WU-BLAST default output parser for TBLAST.
+       # All methods are equal to Bio::Blast::WU::Report.
+       # Only DELIMITER (and RS) is different.
        class Report_TBlast < Report
+         # Delimter of each entry for TBLAST. Bio::FlatFile uses it.
          DELIMITER = RS = "\nTBLAST"
        end #class Report_TBlast
***************
*** 478,501 ****
  ######################################################################
  
- =begin
- 
- = Bio::Blast::WU::Report
- 
-     WU-BLAST default output parser.
-     It is still incomplete and may contain many bugs,
-     because I don't have WU-BLAST license.
-     It was tested under web-based WU-BLAST results and
-     obsolete version downloaded from ((<URL:http://blast.wustl.edu/>)).
- 
- = Bio::Blast::WU::Report_TBlast
- 
-     WU-BLAST default output parser for TBLAST.
-     All methods are equal to Bio::Blast::WU::Report.
-     Only DELIMITER (and RS) is different.
- 
- = References
- 
- * ((<URL:http://blast.wustl.edu/>))
- * ((<URL:http://www.ebi.ac.uk/blast2/>))
- 
- =end
--- 552,553 ----



More information about the bioruby-cvs mailing list