[BioRuby-cvs] bioruby/lib/bio/appl/sosui report.rb,1.7,1.8

Mitsuteru C. Nakao nakao at pub.open-bio.org
Mon Oct 31 12:01:53 EST 2005


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

Modified Files:
	report.rb 
Log Message:
* Added Bio::SOSUI::Report::TMH class to contain the information about TM lines.
* Update RDoc.


Index: report.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sosui/report.rb,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** report.rb	31 Oct 2005 16:31:29 -0000	1.7
--- report.rb	31 Oct 2005 17:01:50 -0000	1.8
***************
*** 1,6 ****
  #
! # bio/appl/sosui/report.rb - SOSUI report class
  # 
! #   Copyright (C) 2003 Mitsuteru C. Nakao <n at bioruby.org>
  #
  #  This library is free software; you can redistribute it and/or
--- 1,15 ----
  #
! # = bio/appl/sosui/report.rb - SOSUI report class
  # 
! # Copyright::   Copyright (C) 2003 Mitsuteru C. Nakao <n at bioruby.org>
! # Licence::     LGPL
! #
! #  $Id$
! #
! # == Example
! #
! # == References
! # * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html
! #--
  #
  #  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$
  #
  
--- 27,31 ----
  #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  #
! #++
  #
  
***************
*** 26,62 ****
    class SOSUI
  
      class Report
  
!       RS = DELIMITER = "\n>"
  
!       def initialize(entry)
!         entry       = entry.split(/\n/)
  
          @entry_id   = entry[0].strip.sub(/^>/,'')
          @prediction = entry[1].strip
!         @tmh        = []
!         @tmhs       = 0
          parse_tmh(entry) if /MEMBRANE/ =~ @prediction
        end
  
-       attr_reader :entry_id, :prediction, :tmhs, :tmh
- 
- 
        private
  
        def parse_tmh(entry)
          entry.each do |line|
            if /NUMBER OF TM HELIX = (\d+)/ =~ line
!             @tmhs = $1
            elsif /TM (\d+) +(\d+)- *(\d+) (\w+) +(\w+)/ =~ line
!             tmp = {'TMH'   => $1.to_i, 
!                    'range' => Range.new($2.to_i, $3.to_i), 
!                    'grade' => $4, 
!                    'seq'   => $5 }
!             @tmh.push(tmp)
            end
          end
        end
  
      end # class Report
  
--- 35,110 ----
    class SOSUI
  
+     # = SOSUI output report parsing class
+     #
+     # == References
+     # * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html
      class Report
  
!       # Delimiter
!       DELIMITER = "\n>"
!       RS = DELIMITER
  
!       # Query entry_id
!       attr_reader :entry_id
! 
!       # Returns the prediction result whether "MEMBRANE PROTEIN" or 
!       # "SOLUBLE PROTEIN".
!       attr_reader :prediction
! 
!       # Transmembrane helixes ary
!       attr_reader :tmhs
! 
!       # Parser for SOSUI output report.
!       def initialize(output_report)
!         entry       = output_report.split(/\n/)
  
          @entry_id   = entry[0].strip.sub(/^>/,'')
          @prediction = entry[1].strip
!         @tms        = 0
!         @tmhs       = []
          parse_tmh(entry) if /MEMBRANE/ =~ @prediction
        end
  
        private
  
+       # Parser for TMH lines.
        def parse_tmh(entry)
          entry.each do |line|
            if /NUMBER OF TM HELIX = (\d+)/ =~ line
!             @tms = $1
            elsif /TM (\d+) +(\d+)- *(\d+) (\w+) +(\w+)/ =~ line
!             tmh  = $1.to_i
!             range = Range.new($2.to_i, $3.to_i)
!             grade = $4
!             seq   = $5
!             @tmhs.push(TMH.new(range, grade, seq))
            end
          end
        end
  
+ 
+       # = Bio::SOSUI::Report::TMH
+       # Container class for transmembrane helix information.
+       #  
+       #  TM 1   31-  53 SECONDARY   HIRMTFLRKVYSILSLQVLLTTV
+       class TMH
+ 
+         # Returns aRng of transmembrane helix
+         attr_reader :range
+         
+         # Retruns ``PRIMARY'' or ``SECONDARY'' of helix.
+         attr_reader :grade
+ 
+         # Returns the sequence. of transmembrane helix. 
+         attr_reader :sequence
+ 
+         # Sets values.
+         def initialize(range, grade, sequence)
+           @range = range
+           @grade = grade
+           @sequence = sequence
+         end
+       end
+ 
      end # class Report
  
***************
*** 99,104 ****
      p [:entry_id, sosui.entry_id]
      p [:prediction, sosui.prediction]
!     p [:tmhs, sosui.tmhs]
!     pp [:tmh, sosui.tmh]
    end
  
--- 147,152 ----
      p [:entry_id, sosui.entry_id]
      p [:prediction, sosui.prediction]
!     p [:tmhs.size, sosui.tmhs]
!     pp [:tmhs, sosui.tmh]
    end
  
***************
*** 117,145 ****
  
  
- =begin
- 
- = Bio::SOSUI
- 
-     SOSUI class for
-     ((<URL:http://sosui.proteome.bio.tuat.ac.jp/sosuiframe0.html>))
- 
- = Bio::SOSUI::Report
- 
-     A parser and contianer class
- 
- --- Bio::SOSUI::Report.new(str)
- --- Bio::SOSUI::Report#entry_id
- --- Bio::SOSUI::Report#prediction
- 
-       Returns the prediction result whether "MEMBRANE PROTEIN" or 
-       "SOLUBLE PROTEIN".
- 
- --- Bio::SOSUI::Report#tmhs
- 
-       Returns the number of predicted TMHs.
-     
- --- Bio::SOSUI::Report#tmh
- 
-       Returns an Array of TMHs in Hash.
- 
- =end
--- 165,166 ----



More information about the bioruby-cvs mailing list