Class: Mspire::TaggedPeak

Inherits:
Array
  • Object
show all
Defined in:
lib/mspire/tagged_peak.rb

Overview

A TaggedPeak has a sample_id attribute. In the rest of its interface it behaves like a normal Mspire::Peak. There are no forward compatible guarantees if you use the array interface, but currently the TaggedPeak is arranged internally like this:

[x, sample_id, y]

Note that the object is instantiated like this:

TaggedPeak.new( [x,y], sample_id )

x and y value access are very fast because they are merely aliases against first and last.

Instance Method Summary collapse

Methods inherited from Array

#in_groups

Constructor Details

#initialize(data, sample_id) ⇒ TaggedPeak

Returns a new instance of TaggedPeak.



30
31
32
33
34
# File 'lib/mspire/tagged_peak.rb', line 30

def initialize(data, sample_id)
  self[0] = data.first
  self[1] = sample_id
  self[2] = data.last
end

Instance Method Details

#sample_idObject



36
37
38
# File 'lib/mspire/tagged_peak.rb', line 36

def sample_id
  self[1]
end

#sample_id=(val) ⇒ Object



40
41
42
# File 'lib/mspire/tagged_peak.rb', line 40

def sample_id=(val)
  self[1] = val
end

#x=(val) ⇒ Object



22
23
24
# File 'lib/mspire/tagged_peak.rb', line 22

def x=(val)
  self[0] = val
end

#y=(val) ⇒ Object



26
27
28
# File 'lib/mspire/tagged_peak.rb', line 26

def y=(val)
  self[2] = val
end