79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/sequence_logo/ytilib/randoom.rb', line 79
def Randoom.make_probs!(counts, length = nil)
probs = { 'A' => 0, 'C' => 0, 'G' => 0, 'T' => 0 }
length = counts['A'] + counts['C'] + counts['G'] + counts['T'] + counts['N'] if length == nil
length = length.to_f
['A','C','G','T'].each { |l| counts[l] += counts['N'] / 4.0 }
return probs if length == 0
probs['A'] = counts['A'] / length
probs['C'] = counts['C'] / length
probs['G'] = counts['G'] / length
probs['T'] = 1 - probs['A'] - probs['C'] - probs['G']
return probs
end
|