class GeneValidator::MakerQIValidation

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

Public Class Methods

new(type, prediction, hits = nil) click to toggle source
Calls superclass method
# 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

Public Instance Methods

run() click to toggle source

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

# 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