[BioRuby-cvs] bioruby/lib/bio/appl psort.rb,1.6,1.7
Mitsuteru C. Nakao
nakao at pub.open-bio.org
Mon Oct 31 05:27:00 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio/appl
In directory pub.open-bio.org:/tmp/cvs-serv31985/lib/bio/appl
Modified Files:
psort.rb
Log Message:
* Updated rdoc.
Index: psort.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** psort.rb 9 Sep 2005 15:48:17 -0000 1.6
--- psort.rb 31 Oct 2005 10:26:58 -0000 1.7
***************
*** 1,6 ****
#
! # bio/appl/psort.rb - PSORT, protein sorting site prediction systems
#
! # Copyright (C) 2003 Mitsuteru C. Nakao <n at bioruby.org>
#
# This library is free software; you can redistribute it and/or
--- 1,29 ----
#
! # = bio/appl/psort.rb - PSORT, protein sorting site prediction systems
#
! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao <n at bioruby.org>
! # License:: LGPL
! #
! #
! # $Id$
! #
! # == A client for PSORT WWW Server
! #
! # A client for PSORT WWW Server for predicting protein subcellular
! # localization.
! #
! # PSORT family members,
! # 1. PSORT
! # 2. PSORT II
! # 3. iPSORT
! # 4. PSORT-B http://psort.org
! # 5. WoLF-PSORT
! #
! # See http://psort.ims.u-tokyo.ac.jp.
! #
! # === Example
! #
! #
! #--
#
# 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$
#
-
-
require 'bio/sequence'
require 'bio/db/fasta'
--- 41,47 ----
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
! #++
#
require 'bio/sequence'
require 'bio/db/fasta'
***************
*** 31,36 ****
module Bio
! class PSORT
WWWServer = {
'IMSUT' => {'host' => 'psort.hgc.jp', #'psort.ims.u-tokyo.ac.jp',
--- 52,65 ----
module Bio
!
+
+ class PSORT
+ # a Hash for PSORT official hosts:
+ # Key value (host)
+ # ------- -----------------------
+ # IMSUT psort.ims.u-tokyo.ac.jp
+ # Okazaki psort.nibb.ac.jp
+ # Peking srs.pku.edu.cn:8088
WWWServer = {
'IMSUT' => {'host' => 'psort.hgc.jp', #'psort.ims.u-tokyo.ac.jp',
***************
*** 46,54 ****
! # Command-line client super class
!
! # HTTP client super class
! # inherited claaes should have make_form_args and parse_html method.
class CGIDriver
def initialize(host = '', path = '')
@host = host
--- 75,108 ----
! # = Generic CGI client class
! # A generic CGI client class for Bio::PSORT::* classes.
! # The class provides an interface for CGI argument processing and output
! # report parsing.
! #
! # == Example
! #
! # class NewClient < CGIDriver
! # def initialize(host, path)
! # super(host, path)
! # end
! # end
! # private
! # def make_args(query)
! # # ...
! # end
! # def parse_report(output)
! # # ...
! # end
! #
class CGIDriver
+
+ # CGI query argument in Hash ({key => value, ...}).
+ attr_accessor :args
+
+ # CGI output raw text
+ attr_reader :report
+
+
+ # Sets remote ``host'' and cgi ``path''.
def initialize(host = '', path = '')
@host = host
***************
*** 57,65 ****
@report
end
- attr_accessor :args
- attr_reader :report
! # CGIDriver#exec(query) -> aReport
def exec(query)
data = make_args(query)
--- 111,117 ----
@report
end
! # Executes a CGI ``query'' and returns aReport
def exec(query)
data = make_args(query)
***************
*** 74,94 ****
end
-
private
def make_args(args_hash)
# The routin should be provided in the inherited class
end
def parse_report(result_body)
# The routin should be provided in the inherited class
end
! # tools
!
def erase_html_tags(str)
return str.gsub(/<\S.*?>/,'')
end
def args_join(hash, delim = '&')
tmp = []
--- 126,147 ----
end
private
+ # Bio::CGIDriver#make_args. An API skelton.
def make_args(args_hash)
# The routin should be provided in the inherited class
end
+ # 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
+ # Returns CGI argument text in String (key=value&) from a Hash ({key=>value}).
def args_join(hash, delim = '&')
tmp = []
***************
*** 103,111 ****
!
class PSORT1
autoload :Report, 'bio/appl/psort/report'
def self.imsut
self.new(Remote.new(WWWServer['IMSUT']['host'],
--- 156,181 ----
! # = Bio::PSORT::PSORT1
! # Bio::PSORT::PSORT1 is a wapper class for the original PSORT program.
! #
! # == Example
! #
! # serv = Bio::PSORT::PSORT1.imsut
! # serv.title = 'Query_title_splited_by_white space'
! # serv.exec(seq, false) # seq.class => String
! # serv.exec(seq)
! # report = serv.exec(Bio::FastaFormat.new(seq))
! # report_raw = serv.exec(Bio::FastaFormat.new(seq), false)
! #
! # == References
! # 1. Nakai, K. and Kanehisa, M., A knowledge base for predicting protein
! # localization sites in eukaryotic cells, Genomics 14, 897-911 (1992).
! # [PMID:1478671]
class PSORT1
autoload :Report, 'bio/appl/psort/report'
+ # Returns a PSORT1 CGI Driver object (Bio::PSORT::PSORT1::Remote)
+ # connecting to the IMSUT server.
def self.imsut
self.new(Remote.new(WWWServer['IMSUT']['host'],
***************
*** 113,116 ****
--- 183,189 ----
end
+
+ # Returns a PSORT1 CGI Driver object (Bio::PSORT::PSORT1::Remote)
+ # connecting to the NIBB server.
def self.okazaki
self.new(Remote.new(WWWServer['Okazaki']['host'],
***************
*** 118,121 ****
--- 191,197 ----
end
+
+ # Returns a PSORT1 CGI Driver object (Bio::PSORT::PSORT1::Remote)
+ # connecting to the Peking server.
def self.peking
self.new(Remote.new(WWWServer['Peking']['host'],
***************
*** 123,137 ****
end
! #
! def initialize(serv)
! @serv = serv
! @origin = 'yeast' # Gram-positive bacterium, Gram-negative bacterium,
# yeast, aminal, plant
@title = 'MYSEQ'
@sequence = ''
end
- attr_accessor :origin, :sequence, :title
! #
def exec(faa, parsing = true)
if faa.class == Bio::FastaFormat
--- 199,238 ----
end
!
! # Sets a server CGI Driver (Bio::PSORT::PSORT1::Remote).
! def initialize(driver, origin = 'yeast')
! @serv = driver
! @origin = origin # Gram-positive bacterium, Gram-negative bacterium,
# yeast, aminal, plant
@title = 'MYSEQ'
@sequence = ''
end
!
! # An accessor of the origin argument. Default setting is "yeast".
! # Usable values:
! # 1. Gram-positive bacterium
! # 2. Gram-negative bacterium
! # 3. yeast
! # 4. animal
! # 5. plant
! attr_accessor :origin
!
! # An accessor of the query sequence argument.
! attr_accessor :sequence
!
! # An accessor of the title argument. Default setting is 'MYSEQ'.
! # The value is automatically setted if you use a query in
! # Bio::FastaFormat.
! attr_accessor :title
!
!
! # Executes the query (faa) and returns an Bio::PSORT::PSORT1::Report.
! #
! # The ``faa'' argument is acceptable a sequence both in String and in
! # Bio::FastaFormat.
! #
! # If you set the second argument is ``parsing = false'',
! # returns ourput text without any parsing.
def exec(faa, parsing = true)
if faa.class == Bio::FastaFormat
***************
*** 147,166 ****
! # PSORT1 specific CGIDriver
class Remote < CGIDriver
def initialize(host, path)
! @origin = 'yeast' # Gram-positive bacterium,
! # Gram-negative bacterium,
! # yeast, aminal, plant
@title = 'MYSEQ'
@parsing = true
super(host, path)
end
- attr_accessor :origin, :title, :parsing
-
private
def make_args(query)
@args.update({'sequence' => query})
--- 248,282 ----
! # = Bio::PSORT::PSORT1::Remote
! # PSORT1 specific CGIDriver.
class Remote < CGIDriver
+ # Accessor for Bio::PSORT::PSORT1::Remote#origin to contein target domain.
+ # Taget domains:
+ # 1. Gram-positive bacterium
+ # 2. Gram-negative bacterium
+ # 3. yeast
+ # 4. animal
+ # 5. plant
+ attr_accessor :origin
+
+ # Accessor for Bio::POSRT::PSORT1#sequence to contein the query sequence.
+ attr_accessor :title
+
+ # Accessor for Bio::PSORT::PSORT1#title to contain the query title.
+ attr_accessor :parsing
+
+ # Sets remote ``host'' and cgi ``path''.
def initialize(host, path)
! @origin = 'yeast'
@title = 'MYSEQ'
@parsing = true
super(host, path)
end
private
+ # Returns parsed CGI argument.
+ # An API implementation.
def make_args(query)
@args.update({'sequence' => query})
***************
*** 168,171 ****
--- 284,290 ----
end
+
+ # Returns parsed output report.
+ # An API implementation.
def parse_report(str)
str = erase_html_tags(str)
***************
*** 179,198 ****
!
! # Nakai and Horton 1999 TiBS
class PSORT2
autoload :Report, 'bio/appl/psort/report'
! # remote
def self.remote(host, path)
self.new(Remote.new(host, path))
end
def self.imsut
self.remote(WWWServer['IMSUT']['host'],
WWWServer['IMSUT']['PSORT2'])
end
!
def self.okazaki
self.remote(WWWServer['Okazaki']['host'],
--- 298,343 ----
! # = Bio::PSORT::PSORT2
! # Bio::PSORT::PSORT2 is a wapper class for the original PSORT program.
! #
! # == Example
! #
! # serv = Bio::PSORT::PSORT2.imsut
! # serv.title = 'Query_title_splited_by_white space'
! # serv.exec(seq, false) # seq.class => String
! # serv.exec(seq)
! # report = serv.exec(Bio::FastaFormat.new(seq))
! # report_raw = serv.exec(Bio::FastaFormat.new(seq), false)
! #
! # == References
! # 1. Nakai, K. and Horton, P., PSORT: a program for detecting the sorting
! # signals of proteins and predicting their subcellular localization,
! # Trends Biochem. Sci, 24(1) 34-35 (1999).
! # [PMID:10087920]
class PSORT2
autoload :Report, 'bio/appl/psort/report'
! # Returns a PSORT2 CGI Driver object (Bio::PSORT::PSORT2::Remote).
! #
! # PSORT official hosts:
! # key host path
! # ------- ----------------------- -------------------- ---------
! # IMSUT psort.ims.u-tokyo.ac.jp /cgi-bin/runpsort.pl (default)
! # Okazaki psort.nibb.ac.jp /cgi-bin/runpsort.pl
! # Peking srs.pku.edu.cn:8088 /cgi-bin/runpsort.pl
def self.remote(host, path)
self.new(Remote.new(host, path))
end
+ # Returns a PSORT2 CGI Driver object (Bio::PSORT::PSORT2::Remote)
+ # connecting to the IMSUT server.
def self.imsut
self.remote(WWWServer['IMSUT']['host'],
WWWServer['IMSUT']['PSORT2'])
end
!
! # Returns a PSORT2 CGI Driver object (Bio::PSORT::PSORT2::Remote)
! # connecting to the NIBB server.
def self.okazaki
self.remote(WWWServer['Okazaki']['host'],
***************
*** 200,203 ****
--- 345,350 ----
end
+ # Returns a PSORT2 CGI Driver object (Bio::PSORT::PSORT2::Remote)
+ # connecting to the Peking server.
def self.peking
self.remote(WWWServer['Peking']['host'],
***************
*** 205,216 ****
end
! # wrapper for ``psort'' command
! def initialize(serv, origin = 'yeast')
! @serv = serv
@origin = origin
! @title = nil
end
- attr_accessor :origin, :title
def exec(faa, parsing = true)
if faa.class == Bio::FastaFormat
--- 352,375 ----
end
! # An accessor of the origin argument.
! # Default setting is ``yeast''.
! attr_accessor :origin
!
! # An accessor of the title argument. Default setting is ``QUERY''.
! # The value is automatically setted if you use a query in
! # Bio::FastaFormat.
! attr_accessor :title
!
! # Sets a server CGI Driver (Bio::PSORT::PSORT2::Remote).
! def initialize(driver, origin = 'yeast')
! @serv = driver
@origin = origin
! @title = ''
end
+
+ # Executes PSORT II prediction and returns Report object
+ # (Bio::PSORT::PSORT2::Report) if parsing = true.
+ # Returns PSORT II report in text if parsing = false.
def exec(faa, parsing = true)
if faa.class == Bio::FastaFormat
***************
*** 226,231 ****
--- 385,393 ----
+ # = Bio::PSORT::PSORT2::Remote
# PSORT2 specific CGIDriver
class Remote < CGIDriver
+
+ # Sets remote ``host'' and cgi ``path''.
def initialize(host, path)
@origin = 'yeast'
***************
*** 233,241 ****
@parsing = true
end
! attr_accessor :origin, :parsing
private
!
def make_args(query)
@args.update({'sequence' => query})
--- 395,412 ----
@parsing = true
end
!
! # An accessor of the origin argument.
! # Default setting is ``yeast''.
! attr_accessor :origin
!
! # An accessor of the output parsing.
! # Default setting is ``true''.
! attr_accessor :parsing
private
!
! # Returns parsed CGI argument.
! # An API implementation.
def make_args(query)
@args.update({'sequence' => query})
***************
*** 243,246 ****
--- 414,420 ----
end
+
+ # Returns parsed output report.
+ # An API implementation.
def parse_report(str)
str = str.gsub(/\n<hr>/i, Report::BOUNDARY)
***************
*** 262,265 ****
--- 436,442 ----
end # class PSORTB
+ class WoLF_PSORT
+ end # class PSORTB
+
end # class PSORT
***************
*** 296,300 ****
"
-
puts "\n Bio::PSORT::PSORT"
--- 473,476 ----
***************
*** 377,505 ****
p eval("report.#{method}")
end
-
end
-
-
-
-
-
- =begin
-
- = Bio::PSORT
-
- Wrapper classes of PSORT family for predicting protein subcellular
- localization.
- ((<URL:http://psort.ims.u-tokyo.ac.jp>))
-
- PSORT family contains,
- (1) PSORT
- (2) PSORT II
- (3) iPSORT
- (4) PSORT-B ((<URL:http://psort.org>))
-
-
-
- --- Bio::PSORT::WWWServer
-
- Constants for PSORT official hosts:
-
- Key value (host)
- ------- -----------------------
- IMSUT psort.ims.u-tokyo.ac.jp
- Okazaki psort.nibb.ac.jp
- Peking srs.pku.edu.cn:8088
-
-
-
- = Bio::PSORT::PSORT1
-
- Bio::PSORT::PSORT1 is a wapper class for original PSORT program.
-
-
- --- Bio::PSORT::PSORT1.remote(host, path)
-
- Returns a PSORT1 CGI Driver object (Bio::PSORT::PSORT1::Remote).
-
- --- Bio::PSORT::PSORT1.imsut
-
- Returns a PSORT1 CGI Driver object (Bio::PSORT::PSORT1::Remote)
- to the IMSUT server.
-
- --- Bio::PSORT::PSORT1.okazaki
-
- Returns a PSORT1 CGI Driver object (Bio::PSORT::PSORT1::Remote)
- to the NIBB server.
-
- --- Bio::PSORT::PSORT1.peking
-
- Returns a PSORT1 CGI Driver object (Bio::PSORT::PSORT1::Remote)
- to the Peking server.
-
-
- --- Bio::PSORT::PSORT1#origin
-
- An accessor of the origin argument. Default setting is "yeast".
- Usable values:
- -----------------------
- Gram-positive bacterium
- Gram-nebative bacterium
- yeast
- animal
- plant
-
-
- --- Bio::PSORT::PSORT1#title
-
- An accessor of the title argument. Default setting is 'MYSEQ'.
- The value is automatically setted if you use a query in
- Bio::FastaFormat.
-
- --- Bio::PSORT::PSORT1#exec(faa, parsing = true) -> aRpt
-
- Execute a query.
- Returns a PSORT1::Report instance if parsing = true.
- Returns a PSORT1 report in text format if parsing = false.
-
-
-
-
-
- = Bio::PSORT::PSORT2
-
- --- Bio::PSORT::PSORT2.remote(host, path)
-
- Returns a PSORT2 CGI Driver object (Bio::PSORT::PSORT2::Remote).
-
- PSORT official hosts:
- key host path
- ------- ----------------------- -------------------- ---------
- IMSUT psort.ims.u-tokyo.ac.jp /cgi-bin/runpsort.pl (default)
- Okazaki psort.nibb.ac.jp /cgi-bin/runpsort.pl
- Peking srs.pku.edu.cn:8088 /cgi-bin/runpsort.pl
-
- --- Bio::PSORT::PSORT2.imsut
- --- Bio::PSORT::PSORT2.okazaki
- --- Bio::PSORT::PSORT2.peking
-
-
- --- Bio::PSORT::PSORT2#origin
-
- Accessor of the origin argument.
- Default setting is 'yeast'.
-
- --- Bio::PSORT::PSORT2#title
-
- Accessor of the title argument. Default setting is 'QUERY'.
- The value is automatically setted if you use a query in
- Bio::FastaFormat.
-
- --- Bio::PSORT::PSORT2#exec(faa, parsing = true)
-
- Executes PSORT II prediction and returns Report object
- (Bio::PSORT::PSORT2::Report) if parsing = true.
- Returns PSORT II report in text if parsing = false.
-
-
- =end
-
-
--- 553,555 ----
More information about the bioruby-cvs
mailing list