Sha256: 1b5a14ad67828a8b1184c5c316c2aefeedf446117d5388cf7a184b0a5bc870b5
Contents?: true
Size: 563 Bytes
Versions: 3
Compression:
Stored size: 563 Bytes
Contents
require_relative 'pm' module Bioinform module MotifModel def self.acts_as_ppm?(ppm) ppm.is_a?(MotifModel::PPM) || ppm.is_a?(MotifModel::NamedModel) && acts_as_ppm?(ppm.model) end class PPM < PM def validation_errors errors = super errors << "elements of PPM should be non-negative" unless matrix.all?{|pos| pos.all?{|el| el >= 0 } } errors << "each PPM position should be equal to 1.0 being summed" unless matrix.all?{|pos| (pos.inject(0.0, &:+) - 1.0).abs < 1e-3 } errors end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bioinform-0.2.2 | lib/bioinform/data_models/ppm.rb |
bioinform-0.2.1 | lib/bioinform/data_models/ppm.rb |
bioinform-0.2.0 | lib/bioinform/data_models/ppm.rb |