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.



59
60
61
62
63
64
65
# File 'lib/genevalidator/validation_maker_qi.rb', line 59

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



73
74
75
76
77
78
79
80
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
# File 'lib/genevalidator/validation_maker_qi.rb', line 73

def run
  fail 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)

  fail 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('Not enough evidence',
                                             :warning, @short_header,
                                             @header, @description)
rescue
  @validation_report = ValidationReport.new('Unexpected error', :error,
                                            @short_header, @header,
                                            @description)
  @validation_report.errors.push 'Unexpected Error'
end