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

Mitsuteru C. Nakao nakao at dev.open-bio.org
Sun Apr 30 07:13:41 UTC 2006


Update of /home/repository/bioruby/bioruby/lib/bio/appl
In directory dev.open-bio.org:/tmp/cvs-serv18750/lib/bio/appl

Modified Files:
	psort.rb 
Log Message:
* changed license to Ruby's 


Index: psort.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort.rb,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** psort.rb	1 Nov 2005 05:15:15 -0000	1.8
--- psort.rb	30 Apr 2006 07:13:39 -0000	1.9
***************
*** 1,8 ****
  #
  # = bio/appl/psort.rb - PSORT, protein sorting site prediction systems
  #
! # Copyright::   Copyright (C) 2003 Mitsuteru C. Nakao <n at bioruby.org>
! # License::     LGPL
! #
  #
  # $Id$
--- 1,10 ----
+ module Bio
+ 
  #
  # = bio/appl/psort.rb - PSORT, protein sorting site prediction systems
  #
! # Copyright::   Copyright (C) 2003-2006
! #               Mitsuteru C. Nakao <n at bioruby.org>
! # License::     Ruby's
  #
  # $Id$
***************
*** 25,59 ****
  #
  #
- #--
- #
- #  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/sequence'
  require 'bio/db/fasta'
- require 'net/http'
  require 'cgi'
  
  
! module Bio
! 
!   
! 
! 
    class PSORT
      # a Hash for PSORT official hosts:
      #   Key      value (host)
--- 27,40 ----
  #
  #
  
  require 'bio/sequence'
+ require 'bio/command'
  require 'bio/db/fasta'
  require 'cgi'
  
  
!   #
    class PSORT
+ 
      # a Hash for PSORT official hosts:
      #   Key      value (host)
***************
*** 62,78 ****
      #   Okazaki  psort.nibb.ac.jp        
      #   Peking   srs.pku.edu.cn:8088     
!     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'}
      }
  
- 
      # = Generic CGI client class
      # A generic CGI client class for Bio::PSORT::* classes.
--- 43,58 ----
      #   Okazaki  psort.nibb.ac.jp        
      #   Peking   srs.pku.edu.cn:8088     
!     ServerURI = {
!       :IMSUT   => {
!         :PSORT1 => URI.parse("http://psort.hgc.jp/cgi-bin/okumura.pl"),
!         :PSORT2 => URI.parse("http://psort.hgc.jp/cgi-bin/runpsort.pl") },
!       :Okazaki => {
!         :PSORT1 => URI.parse("http://psort.nibb.ac.jp/cgi-bin/okumura.pl"),
!         :PSORT2 => URI.parse("http://psort.nibb.ac.jp/cgi-bin/runpsort.pl") },
!       :Peking  => {
!         :PSORT1 => URI.parse("http:///src.pku.edu.cn:8088/cgi-bin/okumura.pl"),
!         :PSORT2 => URI.parse("http://src.pku.edu.cn:8088/cgi-bin/runpsort.pl") },
      }
  
      # = Generic CGI client class
      # A generic CGI client class for Bio::PSORT::* classes.
***************
*** 104,113 ****
  
  
!       # Sets remote ``host'' and cgi ``path''.
!       def initialize(host = '', path = '') 
!         @host = host
!         @path = path
          @args = {}
!         @report
        end
  
--- 84,107 ----
  
  
!       # Sets remote host name and cgi path or uri.
!       #
!       # == Examples
!       #
!       #   CGIDriver.new("localhost", "/cgi-bin/psort_www.pl")
!       #
!       #   CGIDriver.new("http://localhost/cgi-bin/psort_www.pl")
!       #
!       #   CGIDriver.new(URI.parse("http://localhost/cgi-bin/psort_www.pl"))
!       #
!       def initialize(host = '', path = '')
!         case host.to_s
!         when /^http:/
!           uri = host.to_s
!         else
!           uri = 'http://' + host + '/' + path
!         end
!         @uri = URI.parse(uri)
          @args = {}
!         @report = ''
        end
  
***************
*** 118,122 ****
  
          begin
!           result, = Net::HTTP.new(@host).post(@path, data)
            @report = result.body
            output = parse_report(@report)
--- 112,119 ----
  
          begin
!           result = nil
!           Bio::Command::NetTools.net_http_start(@uri.host) {|http|
!             result, = http.post(@uri.path, data)
!           }
            @report = result.body
            output = parse_report(@report)
***************
*** 140,144 ****
        # Erases HTML tags
        def erase_html_tags(str)
!         return str.gsub(/<\S.*?>/,'')
        end
  
--- 137,141 ----
        # Erases HTML tags
        def erase_html_tags(str)
!         return str.gsub(/<\S.*?>/, '')
        end
  
***************
*** 149,153 ****
            tmp << CGI.escape(key.to_s) + '=' + CGI.escape(val.to_s)
          end
!         return tmp.join(delim)  # not ';' but '&' in psort's cgi
        end
  
--- 146,150 ----
            tmp << CGI.escape(key.to_s) + '=' + CGI.escape(val.to_s)
          end
!         return tmp.join(delim)  # not ';' but '&' in the psort cgi script.
        end
  
***************
*** 157,160 ****
--- 154,158 ----
  
      # = Bio::PSORT::PSORT1
+     #
      # Bio::PSORT::PSORT1 is a wapper class for the original PSORT program.
      #
***************
*** 169,175 ****
--- 167,175 ----
      # 
      # == 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
  
***************
*** 179,184 ****
        # connecting to the IMSUT server.
        def self.imsut
!         self.new(Remote.new(WWWServer['IMSUT']['host'],
!                             WWWServer['IMSUT']['PSORT1']))
        end
  
--- 179,183 ----
        # connecting to the IMSUT server.
        def self.imsut
!         self.new(Remote.new(ServerURI[:IMSUT][:PSORT1]))
        end
  
***************
*** 187,192 ****
        # connecting to the NIBB server.
        def self.okazaki
!         self.new(Remote.new(WWWServer['Okazaki']['host'],
!                             WWWServer['Okazaki']['PSORT1']))
        end
        
--- 186,190 ----
        # connecting to the NIBB server.
        def self.okazaki
!         self.new(Remote.new(ServerURI[:Okazaki][:PSORT1]))
        end
        
***************
*** 195,209 ****
        # connecting to the Peking server.
        def self.peking
!         self.new(Remote.new(WWWServer['Peking']['host'],
!                             WWWServer['Peking']['PSORT1']))
        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
--- 193,207 ----
        # connecting to the Peking server.
        def self.peking
!         self.new(Remote.new(ServerURI[:Peking][:PSORT1]))
        end
  
  
!       # Sets a cgi client (Bio::PSORT::PSORT1::Remote).
!       #
!       def initialize(driver, origin = 'yeast', title = 'MYSEQ')
!         @serv = driver
!         @origin = origin  # Gram-positive bacterium, Gram-negative bacterium,
!                           # yeast, aminal, plant
!         @title = title
          @sequence = ''
        end
***************
*** 237,243 ****
        def exec(faa, parsing = true)
          if faa.class == Bio::FastaFormat
!           @title        = faa.entry_id if @title == 'MYSEQ'
!           @sequence     = faa.seq
!           @serv.args    = {'title' => @title, 'origin' => @origin}
            @serv.parsing = parsing
            return @serv.exec(sequence)
--- 235,241 ----
        def exec(faa, parsing = true)
          if faa.class == Bio::FastaFormat
!           @title = faa.entry_id if @title == 'MYSEQ'
!           @sequence = faa.seq
!           @serv.args = {'title' => @title, 'origin' => @origin}
            @serv.parsing = parsing
            return @serv.exec(sequence)
***************
*** 268,274 ****
          
          # Sets remote ``host'' and cgi ``path''.
!         def initialize(host, path)
!           @origin  = 'yeast'
!           @title   = 'MYSEQ'
            @parsing = true
            super(host, path)
--- 266,272 ----
          
          # Sets remote ``host'' and cgi ``path''.
!         def initialize(host, path = nil, title = 'MYSEQ', origin = 'yeast')
!           @title   = title
!           @origin  = origin
            @parsing = true
            super(host, path)
***************
*** 327,331 ****
        #  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
--- 325,329 ----
        #  Okazaki  psort.nibb.ac.jp         /cgi-bin/runpsort.pl
        #  Peking   srs.pku.edu.cn:8088      /cgi-bin/runpsort.pl
!       def self.remote(host, path = nil)
          self.new(Remote.new(host, path))
        end
***************
*** 334,339 ****
        # connecting to the IMSUT server.
        def self.imsut
!         self.remote(WWWServer['IMSUT']['host'],
!                     WWWServer['IMSUT']['PSORT2'])
        end
  
--- 332,336 ----
        # connecting to the IMSUT server.
        def self.imsut
!         self.remote(ServerURI[:IMSUT][:PSORT2])
        end
  
***************
*** 341,346 ****
        # connecting to the NIBB server.
        def self.okazaki
!         self.remote(WWWServer['Okazaki']['host'],
!                     WWWServer['Okazaki']['PSORT2'])
        end
  
--- 338,342 ----
        # connecting to the NIBB server.
        def self.okazaki
!         self.remote(ServerURI[:Okazaki][:PSORT2])
        end
  
***************
*** 348,353 ****
        # connecting to the Peking server.
        def self.peking
!         self.remote(WWWServer['Peking']['host'],
!                     WWWServer['Peking']['PSORT2'])
        end
  
--- 344,348 ----
        # connecting to the Peking server.
        def self.peking
!         self.remote(ServerURI[:Peking][:PSORT2])
        end
  
***************
*** 374,380 ****
        def exec(faa, parsing = true)
          if faa.class == Bio::FastaFormat
!           @title        = faa.entry_id if @title == nil
!           @sequence     = faa.seq
!           @serv.args    = {'origin' => @origin, 'title' => @title}
            @serv.parsing = parsing
            return @serv.exec(@sequence)
--- 369,375 ----
        def exec(faa, parsing = true)
          if faa.class == Bio::FastaFormat
!           @title = faa.entry_id if @title == nil
!           @sequence = faa.seq
!           @serv.args = {'origin' => @origin, 'title' => @title}
            @serv.parsing = parsing
            return @serv.exec(@sequence)




More information about the bioruby-cvs mailing list