Class: GeneValidator::MakerQIValidation

Inherits:
ValidationTest show all
Defined in:
lib/genevalidator/validation_maker_qi.rb

Overview

This class contains the methods necessary for reading frame validation based on BLAST output

Instance Attribute Summary

Attributes inherited from ValidationTest

#cli_name, #description, #header, #hits, #prediction, #run_time, #short_header, #type, #validation_report

Instance Method Summary collapse

Constructor Details

#initialize(type, prediction, hits = nil) ⇒ MakerQIValidation

Returns a new instance of MakerQIValidation.



67
68
69
70
71
72
73
# File 'lib/genevalidator/validation_maker_qi.rb', line 67

def initialize(type, prediction, hits = nil)
  super
  @short_header = 'QualityIndex'
  @header       = 'Quality Index'
  @description  = 'MAKER mRNA Quality Index'
  @cli_name     = 'maker_qi'
end

Instance Method Details

#runObject

Check reading frame inconsistency Params: lst: vector of Sequence objects Output: QIValidationOutput object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/genevalidator/validation_maker_qi.rb', line 81

def run
  raise unless prediction.is_a?(Query)

  start  = Time.now

  number = '-?\d*\.?\d*'
  match  = @prediction.definition.match(/QI:#{number}\|(#{number})\|
                                         (#{number})\|#{number}\|
                                         #{number}\|#{number}\|#{number}\|
                                         #{number}\|#{number}/x)

  raise NotEnoughEvidence if match.nil?

  # % of splice sites confirmed by EST/mRNA-seq alignment
  splice_sites = (match[1].to_f * 100).round
  # % of exons that match an EST/mRNA-seq alignment
  exons = (match[2].to_f * 100).round

  @validation_report = MakerQIValidationOutput.new(@short_header, @header,
                                                   @description,
                                                   splice_sites, exons)
  @validation_report.run_time = Time.now - start
  @validation_report
rescue NotEnoughEvidence
  @validation_report = ValidationReport.new('No MAKER Quality Index',
                                            :warning, @short_header,
                                            @header, @description)
rescue StandardError
  @validation_report = ValidationReport.new('Unexpected error', :error,
                                            @short_header, @header,
                                            @description)
  @validation_report.errors.push 'Unexpected Error'
end