class GeneValidator::LengthRankValidationOutput

Class that stores the validation output information

Attributes

extreme_hits[R]
largest_hit[R]
mean[R]
median[R]
msg[R]
no_of_hits[R]
percentage[R]
query_length[R]
result[R]
smallest_hit[R]

Public Class Methods

new(short_header, header, description, msg, query_length, no_of_hits, median, mean, smallest_hit, largest_hit, extreme_hits, percentage) click to toggle source
# 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 = short_header
  @header = header
  @description = 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

Public Instance Methods

conclude() click to toggle source
# File lib/genevalidator/validation_length_rank.rb, line 63
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() click to toggle source
# File lib/genevalidator/validation_length_rank.rb, line 48
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})."
  exp2 = if @extreme_hits != 0
           " #{@extreme_hits} of these hit sequences (i.e." \
                  " #{@percentage}%) are #{diff} than the query sequence."
         else
           " All hit sequences are #{diff} than the query sequence."
         end
  exp1 + exp2
end
print() click to toggle source
validation() click to toggle source
# File lib/genevalidator/validation_length_rank.rb, line 76
def validation
  @msg.empty? ? :yes : :no
end