Class: GeneValidator::ORFValidationOutput

Inherits:
ValidationReport show all
Defined in:
lib/genevalidator/validation_open_reading_frame.rb

Overview

Class that stores the validation output information

Instance Attribute Summary collapse

Attributes inherited from ValidationReport

#approach, #bg_color, #conclusion, #description, #errors, #expected, #explanation, #header, #message, #plot_files, #running_time, #short_header, #validation_result

Instance Method Summary collapse

Methods inherited from ValidationReport

#color

Constructor Details

#initialize(short_header, header, description, orfs, coverage, longest_orf_frame, threshold = 80, expected = :yes) ⇒ ORFValidationOutput

Returns a new instance of ORFValidationOutput.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 13

def initialize(short_header, header, description, orfs, coverage,
               longest_orf_frame, threshold = 80, expected = :yes)
  @short_header, @header, @description = short_header, header, description

  @orfs         = orfs
  @coverage     = coverage
  @threshold    = threshold
  @expected     = expected
  @result       = validation
  @plot_files   = []
  @mainORFFrame = longest_orf_frame
  @approach     = 'We expect the query sequence to encode a single gene,' \
                  ' thus it should contain one main Open Reading Frame' \
                  ' (ORF) that occupies most of the query sequence.'
  @explanation  = " The longest ORF is in frame #{@mainORFFrame}, where" \
                  " it occupies #{(@coverage).round}% of the query" \
                  ' sequence.'
  @conclusion   = conclude
end

Instance Attribute Details

#coverageObject (readonly)

Returns the value of attribute coverage.



8
9
10
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 8

def coverage
  @coverage
end

#mainORFFrameObject (readonly)

Returns the value of attribute mainORFFrame.



10
11
12
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 10

def mainORFFrame
  @mainORFFrame
end

#orfsObject (readonly)

Returns the value of attribute orfs.



7
8
9
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 7

def orfs
  @orfs
end

#resultObject (readonly)

Returns the value of attribute result.



11
12
13
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 11

def result
  @result
end

#thresholdObject (readonly)

Returns the value of attribute threshold.



9
10
11
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 9

def threshold
  @threshold
end

Instance Method Details

#concludeObject



33
34
35
36
37
38
39
40
41
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 33

def conclude
  if @result == :yes
    'There is no evidence to believe that there is any problem with the' \
    ' ORF of the query sequence.'
  else
    'This only represents a portion of the query sequence. In some cases' \
    ' this indicates that a frame shift exists in the query sequence.'
  end
end


43
44
45
46
47
48
49
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 43

def print
  @orfs.map { |elem| elem[1].length }.reduce(:+)
  orf_list = ''
  @orfs.map { |elem| orf_list << "#{elem[0]}:#{elem[1]}," }

  "#{(@coverage).round}%&nbsp;(frame&nbsp;#{@mainORFFrame})"
end

#validationObject



51
52
53
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 51

def validation
  (@coverage > @threshold) ? :yes : :no
end