Class: Bio::RestrictionEnzyme::Range::SequenceRange::Fragment

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb

Defined Under Namespace

Classes: DisplayFragment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(primary_bin, complement_bin) ⇒ Fragment

Returns a new instance of Fragment.



21
22
23
24
# File 'lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb', line 21

def initialize( primary_bin, complement_bin )
  @primary_bin = primary_bin
  @complement_bin = complement_bin
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



19
20
21
# File 'lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb', line 19

def size
  @size
end

Instance Method Details

#for_display(p_str = nil, c_str = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb', line 28

def for_display(p_str=nil, c_str=nil)
  df = DisplayFragment.new
  df.primary = ''
  df.complement = ''

  both_bins = @primary_bin + @complement_bin
  both_bins.each do |item|
    @primary_bin.include?(item) ? df.primary << p_str[item] : df.primary << ' '
    @complement_bin.include?(item) ? df.complement << c_str[item] : df.complement << ' '
  end
  
  df.p_left  = @primary_bin.first
  df.p_right = @primary_bin.last
  df.c_left  = @complement_bin.first
  df.c_right = @complement_bin.last

  df
end