Class: GeneValidator::DuplicationValidationOutput

Inherits:
ValidationReport show all
Defined in:
lib/genevalidator/validation_duplication.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

Constructor Details

#initialize(short_header, header, description, pvalue, averages, threshold = 0.05, expected = :yes) ⇒ DuplicationValidationOutput

Returns a new instance of DuplicationValidationOutput.



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

def initialize(short_header, header, description, pvalue, averages,
               threshold = 0.05, expected = :yes)
  @short_header = short_header
  @header = header
  @description = description
  @pvalue      = pvalue
  @threshold   = threshold
  @result      = validation
  @expected    = expected
  @average     = averages.mean
  @approach    = 'We expect each BLAST hit to match each region of the' \
                 ' query at most once. Here, we calculate the' \
                 ' distribution of hit coverage against the query' \
                 ' sequence and use the Wilcoxon test to determine if it' \
                 ' is higher than 1.'
  @explanation = explain
  @conclusion  = conclude
end

Instance Attribute Details

#averageObject (readonly)

Returns the value of attribute average.



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

def average
  @average
end

#pvalueObject (readonly)

Returns the value of attribute pvalue.



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

def pvalue
  @pvalue
end

#resultObject (readonly)

Returns the value of attribute result.



18
19
20
# File 'lib/genevalidator/validation_duplication.rb', line 18

def result
  @result
end

#thresholdObject (readonly)

Returns the value of attribute threshold.



17
18
19
# File 'lib/genevalidator/validation_duplication.rb', line 17

def threshold
  @threshold
end

Instance Method Details

#colorObject



62
63
64
# File 'lib/genevalidator/validation_duplication.rb', line 62

def color
  validation == :yes ? 'success' : 'danger'
end

#concludeObject



44
45
46
47
48
49
50
51
52
# File 'lib/genevalidator/validation_duplication.rb', line 44

def conclude
  if @result == :yes
    'This suggests that the query sequence contains no erroneous' \
    ' duplications.'
  else
    'The null hypothesis is rejected - thus a region of the query' \
    ' sequence is likely repeated more than once.'
  end
end

#explainObject



39
40
41
42
# File 'lib/genevalidator/validation_duplication.rb', line 39

def explain
  "The Wilcoxon test produced a p-value of #{prettify_evalue(@pvalue)}" \
  "#{@result == :no ? " (average = #{@average.round(2)})." : '.'}"
end


54
55
56
# File 'lib/genevalidator/validation_duplication.rb', line 54

def print
  @pvalue.round(2).to_s
end

#validationObject



58
59
60
# File 'lib/genevalidator/validation_duplication.rb', line 58

def validation
  @pvalue > @threshold ? :yes : :no
end