Class: Ulla::Esst
- Inherits:
-
Object
- Object
- Ulla::Esst
- Defined in:
- lib/ulla/esst.rb
Instance Attribute Summary collapse
-
#colnames ⇒ Object
Returns the value of attribute colnames.
-
#label ⇒ Object
Returns the value of attribute label.
-
#matrix ⇒ Object
Returns the value of attribute matrix.
-
#no ⇒ Object
Returns the value of attribute no.
-
#rownames ⇒ Object
Returns the value of attribute rownames.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, label, no, colnames = [], rownames = [], matrix = nil) ⇒ Esst
constructor
A new instance of Esst.
- #score(from_aa, to_aa) ⇒ Object
- #scores_from(aa) ⇒ Object
- #scores_to(aa) ⇒ Object
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
#colnames ⇒ Object
Returns the value of attribute colnames.
4 5 6 |
# File 'lib/ulla/esst.rb', line 4 def colnames @colnames end |
#label ⇒ Object
Returns the value of attribute label.
4 5 6 |
# File 'lib/ulla/esst.rb', line 4 def label @label end |
#matrix ⇒ Object
Returns the value of attribute matrix.
4 5 6 |
# File 'lib/ulla/esst.rb', line 4 def matrix @matrix end |
#no ⇒ Object
Returns the value of attribute no.
4 5 6 |
# File 'lib/ulla/esst.rb', line 4 def no @no end |
#rownames ⇒ Object
Returns the value of attribute rownames.
4 5 6 |
# File 'lib/ulla/esst.rb', line 4 def rownames @rownames end |
#type ⇒ Object
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 |