Class: Bio::Hinv::KeywordSearch

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/bio/io/hinv.rb

Overview

serv = Bio::Hinv::KeywordSearch.new serv.query(“query” => “HIT00002218*”, “start” => 1, “end” => 100) puts serv.result puts serv.size puts serv.start puts serv.end

Direct Known Subclasses

IdSearch

Instance Method Summary (collapse)

Constructor Details

- (KeywordSearch) initialize

Returns a new instance of KeywordSearch



371
372
373
# File 'lib/bio/io/hinv.rb', line 371

def initialize
  @url = BASE_URI + "keyword_search.php"
end

Instance Method Details

- (Object) end



413
414
415
# File 'lib/bio/io/hinv.rb', line 413

def end
  @xml.elements['//END'].text.to_i
end

- (Object) query(hash = {})



375
376
377
378
379
380
381
382
# File 'lib/bio/io/hinv.rb', line 375

def query(hash = {})
  default = {
    "start" => 1,
    "end" => 100
  }
  options = default.update(hash)
  super(options)
end

- (Object) result

<?xml version='1.0' encoding='UTF-8'?> <HINVDB_SEARCH>

<QUERY>HIT00002218*</QUERY>
<SIZE>8</SIZE>
<START>1</START>
<END>8</END>
<H-INVITATIONAL-ID>HIT000022180</H-INVITATIONAL-ID>
<H-INVITATIONAL-ID>HIT000022181</H-INVITATIONAL-ID>
<H-INVITATIONAL-ID>HIT000022183</H-INVITATIONAL-ID>
<H-INVITATIONAL-ID>HIT000022184</H-INVITATIONAL-ID>
<H-INVITATIONAL-ID>HIT000022185</H-INVITATIONAL-ID>
<H-INVITATIONAL-ID>HIT000022186</H-INVITATIONAL-ID>
<H-INVITATIONAL-ID>HIT000022188</H-INVITATIONAL-ID>
<H-INVITATIONAL-ID>HIT000022189</H-INVITATIONAL-ID>

</HINVDB_SEARCH>



399
400
401
402
403
404
405
# File 'lib/bio/io/hinv.rb', line 399

def result
  list = []
  @xml.elements.each('//H-INVITATIONAL-ID') do |e|
    list << e.text
  end
  return list
end

- (Object) size



407
408
409
# File 'lib/bio/io/hinv.rb', line 407

def size
  @xml.elements['//SIZE'].text.to_i
end

- (Object) start



410
411
412
# File 'lib/bio/io/hinv.rb', line 410

def start
  @xml.elements['//START'].text.to_i
end