Class: SequenceLogo::Alignment::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/sequence_logo/alignment.rb

Overview

object to be aligned should respond to #name, #render, #revcomp

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, shift) ⇒ Item

Returns a new instance of Item.



9
10
11
# File 'lib/sequence_logo/alignment.rb', line 9

def initialize(object, shift)
  @object, @shift = object, shift
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



7
8
9
# File 'lib/sequence_logo/alignment.rb', line 7

def object
  @object
end

#shiftObject (readonly)

Returns the value of attribute shift.



7
8
9
# File 'lib/sequence_logo/alignment.rb', line 7

def shift
  @shift
end

Instance Method Details

#lengthObject



13
14
15
# File 'lib/sequence_logo/alignment.rb', line 13

def length
  @object.length
end

#nameObject



17
18
19
# File 'lib/sequence_logo/alignment.rb', line 17

def name
  @object.name
end

#render(canvas_factory) ⇒ Object



21
22
23
24
25
# File 'lib/sequence_logo/alignment.rb', line 21

def render(canvas_factory)
  object_image = object.render(canvas_factory)
  shifted_image = canvas_factory.(object_image, shift)
  canvas_factory.logo_with_name(shifted_image, name)
end