Class: GeneValidator::BlastRFValidationOutput
- Inherits:
-
ValidationReport
- Object
- ValidationReport
- GeneValidator::BlastRFValidationOutput
- Defined in:
- lib/genevalidator/validation_blast_reading_frame.rb
Overview
Class that stores the validation output information
Instance Attribute Summary collapse
-
#frames ⇒ Object
readonly
Returns the value of attribute frames.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#total_hsp ⇒ Object
readonly
Returns the value of attribute total_hsp.
Attributes inherited from ValidationReport
#approach, #conclusion, #description, #errors, #expected, #explanation, #header, #message, #plot_files, #run_time, #short_header, #validation_result
Instance Method Summary collapse
- #conclude ⇒ Object
- #explain ⇒ Object
-
#initialize(short_header, header, description, frames, expected = :yes) ⇒ BlastRFValidationOutput
constructor
A new instance of BlastRFValidationOutput.
- #print ⇒ Object
- #validation ⇒ Object
Methods inherited from ValidationReport
Constructor Details
#initialize(short_header, header, description, frames, expected = :yes) ⇒ BlastRFValidationOutput
Returns a new instance of BlastRFValidationOutput.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 16 def initialize(short_header, header, description, frames, expected = :yes) @short_header, @header, @description = short_header, header, 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 |
Instance Attribute Details
#frames ⇒ Object (readonly)
Returns the value of attribute frames.
11 12 13 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 11 def frames @frames end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
12 13 14 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 12 def msg @msg end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
14 15 16 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 14 def result @result end |
#total_hsp ⇒ Object (readonly)
Returns the value of attribute total_hsp.
13 14 15 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 13 def total_hsp @total_hsp end |
Instance Method Details
#conclude ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 52 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 ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 40 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 ⇒ Object
61 62 63 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 61 def print @msg.gsub(/; $/, '') end |
#validation ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 65 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 |