Sha256: f36ea5e674ee2bb99f856b5d31b2ea097c30ec0e8685beaf3a413c09b9521162
Contents?: true
Size: 937 Bytes
Versions: 2
Compression:
Stored size: 937 Bytes
Contents
require_relative '../support' require_relative '../data_models' require_relative '../conversion_algorithms/pcm2ppm_converter' require_relative '../conversion_algorithms/pcm2pwm_converter' module Bioinform class PCM < PM make_parameters :pseudocount def count matrix.first.inject(&:+) end def to_pcm self end def to_pwm(pseudocount = Math.log(count)) ConversionAlgorithms::PCM2PWMConverter.convert(self, pseudocount: pseudocount) end def to_ppm ConversionAlgorithms::PCM2PPMConverter.convert(self) end def self.valid_matrix?(matrix, options = {}) super && matrix.all?{|pos| pos.all?{|el| el >=0 } } end def validation_errors(options = {}) validation_errors = [] validation_errors << "PCM matrix should contain only non-negative elements" unless matrix.all?{|pos| pos.all?{|el| el >=0 } } super + validation_errors end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bioinform-0.1.17 | lib/bioinform/data_models/pcm.rb |
bioinform-0.1.16 | lib/bioinform/data_models/pcm.rb |