Method: Ytilib::PM#to_pwm!
- Defined in:
- lib/sequence_logo/ytilib/pm.rb
#to_pwm!(words_count = nil, probs = Randoom::DEF_PROBS, pseudocount = 1) ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/sequence_logo/ytilib/pm.rb', line 181 def to_pwm!(words_count = nil, probs = Randoom::DEF_PROBS, pseudocount = 1) @words_count = words_count if words_count && words_count > 0 @matrix.each_key do |letter| (0...@size).each { |pos| #p "pcm" #p @matrix[letter][pos] #p @matrix[letter][pos] + (probs[letter] * pseudocount) #p ( (@words_count + pseudocount) * probs[letter]) #exit @matrix[letter][pos] = Math::log( (@matrix[letter][pos] + (probs[letter] * pseudocount)) / ( (@words_count + pseudocount) * probs[letter]) ) } end return self end |