Class: Ulla::Esst

Inherits:
Object
  • Object
show all
Defined in:
lib/ulla/esst.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, label, no, colnames = [], rownames = [], matrix = nil) ⇒ Esst



6
7
8
9
10
11
12
13
# File 'lib/ulla/esst.rb', line 6

def initialize(type, label, no, colnames=[], rownames=[], matrix = nil)
  @type     = type
  @label    = label
  @no       = no
  @colnames = colnames
  @rownames = rownames
  @matrix   = matrix
end

Instance Attribute Details

#colnamesObject

Returns the value of attribute colnames.



4
5
6
# File 'lib/ulla/esst.rb', line 4

def colnames
  @colnames
end

#labelObject

Returns the value of attribute label.



4
5
6
# File 'lib/ulla/esst.rb', line 4

def label
  @label
end

#matrixObject

Returns the value of attribute matrix.



4
5
6
# File 'lib/ulla/esst.rb', line 4

def matrix
  @matrix
end

#noObject

Returns the value of attribute no.



4
5
6
# File 'lib/ulla/esst.rb', line 4

def no
  @no
end

#rownamesObject

Returns the value of attribute rownames.



4
5
6
# File 'lib/ulla/esst.rb', line 4

def rownames
  @rownames
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/ulla/esst.rb', line 4

def type
  @type
end

Instance Method Details

#score(from_aa, to_aa) ⇒ Object



25
26
27
28
29
# File 'lib/ulla/esst.rb', line 25

def score(from_aa, to_aa)
  i = colnames.index(from_aa)
  j = rownames.index(to_aa)
  @matrix[i, j]
end

#scores_from(aa) ⇒ Object



15
16
17
18
# File 'lib/ulla/esst.rb', line 15

def scores_from(aa)
  i = colnames.index(aa)
  @matrix[i, 0..-1]
end

#scores_to(aa) ⇒ Object



20
21
22
23
# File 'lib/ulla/esst.rb', line 20

def scores_to(aa)
  j = rownames.index(aa)
  @matrix[0..-1, j]
end