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

#initializeKeywordSearch

Returns a new instance of KeywordSearch


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

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

Instance Method Details

#endObject


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

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

#query(hash = {}) ⇒ Object


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

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

#resultObject

<?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>


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

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

#sizeObject


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

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

#startObject


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

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