class Ulla::Environment

Attributes

amino_acids[RW]
freq_array[RW]
label[RW]
logo_array[RW]
number[RW]
prob_array[RW]
smooth_prob_array[RW]

Public Class Methods

new(number, label, amino_acids = "ACDEFGHIKLMNPQRSTVWYJ".split('')) click to toggle source
# 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

Public Instance Methods

increase_residue_count(a, inc = 1.0) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/ulla/environment.rb, line 34
def to_s
  "#{number}-#{label}"
end