Class: BlastRFValidationOutput

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

Overview

Class that stores the validation output information

Instance Attribute Summary (collapse)

Attributes inherited from ValidationReport

#bg_color, #errors, #expected, #message, #plot_files, #result, #validation_result

Instance Method Summary (collapse)

Methods inherited from ValidationReport

#color

Constructor Details

- (BlastRFValidationOutput) initialize(frames_histo, expected = :yes)

Returns a new instance of BlastRFValidationOutput



10
11
12
13
14
15
16
17
18
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 10

def initialize (frames_histo, expected = :yes)
  @frames_histo = frames_histo
  @msg = ""
  frames_histo.each do |x, y|
    @msg << "#{x}:#{y}; "      
  end
  @expected = expected
  @result = validation
end

Instance Attribute Details

- (Object) frames_histo (readonly)

Returns the value of attribute frames_histo



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

def frames_histo
  @frames_histo
end

- (Object) msg (readonly)

Returns the value of attribute msg



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

def msg
  @msg
end

Instance Method Details



20
21
22
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 20

def print
  @msg
end

- (Object) validation



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/genevalidator/validation_blast_reading_frame.rb', line 24

def validation
  # if there are different reading frames of the same sign
  # count for positive reading frames
  count_p = 0
  count_n = 0
  frames_histo.each do |x, y|
    if x > 0
      count_p += 1
    else
      if x < 0
        count_n += 1
      end
    end
  end

  if count_p > 1 or count_n > 1
    :no
  else
    :yes
  end

end