Class: Rafflesia::StructureChainsData

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

Constant Summary collapse

HASH_ATTRS =
{
  chain_count: :chain_count,
  chains: :chains,
  format: :format,
  object: :object,
  parser: :parser,
  relation: :relation,
  source: :source,
  source_metadata: :source_metadata,
  structure_id: :structure_id,
  target_id: :target_id
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ StructureChainsData

Returns a new instance of StructureChainsData.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 33

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @chain_count = hash[:chain_count]
  @chains = (hash[:chains] || []).map { |item| item ? Rafflesia::StructureChainRecord.new(item) : nil }
  @format = hash[:format]
  @object = hash[:object] ? Rafflesia::ObjectRef.new(hash[:object]) : nil
  @parser = hash[:parser] ? Rafflesia::StructureParserMetadata.new(hash[:parser]) : nil
  @relation = hash[:relation] ? Rafflesia::RelationArtifactData.new(hash[:relation]) : nil
  @source = hash[:source]
  @source_metadata = hash[:source_metadata] || {}
  @structure_id = hash[:structure_id]
  @target_id = hash[:target_id]
end

Instance Attribute Details

#chain_countObject

Returns the value of attribute chain_count.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def chain_count
  @chain_count
end

#chainsObject

Returns the value of attribute chains.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def chains
  @chains
end

#formatObject

Returns the value of attribute format.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def format
  @format
end

#objectObject

Returns the value of attribute object.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def object
  @object
end

#parserObject

Returns the value of attribute parser.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def parser
  @parser
end

#relationObject

Returns the value of attribute relation.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def relation
  @relation
end

#sourceObject

Returns the value of attribute source.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def source
  @source
end

#source_metadataObject

Returns the value of attribute source_metadata.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def 
  @source_metadata
end

#structure_idObject

Returns the value of attribute structure_id.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def structure_id
  @structure_id
end

#target_idObject

Returns the value of attribute target_id.



21
22
23
# File 'lib/rafflesia/proteins/structure_chains_data.rb', line 21

def target_id
  @target_id
end