Class: Bioinform::MotifModel::PPM

Inherits:
PM
  • Object
show all
Defined in:
lib/bioinform/data_models/ppm.rb

Instance Attribute Summary

Attributes inherited from PM

#alphabet, #matrix

Instance Method Summary collapse

Methods inherited from PM

#==, #complemented, #each_position, from_file, from_string, #initialize, #length, #named, #reverse_complemented, #reversed, #to_s

Constructor Details

This class inherits a constructor from Bioinform::MotifModel::PM

Instance Method Details

#validation_errorsObject



10
11
12
13
14
15
# File 'lib/bioinform/data_models/ppm.rb', line 10

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