Class: Bio::HMMER::Report::Hit

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/appl/hmmer/report.rb

Overview

Container class for HMMER search hits.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hit_data) ⇒ Hit

Sets hit data.



391
392
393
394
395
396
397
# File 'lib/bio/appl/hmmer/report.rb', line 391

def initialize(hit_data)
  @hsps = Array.new
  if /^(\S+)\s+(.*?)\s+(\S+)\s+(\S+)\s+(\S+)$/ =~ hit_data
    @accession, @description, @score, @evalue, @num = \
    [$1, $2, $3.to_f, $4.to_f, $5.to_i]
  end
end

Instance Attribute Details

#accessionObject (readonly) Also known as: target_id, hit_id, entry_id

Returns the value of attribute accession.



371
372
373
# File 'lib/bio/appl/hmmer/report.rb', line 371

def accession
  @accession
end

#descriptionObject (readonly) Also known as: definition

Returns the value of attribute description.



377
378
379
# File 'lib/bio/appl/hmmer/report.rb', line 377

def description
  @description
end

#evalueObject (readonly)

E-value



385
386
387
# File 'lib/bio/appl/hmmer/report.rb', line 385

def evalue
  @evalue
end

#hspsObject (readonly)

An Array of Bio::HMMER::Report::Hsp objects.



368
369
370
# File 'lib/bio/appl/hmmer/report.rb', line 368

def hsps
  @hsps
end

#numObject (readonly)

Number of domains



388
389
390
# File 'lib/bio/appl/hmmer/report.rb', line 388

def num
  @num
end

#scoreObject (readonly) Also known as: bit_score

Matching scores (total of all HSPs).



381
382
383
# File 'lib/bio/appl/hmmer/report.rb', line 381

def score
  @score
end

Instance Method Details

#append_hsp(hsp) ⇒ Object

Appends a Bio::HMMER::Report::Hsp object.



419
420
421
# File 'lib/bio/appl/hmmer/report.rb', line 419

def append_hsp(hsp)
  @hsps << hsp
end

#eachObject Also known as: each_hsp

Iterates on each Hsp object (Bio::HMMER::Report::Hsp).



401
402
403
404
405
# File 'lib/bio/appl/hmmer/report.rb', line 401

def each
  @hsps.each do |hsp|
    yield hsp
  end
end

#target_defObject

Shows the hit description.



410
411
412
413
414
415
416
# File 'lib/bio/appl/hmmer/report.rb', line 410

def target_def
  if @hsps.size == 1
    "<#{@hsps[0].domain}> #{@description}"
  else
    "<#{@num.to_s}> #{@description}"
  end
end