Class: HTS::Bam::Mpileup::ColumnsView

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/hts/bam/mpileup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeColumnsView

Returns a new instance of ColumnsView.



40
# File 'lib/hts/bam/mpileup.rb', line 40

def initialize = @column_view = Pileup::BorrowedColumnView.new

Instance Attribute Details

#lengthObject (readonly) Also known as: size

Returns the value of attribute length.



38
39
40
# File 'lib/hts/bam/mpileup.rb', line 38

def length
  @length
end

#posObject (readonly)

Returns the value of attribute pos.



38
39
40
# File 'lib/hts/bam/mpileup.rb', line 38

def pos
  @pos
end

#tidObject (readonly)

Returns the value of attribute tid.



38
39
40
# File 'lib/hts/bam/mpileup.rb', line 38

def tid
  @tid
end

Instance Method Details

#eachObject



50
51
52
53
54
55
# File 'lib/hts/bam/mpileup.rb', line 50

def each
  return to_enum(__method__) unless block_given?

  @rows.each_with_index { |entries, index| yield index, @column_view.reset(entries, @tid, @pos) }
  self
end

#reset(tid, pos, rows) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/hts/bam/mpileup.rb', line 42

def reset(tid, pos, rows)
  @tid = tid
  @pos = pos
  @rows = rows
  @length = rows.length
  self
end