Class: Environment
- Inherits:
-
Object
- Object
- Environment
- Defined in:
- lib/environment.rb
Constant Summary collapse
- @@amino_acids =
"ACDEFGHIKLMNPQRSTVWYJ".split("")
Instance Attribute Summary collapse
-
#freq_array ⇒ Object
Returns the value of attribute freq_array.
-
#label ⇒ Object
Returns the value of attribute label.
-
#logodd_array ⇒ Object
Returns the value of attribute logodd_array.
-
#number ⇒ Object
Returns the value of attribute number.
-
#prob_array ⇒ Object
Returns the value of attribute prob_array.
-
#smooth_prob_array ⇒ Object
Returns the value of attribute smooth_prob_array.
Instance Method Summary collapse
- #add_residue_count(a, inc = 1) ⇒ Object
-
#initialize(number, label) ⇒ Environment
constructor
A new instance of Environment.
- #label_set ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(number, label) ⇒ Environment
Returns a new instance of Environment.
17 18 19 20 21 22 23 24 |
# File 'lib/environment.rb', line 17 def initialize(number, label) @number = number @label = label @freq_array = NArray.int(21) @prob_array = NArray.float(21) @logodd_array = NArray.float(21) @smooth_prob_array = NArray.float(21) end |
Instance Attribute Details
#freq_array ⇒ Object
Returns the value of attribute freq_array.
10 11 12 |
# File 'lib/environment.rb', line 10 def freq_array @freq_array end |
#label ⇒ Object
Returns the value of attribute label.
10 11 12 |
# File 'lib/environment.rb', line 10 def label @label end |
#logodd_array ⇒ Object
Returns the value of attribute logodd_array.
10 11 12 |
# File 'lib/environment.rb', line 10 def logodd_array @logodd_array end |
#number ⇒ Object
Returns the value of attribute number.
10 11 12 |
# File 'lib/environment.rb', line 10 def number @number end |
#prob_array ⇒ Object
Returns the value of attribute prob_array.
10 11 12 |
# File 'lib/environment.rb', line 10 def prob_array @prob_array end |
#smooth_prob_array ⇒ Object
Returns the value of attribute smooth_prob_array.
10 11 12 |
# File 'lib/environment.rb', line 10 def smooth_prob_array @smooth_prob_array end |
Instance Method Details
#add_residue_count(a, inc = 1) ⇒ Object
26 27 28 |
# File 'lib/environment.rb', line 26 def add_residue_count(a, inc = 1) @freq_array[@@amino_acids.index(a.upcase)] += inc end |
#label_set ⇒ Object
30 31 32 |
# File 'lib/environment.rb', line 30 def label_set label.split("").map_with_index { |l, i| "#{i}#{l}" }.to_set end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/environment.rb', line 34 def to_s "#{number}-#{label}" end |