Class: Rafflesia::SequenceSearchData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/sequences/sequence_search_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  backend: :backend,
  db: :db,
  hits: :hits,
  index_id: :index_id,
  query: :query,
  relation: :relation,
  seed_index: :seed_index,
  total_matched: :total_matched
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ SequenceSearchData

Returns a new instance of SequenceSearchData.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 29

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @backend = hash[:backend]
  @db = hash[:db]
  @hits = (hash[:hits] || []).map { |item| item ? Rafflesia::SequenceSearchHit.new(item) : nil }
  @index_id = hash[:index_id]
  @query = hash[:query]
  @relation = hash[:relation] ? Rafflesia::RelationArtifactData.new(hash[:relation]) : nil
  @seed_index = hash[:seed_index] ? Rafflesia::SequenceSeedIndexSearchMetrics.new(hash[:seed_index]) : nil
  @total_matched = hash[:total_matched]
end

Instance Attribute Details

#backendObject

Returns the value of attribute backend.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def backend
  @backend
end

#dbObject

Returns the value of attribute db.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def db
  @db
end

#hitsObject

Returns the value of attribute hits.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def hits
  @hits
end

#index_idObject

Returns the value of attribute index_id.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def index_id
  @index_id
end

#queryObject

Returns the value of attribute query.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def query
  @query
end

#relationObject

Returns the value of attribute relation.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def relation
  @relation
end

#seed_indexObject

Returns the value of attribute seed_index.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def seed_index
  @seed_index
end

#total_matchedObject

Returns the value of attribute total_matched.



19
20
21
# File 'lib/rafflesia/sequences/sequence_search_data.rb', line 19

def total_matched
  @total_matched
end