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

- (TaggedPeak) initialize(data, sample_id)

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

- (Object) sample_id



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

def sample_id
  self[1]
end

- (Object) sample_id=(val)



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

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

- (Object) x=(val)



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

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

- (Object) y=(val)



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

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