class GeneValidator::GeneMergeValidationOutput

Class that stores the validation output information

Constants

LOWER_THRESHOLD
UPPER_THRESHOLD

These thresholds are emperically chosen.

Attributes

result[R]
slope[R]
threshold_down[R]
threshold_up[R]
unimodality[R]

Public Class Methods

new(short_header, header, description, slope, unimodality, expected = :no) click to toggle source
# File lib/genevalidator/validation_gene_merge.rb, line 23
def initialize(short_header, header, description, slope, unimodality,
               expected = :no)
  @short_header = short_header
  @header = header
  @description = description
  @slope          = slope.round(1)
  @slope          = @slope.abs if @slope == -0.0
  @unimodality    = unimodality
  @threshold_down = LOWER_THRESHOLD
  @threshold_up   = UPPER_THRESHOLD
  @result         = validation
  @expected       = expected
  @plot_files     = []
  @approach       = 'We expect the query sequence to encode a single' \
                    ' protein-coding gene. Here, we analyse the' \
                    ' High-scoring Segment Pairs (HSPs) identified by' \
                    ' BLAST to determine whether the query includes' \
                    ' sequence from two or more genes.'
  @explanation    = explain
  @conclusion     = conclude
end

Public Instance Methods

color() click to toggle source
# File lib/genevalidator/validation_gene_merge.rb, line 83
def color
  validation == :no ? 'success' : 'danger'
end
conclude() click to toggle source
# File lib/genevalidator/validation_gene_merge.rb, line 57
def conclude
  if @unimodality
    'This suggest that the query sequence represents a single gene.'
  else
    diff = @result == :yes ? ' within' : ' outside'
    t = "This slope is #{diff} our empirically calculated thresholds" \
        ' (0.4 and 1.2).'
    t << if @result == :yes
           ' This suggests the query contains sequence from two or more' \
                ' different genes.'
         else
           ' There is no evidence that the query contains sequence from' \
                ' multiple genes.'
         end
    t
  end
end
explain() click to toggle source
# File lib/genevalidator/validation_gene_merge.rb, line 45
def explain
  if @unimodality
    'The start coordinates and the end coordinates of HSPs are unimodally' \
    ' distributed.'
  else
    'The distribution of start and/or end-coordinates of HSPs are' \
    ' multi-modal. To detect potential problems we performed a linear'\
    ' regression (with coordinates weighted inversely proportionally to '\
    " hit strength). The resulting slope is #{@slope}."
  end
end
print() click to toggle source
validation() click to toggle source
# File lib/genevalidator/validation_gene_merge.rb, line 79
def validation
  @slope > threshold_down && @slope < threshold_up ? :yes : :no
end