lib/macroape/counting.rb in macroape-3.3.6 vs lib/macroape/counting.rb in macroape-3.3.7
- old
+ new
@@ -1,24 +1,18 @@
+require 'bioinform'
+
module Bioinform
class PWM
# sets or gets limit size of calculation hash. It's a defence against overuse CPU resources by non-appropriate data
- def max_hash_size!(new_max_hash_size)
- @max_hash_size = new_max_hash_size
- self
- end
+ make_parameters :max_hash_size
- def max_hash_size(*args)
- case args.size
- when 0 then @max_hash_size
- when 1 then max_hash_size!(args.first)
- else raise ArgumentError, '#max_hash_size method can get 0 or 1 argument'
- end
- end
-
def threshold(pvalue)
thresholds(pvalue){|_, thresh, _| return thresh }
end
+ def threshold_and_real_pvalue(pvalue)
+ thresholds(pvalue){|_, thresh, real_pv| return thresh, real_pv }
+ end
def thresholds(*pvalues)
thresholds_by_pvalues(*pvalues).each do |pvalue,(thresholds, counts)|
threshold = thresholds.begin + 0.1 * (thresholds.end - thresholds.begin)
real_pvalue = counts.end.to_f / vocabulary_volume
@@ -78,10 +72,10 @@
new_scores = Hash.new(0)
scores.each do |score, count|
4.times do |letter|
new_score = score + column[letter]
if new_score >= least_sufficient
- new_scores[new_score] += count * @background[letter]
+ new_scores[new_score] += count * background[letter]
end
end
end
new_scores
end
\ No newline at end of file