Class: GeneValidator::AlignmentValidationOutput
- Inherits:
-
ValidationReport
- Object
- ValidationReport
- GeneValidator::AlignmentValidationOutput
- Defined in:
- lib/genevalidator/validation_alignment.rb
Overview
Class that stores the validation output information
Instance Attribute Summary collapse
-
#consensus ⇒ Object
readonly
Returns the value of attribute consensus.
-
#extra_seq ⇒ Object
readonly
Returns the value of attribute extra_seq.
-
#gaps ⇒ Object
readonly
Returns the value of attribute gaps.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
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
-
#initialize(short_header, header, description, gaps = 0, extra_seq = 0, consensus = 1, threshold = 20, expected = :yes) ⇒ AlignmentValidationOutput
constructor
A new instance of AlignmentValidationOutput.
- #print ⇒ Object
- #validation ⇒ Object
Methods inherited from ValidationReport
Constructor Details
#initialize(short_header, header, description, gaps = 0, extra_seq = 0, consensus = 1, threshold = 20, expected = :yes) ⇒ AlignmentValidationOutput
Returns a new instance of AlignmentValidationOutput.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/genevalidator/validation_alignment.rb', line 19 def initialize(short_header, header, description, gaps = 0, extra_seq = 0, consensus = 1, threshold = 20, expected = :yes) @short_header, @header, @description = short_header, header, description @gaps = (gaps * 100).round.to_s + '%' @extra_seq = (extra_seq * 100).round.to_s + '%' @consensus = (consensus * 100).round.to_s + '%' @threshold = threshold @result = validation @expected = expected @plot_files = [] @approach = 'We expect the query sequence to be similar to the top' \ ' ten BLAST hits. Here, we create a statistical' \ ' consensus model of those top hits and compare the' \ ' query to this model.' @explanation = "The query sequence includes #{@consensus} amino-acid" \ ' residues present in the consensus model.' \ " #{@extra_seq} of residues in the query sequence are" \ ' absent from the consensus profile. ' \ " #{@gaps} of residues in the consensus profile are" \ ' absent from the query sequence.' @conclusion = conclude end |
Instance Attribute Details
#consensus ⇒ Object (readonly)
Returns the value of attribute consensus.
15 16 17 |
# File 'lib/genevalidator/validation_alignment.rb', line 15 def consensus @consensus end |
#extra_seq ⇒ Object (readonly)
Returns the value of attribute extra_seq.
14 15 16 |
# File 'lib/genevalidator/validation_alignment.rb', line 14 def extra_seq @extra_seq end |
#gaps ⇒ Object (readonly)
Returns the value of attribute gaps.
13 14 15 |
# File 'lib/genevalidator/validation_alignment.rb', line 13 def gaps @gaps end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
17 18 19 |
# File 'lib/genevalidator/validation_alignment.rb', line 17 def result @result end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
16 17 18 |
# File 'lib/genevalidator/validation_alignment.rb', line 16 def threshold @threshold end |
Instance Method Details
#conclude ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/genevalidator/validation_alignment.rb', line 43 def conclude if @result == :yes 'There is no evidence based on the top 10 BLAST hits to suggest any' \ ' problems with the query sequence.' else t = 'These results suggest that there may be some problems with' \ ' the query sequence.' t1, t2, t3 = '', '', '' # Create empty string variables if (1 - consensus.to_i) > @threshold t1 = ' There is low conservation of residues between the' \ ' statistical profile and the query sequence (the cut-off' \ ' is 80%).' end if extra_seq.to_i > @threshold t2 = " The query sequence has a high percentage (#{@extra_seq})" \ ' of extra residues absent from the statistical profile' \ ' (the cut-off is 20%).' end if gaps.to_i > @threshold t3 = " The query sequence has a high percentage (#{@gaps}) of" \ ' missing residues when compared to the statistical profile' \ ' (the cut-off is 20%).' end t + t1 + t2 + t3 end end |
#print ⇒ Object
70 71 72 73 |
# File 'lib/genevalidator/validation_alignment.rb', line 70 def print "#{@consensus} conserved; #{@extra_seq} extra;" \ " #{@gaps} missing." end |
#validation ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/genevalidator/validation_alignment.rb', line 75 def validation if gaps.to_i < @threshold && extra_seq.to_i < @threshold && (1 - consensus.to_i) < @threshold :yes else :no end end |