class Bio::Fasta::Report::Hit

Attributes

definition[R]
query[R]
score[R]
target[R]

Public Class Methods

new(data) click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 201
def initialize(data)
  score, query, target = data.split(/\n>/)

  @definition, *score = score.split(/\n/)
  @score = {}

  pat = /;\s+([^:]+):\s+(.*)/

  score.each do |x|
    if pat.match(x)
      @score[$1] = $2
    end
  end

  @query = Query.new(query)
  @target = Target.new(target)
end

Public Instance Methods

bit_score() click to toggle source

Bit score

# File lib/bio/appl/fasta/format10.rb, line 234
def bit_score
  if @score['fa_bits']
    @score['fa_bits'].to_f
  elsif @score['sw_bits']
    @score['sw_bits'].to_f
  elsif @score['fx_bits']
    @score['fx_bits'].to_f
  elsif @score['tx_bits']
    @score['tx_bits'].to_f
  end
end
direction() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 246
def direction
  @score['fa_frame'] || @score['sw_frame'] || @score['fx_frame'] || @score['tx_frame']
end
evalue() click to toggle source

E-value score

# File lib/bio/appl/fasta/format10.rb, line 221
def evalue
  if @score['fa_expect']
    @score['fa_expect'].to_f
  elsif @score['sw_expect']
    @score['sw_expect'].to_f
  elsif @score['fx_expect']
    @score['fx_expect'].to_f
  elsif @score['tx_expect']
    @score['tx_expect'].to_f
  end
end
identity() click to toggle source

percent identity

# File lib/bio/appl/fasta/format10.rb, line 256
def identity
  @score['sw_ident'].to_f
end
lap_at() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 327
def lap_at
  [ query_start, query_end, target_start, target_end ]
end
overlap() click to toggle source

overlap length

# File lib/bio/appl/fasta/format10.rb, line 261
def overlap
  @score['sw_overlap'].to_i
end
query_def() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 275
def query_def
  @query.definition
end
query_end() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 315
def query_end
  @query.stop
end
query_id() click to toggle source

Shortcuts for the methods of Bio::Fasta::Report::Hit::Query

# File lib/bio/appl/fasta/format10.rb, line 267
def query_id
  @query.entry_id
end
query_len() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 283
def query_len
  @query.length
end
query_seq() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 293
def query_seq
  @query.sequence
end
query_start() click to toggle source

Information on matching region

# File lib/bio/appl/fasta/format10.rb, line 311
def query_start
  @query.start
end
query_type() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 301
def query_type
  @query.moltype
end
sw() click to toggle source

Smith-Waterman score

# File lib/bio/appl/fasta/format10.rb, line 251
def sw
  @score['sw_score'].to_i
end
target_def() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 279
def target_def
  @target.definition
end
target_end() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 323
def target_end
  @target.stop
end
target_id() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 271
def target_id
  @target.entry_id
end
target_len() click to toggle source

Shortcuts for the methods of Bio::Fasta::Report::Hit::Target

# File lib/bio/appl/fasta/format10.rb, line 289
def target_len
  @target.length
end
target_seq() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 297
def target_seq
  @target.sequence
end
target_start() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 319
def target_start
  @target.start
end
target_type() click to toggle source
# File lib/bio/appl/fasta/format10.rb, line 305
def target_type
  @target.moltype
end