Class | Bio::FlatFileIndex::Results
In: | lib/bio/io/flatfile/index.rb
Parent: | Hash

`Results` stores search results created by `Bio::FlatFileIndex` methods.

Currently, this class inherits Hash, but internal structure of this class may be changed anytime. Only using methods described below are strongly recomended.

### Methods

* + each size to_a to_s

### External Aliases

each_value | -> | each
| alias for each_value.
values | -> | to_a
| alias for to_a.

### Public Instance methods

*(a)

Returns set intersection of results. "a * b" means "a AND b".

- Example

       # I want to search 'HIS_KIN' AND 'human'
       db = Bio::FlatFIleIndex.new(location)
       hk = db.search('HIS_KIN')
       hu = db.search('human')
       # hk and hu are Bio::FlatFileIndex::Results objects.
       print hk * hu

[Source]

         # File lib/bio/io/flatfile/index.rb, line 351
    351:       def *(a)
    352:         raise 'argument must be Results class' unless a.is_a?(self.class)
    353:         res = self.class.new
    354:         a.each_key { |x| res.store(x, a[x]) if self[x] }
    355:         res
    356:       end

+(a)

Add search results. "a + b" means "a OR b".

- Example

       # I want to search 'ADH_IRON_1' OR 'ADH_IRON_2'
       db = Bio::FlatFIleIndex.new(location)
       a1 = db.search('ADH_IRON_1')
       a2 = db.search('ADH_IRON_2')
       # a1 and a2 are Bio::FlatFileIndex::Results objects.
       print a1 + a2

[Source]

         # File lib/bio/io/flatfile/index.rb, line 334
    334:       def +(a)
    335:         raise 'argument must be Results class' unless a.is_a?(self.class)
    336:         res = self.dup
    337:         res.update(a)
    338:         res
    339:       end

each() {|str| ...}

Iterates over each result (string). Same as to_a.each.

[Source]

         # File lib/bio/io/flatfile/index.rb, line 374
    374:       def each(&x) #:yields: str
    375:         each_value(&x)
    376:       end

size()

Returns number of results. Same as to_a.size.

[Source]

         # File lib/bio/io/flatfile/index.rb, line 392
    392:       def size; end

to_a()

Returns an array of strings. If no search results are exist, returns an empty array.

[Source]

         # File lib/bio/io/flatfile/index.rb, line 388
    388:       def to_a; values; end

to_s()

Returns a string. (concatinated if multiple results exists). Same as `to_a.join(’’)`.

[Source]

         # File lib/bio/io/flatfile/index.rb, line 361
    361:       def to_s
    362:         self.values.join
    363:       end

[Validate]