class GeneValidator::BlastRFValidationOutput
Class that stores the validation output information
Attributes
frames[R]
msg[R]
result[R]
total_hsp[R]
Public Class Methods
new(short_header, header, description, frames, expected = :yes)
click to toggle source
# File lib/genevalidator/validation_blast_reading_frame.rb, line 16 def initialize(short_header, header, description, frames, expected = :yes) @short_header = short_header @header = header @description = description @frames = frames @expected = expected @result = validation @msg = '' @exp_msg = '' @total_hsp = 0 @frames.each do |x, y| @msg << "#{y} HSPs align in frame #{x}; " @exp_msg << "#{y} HSPs align in frame #{x}; " @total_hsp += y.to_i end @approach = 'We expect the query sequence to encode a single gene,' \ ' thus it should contain one main Open Reading Frame' \ ' (ORF). All BLAST hits are thus expected to align' \ ' within this ORF.' @explanation = explain @conclusion = conclude end
Public Instance Methods
conclude()
click to toggle source
# File lib/genevalidator/validation_blast_reading_frame.rb, line 54 def conclude if @result == :yes # i.e. if there is only one ORF... 'This is as expected.' else 'The HSPs align in mulitple reading frames, this suggests there may' \ ' be a frame shift in the query sequence.' end end
explain()
click to toggle source
# File lib/genevalidator/validation_blast_reading_frame.rb, line 42 def explain t = "BLAST identified #{@total_hsp} High-scoring Segment Pairs" \ ' (HSPs)' if @result == :yes # i.e. if there is only one ORF... frame = @frames.keys[0].to_s t1 = "; all of these align in frame #{frame}." else t1 = ": #{@exp_msg.gsub(/; $/, '')}." end t + t1 end
print()
click to toggle source
# File lib/genevalidator/validation_blast_reading_frame.rb, line 63 def print @msg.gsub(/; $/, '') end
validation()
click to toggle source
# File lib/genevalidator/validation_blast_reading_frame.rb, line 67 def validation # chack if there are different reading frames count_p = 0 count_n = 0 frames.each do |x, _y| count_p += 1 if x > 0 count_n += 1 if x < 0 end count_p > 1 || count_n > 1 ? :no : :yes end