Class: Ulla::Environment
- Inherits:
-
Object
- Object
- Ulla::Environment
- Defined in:
- lib/ulla/environment.rb
Instance Attribute Summary collapse
-
#amino_acids ⇒ Object
Returns the value of attribute amino_acids.
-
#freq_array ⇒ Object
Returns the value of attribute freq_array.
-
#label ⇒ Object
Returns the value of attribute label.
-
#logo_array ⇒ Object
Returns the value of attribute logo_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
- #increase_residue_count(a, inc = 1.0) ⇒ Object
-
#initialize(number, label, amino_acids = "ACDEFGHIKLMNPQRSTVWYJ".split('')) ⇒ Environment
constructor
A new instance of Environment.
- #label_set ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(number, label, amino_acids = "ACDEFGHIKLMNPQRSTVWYJ".split('')) ⇒ Environment
Returns a new instance of Environment.
12 13 14 15 16 17 18 19 20 |
# File 'lib/ulla/environment.rb', line 12 def initialize(number, label, amino_acids = "ACDEFGHIKLMNPQRSTVWYJ".split('')) @number = number @label = label @amino_acids = amino_acids @freq_array = NArray.float(@amino_acids.size) @prob_array = NArray.float(@amino_acids.size) @logo_array = NArray.float(@amino_acids.size) @smooth_prob_array = NArray.float(@amino_acids.size) end |
Instance Attribute Details
#amino_acids ⇒ Object
Returns the value of attribute amino_acids.
4 5 6 |
# File 'lib/ulla/environment.rb', line 4 def amino_acids @amino_acids end |
#freq_array ⇒ Object
Returns the value of attribute freq_array.
4 5 6 |
# File 'lib/ulla/environment.rb', line 4 def freq_array @freq_array end |
#label ⇒ Object
Returns the value of attribute label.
4 5 6 |
# File 'lib/ulla/environment.rb', line 4 def label @label end |
#logo_array ⇒ Object
Returns the value of attribute logo_array.
4 5 6 |
# File 'lib/ulla/environment.rb', line 4 def logo_array @logo_array end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/ulla/environment.rb', line 4 def number @number end |
#prob_array ⇒ Object
Returns the value of attribute prob_array.
4 5 6 |
# File 'lib/ulla/environment.rb', line 4 def prob_array @prob_array end |
#smooth_prob_array ⇒ Object
Returns the value of attribute smooth_prob_array.
4 5 6 |
# File 'lib/ulla/environment.rb', line 4 def smooth_prob_array @smooth_prob_array end |
Instance Method Details
#increase_residue_count(a, inc = 1.0) ⇒ Object
22 23 24 |
# File 'lib/ulla/environment.rb', line 22 def increase_residue_count(a, inc = 1.0) @freq_array[@amino_acids.index(a)] += inc end |
#label_set ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ulla/environment.rb', line 26 def label_set if $direction == 0 label.split("").each_with_index.map { |l, i| "#{i}#{l}" }.to_set else label.gsub('-', '').split("").each_with_index.map { |l, i| "#{i}#{l}" }.to_set end end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/ulla/environment.rb', line 34 def to_s "#{number}-#{label}" end |