Class: Rafflesia::VariantMapData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/proteins/variant_map_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  chain: :chain,
  relation: :relation,
  sequence_id: :sequence_id,
  sequence_length: :sequence_length,
  structure_id: :structure_id,
  target_id: :target_id,
  variants: :variants,
  warnings: :warnings
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ VariantMapData

Returns a new instance of VariantMapData.



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

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @chain = hash[:chain]
  @relation = hash[:relation] ? Rafflesia::RelationArtifactData.new(hash[:relation]) : nil
  @sequence_id = hash[:sequence_id]
  @sequence_length = hash[:sequence_length]
  @structure_id = hash[:structure_id]
  @target_id = hash[:target_id]
  @variants = (hash[:variants] || []).map { |item| item ? Rafflesia::MappedVariant.new(item) : nil }
  @warnings = (hash[:warnings] || []).map { |item| item ? Rafflesia::SearchWarning.new(item) : nil }
end

Instance Attribute Details

#chainObject

Returns the value of attribute chain.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def chain
  @chain
end

#relationObject

Returns the value of attribute relation.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def relation
  @relation
end

#sequence_idObject

Returns the value of attribute sequence_id.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def sequence_id
  @sequence_id
end

#sequence_lengthObject

Returns the value of attribute sequence_length.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def sequence_length
  @sequence_length
end

#structure_idObject

Returns the value of attribute structure_id.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def structure_id
  @structure_id
end

#target_idObject

Returns the value of attribute target_id.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def target_id
  @target_id
end

#variantsObject

Returns the value of attribute variants.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def variants
  @variants
end

#warningsObject

Returns the value of attribute warnings.



19
20
21
# File 'lib/rafflesia/proteins/variant_map_data.rb', line 19

def warnings
  @warnings
end