class MgNu::Parser::Blast::Sbjct

Attributes

accession[RW]
definition[RW]
hsps[RW]
length[RW]
number[RW]
query[RW]
sbjct_id[RW]

Public Class Methods

new() click to toggle source

create a new Sbjct object

# File lib/mgnu/parser/blast/sbjct.rb, line 11
def initialize
  @number = nil
  @sbjct_id = ""
  @definition = ""
  @length = nil
  @accession = ""
  @hsps = []
  @best_hsp = nil
  @query = nil
end

Public Instance Methods

best_hsp() click to toggle source

searches hsps and looks for the best and sets the instance variable

# File lib/mgnu/parser/blast/sbjct.rb, line 44
def best_hsp
  if @best_hsp.nil?
    if @hsps.length > 0 # have some hsps for this hit
      temp_best = @hsps[0]
      @hsps.each do |h|
        if h.evalue < temp_best.evalue
          temp_best = h
        end
      end
      @best_hsp = temp_best
    end
  end
  @best_hsp
end
bit_score() click to toggle source

searches hsps and looks for the best and returns it's bit_score

# File lib/mgnu/parser/blast/sbjct.rb, line 30
def bit_score
  # call the best_hsp method and see if result is nil
  best_hsp.nil? ? nil : @best_hsp.bit_score
end
evalue() click to toggle source

searches hsps and looks for the best and returns it's evalue

# File lib/mgnu/parser/blast/sbjct.rb, line 23
def evalue
  # call the best_hsp method and see if result is nil
  best_hsp.nil? ? nil : @best_hsp.evalue
end
identity() click to toggle source

searches hsps and looks for the best and returns it's identity

# File lib/mgnu/parser/blast/sbjct.rb, line 37
def identity
  # call the best_hsp method and see if result is nil
  best_hsp.nil? ? nil : @best_hsp.identity
end