[BioRuby-cvs] bioruby/lib/bio/io das.rb,1.13,1.14

Katayama Toshiaki k at dev.open-bio.org
Wed Mar 28 16:51:39 UTC 2007


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

Modified Files:
	das.rb 
Log Message:
* modified to use Bio::Command


Index: das.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/das.rb,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** das.rb	25 Jul 2006 19:46:43 -0000	1.13
--- das.rb	28 Mar 2007 16:51:37 -0000	1.14
***************
*** 2,6 ****
  # = bio/io/das.rb - BioDAS access module
  #
! # Copyright::	Copyright (C) 2003, 2004
  #		Shuichi Kawashima <shuichi at hgc.jp>,
  #		Toshiaki Katayama <k at bioruby.org>
--- 2,6 ----
  # = bio/io/das.rb - BioDAS access module
  #
! # Copyright::	Copyright (C) 2003, 2004, 2007
  #		Shuichi Kawashima <shuichi at hgc.jp>,
  #		Toshiaki Katayama <k at bioruby.org>
***************
*** 21,26 ****
  rescue LoadError
  end
! require 'uri'
! require 'net/http'
  require 'bio/sequence'
  
--- 21,25 ----
  rescue LoadError
  end
! require 'bio/command'
  require 'bio/sequence'
  
***************
*** 32,38 ****
    # Specify DAS server to connect
    def initialize(url = 'http://www.wormbase.org:80/db/')
!     schema, user, host, port, reg, path, = URI.split(url)
!     @server = Net::HTTP.new(host, port)
!     @prefix = path ? path.chomp('/') : ''
    end
  
--- 31,35 ----
    # Specify DAS server to connect
    def initialize(url = 'http://www.wormbase.org:80/db/')
!     @server = url.chomp('/')
    end
  
***************
*** 40,44 ****
    def get_dsn
      ary = []
!     result, = @server.get(@prefix + '/das/dsn')
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::DSN') do |e|
--- 37,41 ----
    def get_dsn
      ary = []
!     result, = Bio::Command.post_form("#{@server}/das/dsn")
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::DSN') do |e|
***************
*** 71,75 ****
        src = dsn
      end
!     result, = @server.get(@prefix + '/das/' + src + '/entry_points')
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::ENTRY_POINTS') do |e|
--- 68,72 ----
        src = dsn
      end
!     result, = Bio::Command.post_form("#{@server}/das/#{src}/entry_points")
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::ENTRY_POINTS') do |e|
***************
*** 80,84 ****
          segment.entry_id = e.attributes['id']
          segment.start = e.attributes['start']
!         segment.stop = e.attributes['stop']
          segment.orientation = e.attributes['orientation']
          segment.subparts = e.attributes['subparts']
--- 77,81 ----
          segment.entry_id = e.attributes['id']
          segment.start = e.attributes['start']
!         segment.stop = e.attributes['stop'] || e.attributes['size']
          segment.orientation = e.attributes['orientation']
          segment.subparts = e.attributes['subparts']
***************
*** 104,110 ****
        opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
      end
-     query = opts.join(';')
  
!     result, = @server.get(@prefix + '/das/' + dsn + '/dna?' + query)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::SEQUENCE') do |e|
--- 101,106 ----
        opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
      end
  
!     result, = Bio::Command.post_form("#{@server}/das/#{dsn}/dna", opts)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::SEQUENCE') do |e|
***************
*** 137,143 ****
        opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
      end
-     query = opts.join(';')
  
!     result, = @server.get(@prefix + '/das/' + dsn + '/sequence?' + query)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::SEQUENCE') do |e|
--- 133,138 ----
        opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
      end
  
!     result, = Bio::Command.post_form("#{@server}/das/#{dsn}/sequence", opts)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::SEQUENCE') do |e|
***************
*** 175,181 ****
        opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
      end
-     query = opts.join(';')
  
!     result, = @server.get(@prefix + '/das/' + dsn + '/types?' + query)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::GFF') do |e|
--- 170,175 ----
        opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}"
      end
  
!     result, = Bio::Command.post_form("#{@server}/das/#{dsn}/types", opts)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::GFF') do |e|
***************
*** 227,233 ****
        opts << "group_id=#{gid}"
      end
-     query = opts.join(';')
  
!     result, = @server.get(@prefix + '/das/' + dsn + '/features?' + query)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::GFF') do |e|
--- 221,226 ----
        opts << "group_id=#{gid}"
      end
  
!     result, = Bio::Command.post_form("#{@server}/das/#{dsn}/features", opts)
      doc = REXML::Document.new(result.body)
      doc.elements.each('/descendant::GFF') do |e|
***************
*** 446,450 ****
    org_list.each do |org|
      print "#{org} : "
!     list = kegg_das.get_entry_point(org)
      list.segments.each do |seg|
        print " #{seg.entry_id}"
--- 439,443 ----
    org_list.each do |org|
      print "#{org} : "
!     list = kegg_das.get_entry_points(org)
      list.segments.each do |seg|
        print " #{seg.entry_id}"




More information about the bioruby-cvs mailing list