Class: GeneValidator::LengthRankValidationOutput
- Inherits:
-
ValidationReport
- Object
- ValidationReport
- GeneValidator::LengthRankValidationOutput
- Defined in:
- lib/genevalidator/validation_length_rank.rb
Overview
Class that stores the validation output information
Instance Attribute Summary collapse
-
#extreme_hits ⇒ Object
readonly
Returns the value of attribute extreme_hits.
-
#largest_hit ⇒ Object
readonly
Returns the value of attribute largest_hit.
-
#mean ⇒ Object
readonly
Returns the value of attribute mean.
-
#median ⇒ Object
readonly
Returns the value of attribute median.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#no_of_hits ⇒ Object
readonly
Returns the value of attribute no_of_hits.
-
#percentage ⇒ Object
readonly
Returns the value of attribute percentage.
-
#query_length ⇒ Object
readonly
Returns the value of attribute query_length.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#smallest_hit ⇒ Object
readonly
Returns the value of attribute smallest_hit.
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, msg, query_length, no_of_hits, median, mean, smallest_hit, largest_hit, extreme_hits, percentage) ⇒ LengthRankValidationOutput
constructor
A new instance of LengthRankValidationOutput.
- #print ⇒ Object
- #validation ⇒ Object
Methods inherited from ValidationReport
Constructor Details
#initialize(short_header, header, description, msg, query_length, no_of_hits, median, mean, smallest_hit, largest_hit, extreme_hits, percentage) ⇒ LengthRankValidationOutput
Returns a new instance of LengthRankValidationOutput.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/genevalidator/validation_length_rank.rb', line 23 def initialize(short_header, header, description, msg, query_length, no_of_hits, median, mean, smallest_hit, largest_hit, extreme_hits, percentage) @short_header, @header, @description = short_header, header, description @msg = msg @query_length = query_length @no_of_hits = no_of_hits @median = median @mean = mean @smallest_hit = smallest_hit @largest_hit = largest_hit @extreme_hits = extreme_hits @percentage = percentage @result = validation @expected = :yes @approach = 'If the query sequence is well conserved and similar' \ ' sequences (BLAST hits) are correct, we can expect' \ ' query and hit sequences to have similar lengths.' @explanation = explain @conclusion = conclude end |
Instance Attribute Details
#extreme_hits ⇒ Object (readonly)
Returns the value of attribute extreme_hits.
19 20 21 |
# File 'lib/genevalidator/validation_length_rank.rb', line 19 def extreme_hits @extreme_hits end |
#largest_hit ⇒ Object (readonly)
Returns the value of attribute largest_hit.
18 19 20 |
# File 'lib/genevalidator/validation_length_rank.rb', line 18 def largest_hit @largest_hit end |
#mean ⇒ Object (readonly)
Returns the value of attribute mean.
16 17 18 |
# File 'lib/genevalidator/validation_length_rank.rb', line 16 def mean @mean end |
#median ⇒ Object (readonly)
Returns the value of attribute median.
15 16 17 |
# File 'lib/genevalidator/validation_length_rank.rb', line 15 def median @median end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
12 13 14 |
# File 'lib/genevalidator/validation_length_rank.rb', line 12 def msg @msg end |
#no_of_hits ⇒ Object (readonly)
Returns the value of attribute no_of_hits.
14 15 16 |
# File 'lib/genevalidator/validation_length_rank.rb', line 14 def no_of_hits @no_of_hits end |
#percentage ⇒ Object (readonly)
Returns the value of attribute percentage.
20 21 22 |
# File 'lib/genevalidator/validation_length_rank.rb', line 20 def percentage @percentage end |
#query_length ⇒ Object (readonly)
Returns the value of attribute query_length.
13 14 15 |
# File 'lib/genevalidator/validation_length_rank.rb', line 13 def query_length @query_length end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
21 22 23 |
# File 'lib/genevalidator/validation_length_rank.rb', line 21 def result @result end |
#smallest_hit ⇒ Object (readonly)
Returns the value of attribute smallest_hit.
17 18 19 |
# File 'lib/genevalidator/validation_length_rank.rb', line 17 def smallest_hit @smallest_hit end |
Instance Method Details
#conclude ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/genevalidator/validation_length_rank.rb', line 61 def conclude if @result == :yes 'There is no reason to believe there is any problem with the length' \ ' of the query sequence.' else "The sequence may be #{@msg.gsub(' ', ' ')}." end end |
#explain ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/genevalidator/validation_length_rank.rb', line 46 def explain diff = (@query_length > @median) ? 'longer' : 'shorter' exp1 = "The query sequence is #{@query_length} amino-acids long. BLAST" \ " identified #{@no_of_hits} hit sequences with lengths from" \ " #{@smallest_hit} to #{@largest_hit} amino-acids (median:" \ " #{@median}; mean: #{@mean})." if @extreme_hits != 0 exp2 = " #{@extreme_hits} of these hit sequences (i.e." \ " #{@percentage}%) are #{diff} than the query sequence." else exp2 = " All hit sequences are #{diff} than the query sequence." end exp1 + exp2 end |
#print ⇒ Object
70 71 72 |
# File 'lib/genevalidator/validation_length_rank.rb', line 70 def print (@msg.empty?) ? "#{@percentage}%" : "#{@percentage}% (#{@msg})" end |
#validation ⇒ Object
74 75 76 |
# File 'lib/genevalidator/validation_length_rank.rb', line 74 def validation (@msg.empty?) ? :yes : :no end |