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, #conclusion, #description, #errors, #expected, #explanation, #header, #message, #plot_files, #run_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.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 18

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.



13
14
15
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 13

def coverage
  @coverage
end

#mainORFFrameObject (readonly)

Returns the value of attribute mainORFFrame.



15
16
17
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 15

def mainORFFrame
  @mainORFFrame
end

#orfsObject (readonly)

Returns the value of attribute orfs.



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

def orfs
  @orfs
end

#resultObject (readonly)

Returns the value of attribute result.



16
17
18
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 16

def result
  @result
end

#thresholdObject (readonly)

Returns the value of attribute threshold.



14
15
16
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 14

def threshold
  @threshold
end

Instance Method Details

#concludeObject



38
39
40
41
42
43
44
45
46
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 38

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


48
49
50
51
52
53
54
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 48

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



56
57
58
# File 'lib/genevalidator/validation_open_reading_frame.rb', line 56

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