class GeneValidator::AlignmentValidationOutput

Class that stores the validation output information

Attributes

consensus[R]
extra_seq[R]
gaps[R]
result[R]
threshold[R]

Public Class Methods

new(short_header, header, description, gaps = 0, extra_seq = 0, consensus = 1, threshold = 20, expected = :yes) click to toggle source
# 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 = short_header
  @header = header
  @description = 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

Public Instance Methods

conclude() click to toggle source
# File lib/genevalidator/validation_alignment.rb, line 45
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() click to toggle source
validation() click to toggle source
# File lib/genevalidator/validation_alignment.rb, line 79
def validation
  if gaps.to_i < @threshold && extra_seq.to_i < @threshold &&
     (1 - consensus.to_i) < @threshold
    :yes
  else
    :no
  end
end