[BioRuby-cvs] bioruby/lib/bio/appl/psort report.rb,1.9,1.10

Mitsuteru C. Nakao nakao at pub.open-bio.org
Mon Oct 31 08:13:37 EST 2005


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

Modified Files:
	report.rb 
Log Message:
* Updated RDoc.


Index: report.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort/report.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** report.rb	9 Sep 2005 15:48:17 -0000	1.9
--- report.rb	31 Oct 2005 13:13:35 -0000	1.10
***************
*** 1,6 ****
  #
! # bio/appl/psort/report.rb - PSORT systems report classes
  #
! #   Copyright (C) 2003 Mitsuteru C. Nakao <n at bioruby.org>
  #
  #  This library is free software; you can redistribute it and/or
--- 1,13 ----
  #
! # = bio/appl/psort/report.rb - PSORT systems report classes
  #
! # Copyright::   Copyright (C) 2003 Mitsuteru C. Nakao <n at bioruby.org>
! # License::     LGPL
! #
! #  $Id$
! #
! # == A Report classes for PSORT Systems
! # 
! #--
  #
  #  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
  #
! # ++
  #
  
***************
*** 31,44 ****
      class PSORT1
  
        class Report
  
!         def self.parser(str)
!           self.default_parser(str)
          end
  
!         
!         def self.default_parser(str)
            rpt = self.new
!           rpt.raw = str
            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]
--- 38,56 ----
      class PSORT1
  
+       # = Bio::PSORT::PSORT1::Report
+       # Parser class for PSORT1 output report.
+       # 
+       # == Example
        class Report
  
!         # Returns aBio::PSORT::PSORT1::Report.
!         def self.parser(output_report)
!           self.default_parser(output_report)
          end
  
!         # Returns aBio::PSORT::PSORT1::Report.
!         def self.default_parser(output_report)
            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]
***************
*** 62,66 ****
          end
  
!         # new
          def initialize(entry_id = '', origin = '', title = '', sequence = '',
                         result_info = '', reasoning = {}, final_result = [])
--- 74,89 ----
          end
  
!         attr_accessor :entry_id
!         attr_accessor :origin
!         attr_accessor :title
!         attr_accessor :sequence
!         attr_accessor :result_info
!         attr_accessor :reasoning
!         attr_accessor :final_result
!         attr_accessor :raw
! 
! 
! 
!         # Constructs aBio::PSORT::PSORT1::Report object.
          def initialize(entry_id = '', origin = '', title = '', sequence = '',
                         result_info = '', reasoning = {}, final_result = [])
***************
*** 74,79 ****
            @raw = ''
          end
-         attr_accessor :entry_id, :origin, :title, :sequence, 
-           :result_info, :reasoning,:final_result, :raw
  
  
--- 97,100 ----
***************
*** 83,89 ****
  
  
!     # Bio::PSORT::PSORT2
      class PSORT2
  
        SclNames = { 
          'csk' => 'cytoskeletal',
--- 104,111 ----
  
  
! 
      class PSORT2
  
+       # Subcellular localization name codes used by PSORT2 
        SclNames = { 
          'csk' => 'cytoskeletal',
***************
*** 101,104 ****
--- 123,127 ----
        }
      
+       # Feature name codes
        Features = [
          'psg',  # PSG: PSG score
***************
*** 139,142 ****
--- 162,166 ----
        ]
        
+       # Feature name codes (long version).
        FeaturesLong = {
          'psg' => 'PSG',  
***************
*** 176,185 ****
        }
  
!       # Bio::PSORT::PSORT2::Report
        class Report
  
          BOUNDARY  = '-' * 75
          RS = DELIMITER = "\)\n\n#{BOUNDARY}"
  
          def initialize(raw = '', entry_id = nil, scl = nil, definition = nil, 
                         seq = nil, k = nil, features = {}, prob = {}, pred = nil)
--- 200,244 ----
        }
  
!       # = Bio::PSORT::PSORT2::Report
!       # Report parser classe for PSORT II(PSORT2).
!       # == Example
        class Report
  
+         # Report boundary string.
          BOUNDARY  = '-' * 75
+ 
+ 
+         # Report delimiter.
          RS = DELIMITER = "\)\n\n#{BOUNDARY}"
  
+         # entry_id of query sequence. 
+         attr_accessor :entry_id 
+ 
+         # Given subcellular localization (three letters code).
+         attr_accessor :scl
+ 
+         # Definition of query sequence.
+         attr_accessor :definition
+         
+         # Sequence of query sequence.
+         attr_accessor :seq
+ 
+         # k parameter of k-nearest neighbors classifier.
+         attr_accessor :k
+ 
+         # Feature vector used the kNN prediction.
+         attr_accessor :features
+ 
+         # Probability vector of kNN prediction.
+         attr_accessor :prob
+ 
+         # Predicted subcellular localization (three letters code).
+         attr_accessor :pred
+         
+         # Raw text of output report.
+         attr_accessor :raw
+ 
+ 
+         # Constructs aBio::PSORT::PSORT2::Report object.
          def initialize(raw = '', entry_id = nil, scl = nil, definition = nil, 
                         seq = nil, k = nil, features = {}, prob = {}, pred = nil)
***************
*** 194,202 ****
            @raw        = raw
          end
-         attr_accessor :entry_id, :scl, :definition, :seq, 
-           :k, :features, :prob, :pred, :raw
  
          
!         # report format to be auto detection
          def self.parser(str, entry_id)
            case str
--- 253,259 ----
            @raw        = raw
          end
  
          
!         # Parses output report with output format detection automatically.
          def self.parser(str, entry_id)
            case str
***************
*** 214,219 ****
          end
  
! 
!         # $id: too short length ($leng), skipped\n";
          def self.too_short_parser(ent, entry_id = nil)
            report = self.new(ent)
--- 271,277 ----
          end
  
!         # Parser for ``too short length'' report.
!         #
!         #  $id: too short length ($leng), skipped\n";
          def self.too_short_parser(ent, entry_id = nil)
            report = self.new(ent)
***************
*** 227,232 ****
  
  
!         # default report
!         # ``psort test.faa'' output
          def self.default_parser(ent, entry_id = nil)
            report = self.new(ent, entry_id)
--- 285,290 ----
  
  
!         # Parser for the default report format.
!         # ``psort report'' output.
          def self.default_parser(ent, entry_id = nil)
            report = self.new(ent, entry_id)
***************
*** 247,251 ****
          end
  
! 
          def set_header_line(str)
            str.sub!(/^-+\n/,'')
--- 305,309 ----
          end
  
!         # Returns header information.
          def set_header_line(str)
            str.sub!(/^-+\n/,'')
***************
*** 264,268 ****
          end
  
! 
          def self.set_kNN_prob(str)
            prob = Hash.new
--- 322,326 ----
          end
  
!         # Returns @prob value.
          def self.set_kNN_prob(str)
            prob = Hash.new
***************
*** 278,282 ****
          end
  
! 
          def set_prediction(str)
            case str
--- 336,340 ----
          end
  
!         # Returns @prob and @k values.
          def set_prediction(str)
            case str
***************
*** 292,297 ****
  
  
! 
!         # ``psort -v report'' and WWW server output
          def self.v_parser(ent, entry_id = nil)
            report = Bio::PSORT::PSORT2::Report.new(ent, entry_id)
--- 350,355 ----
  
  
!         # Parser for the verbose output report format.
!         # ``psort -v report'' and WWW server output.
          def self.v_parser(ent, entry_id = nil)
            report = Bio::PSORT::PSORT2::Report.new(ent, entry_id)
***************
*** 304,308 ****
                ent[i] = nil
              end
!             if /^none/ =~ e    # for psort output bug
                j = self.__send__(:search_j, i, ent)
                ent[i - j] += e
--- 362,366 ----
                ent[i] = nil
              end
!             if /^none/ =~ e    # psort output bug
                j = self.__send__(:search_j, i, ent)
                ent[i - j] += e
***************
*** 311,315 ****
            }
            ent.compact!
-           # ent.each_with_index {|e,i| p [i.to_s.ljust(2), e] }
  
            if /^ PSORT II server/ =~ ent[0] # for WWW version
--- 369,372 ----
***************
*** 334,337 ****
--- 391,395 ----
  
  
+         # 
          def self.search_j(i, ent)
            j = 1
***************
*** 347,359 ****
  
  
!         # divide entry body
!         def self.divent(ent)
!           boundary = ent.index(BOUNDARY)
            return ent[0..(boundary - 1)], ent[(boundary + 2)..ent.length]
          end
  
! 
!         def set_features(fary)
!           fary.each {|fent|
              key = fent.split(/\:( |\n)/)[0].strip
              self.features[key] = fent # unless /^\>/ =~ key
--- 405,417 ----
  
  
!         # Divides entry body
!         def self.divent(entry)
!           boundary = entry.index(BOUNDARY)
            return ent[0..(boundary - 1)], ent[(boundary + 2)..ent.length]
          end
  
!         # Sets @features values.
!         def set_features(features_ary)
!           features_ary.each {|fent|
              key = fent.split(/\:( |\n)/)[0].strip
              self.features[key] = fent # unless /^\>/ =~ key
***************
*** 414,479 ****
  
  end
- 
- 
- 
- 
- 
- =begin
- 
- = Bio::PSORT::PSORT1
- 
- = Bio::PSORT::PSORT1::Report
- 
- --- Bio::PSORT::PSORT1::Report.parser
- --- Bio::PSORT::PSORT1::Report#entry_id
- --- Bio::PSORT::PSORT1::Report#origin
- --- Bio::PSORT::PSORT1::Report#title
- --- Bio::PSORT::PSORT1::Report#sequence
- --- Bio::PSORT::PSORT1::Report#result_info
- --- Bio::PSORT::PSORT1::Report#reasoning
- --- Bio::PSORT::PSORT1::Report#final_result
- --- Bio::PSORT::PSORT1::Report#raw
- 
- 
- 
- 
- 
- = Bio::PSORT::PSORT2
- 
- --- Bio::PSORT::SclNames
- --- Bio::PSORT::Features
- --- Bio::PSORT::FeaturesLong
- 
- = Bio::PSORT::PSORT2::Report
- 
- Parsed results of the PSORT2 report for default, ``-v'' and WWW version 
- output format.
- 
- --- Bio::PSORT::PSORT2::Report.new
- --- Bio::PSORT::PSORT2::Report#entry_id
- 
-       
- --- Bio::PSORT::PSORT2::Report#scl
- --- Bio::PSORT::PSORT2::Report#definition
- --- Bio::PSORT::PSORT2::Report#seq
- --- Bio::PSORT::PSORT2::Report#features
- --- Bio::PSORT::PSORT2::Report#prob
- --- Bio::PSORT::PSORT2::Report#pred
- --- Bio::PSORT::PSORT2::Report#k
- --- Bio::PSORT::PSORT2::Report#raw
- 
- 
- --- Bio::PSORT::PSORT2::Report.parser(report)
- 
-       Returns a PSORT report object (Bio::PSORT::PSORT2::Report). 
-       Formats are auto detedted.
- 
- --- Bio::PSORT::PSORT2::Report::BOUNDARY
- 
-       Fields boundary in a PSORT report.
- 
- --- Bio::PSORT::PSORT2::Report::DELIMITER
- 
-       Entry boundary in PSORT reports.
- 
- =end
--- 472,473 ----



More information about the bioruby-cvs mailing list