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

- (Hit) initialize(hit_data)

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

- (Object) accession (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

- (Object) description (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

- (Object) evalue (readonly)

E-value



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

def evalue
  @evalue
end

- (Object) hsps (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

- (Object) num (readonly)

Number of domains



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

def num
  @num
end

- (Object) score (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

- (Object) append_hsp(hsp)

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

- (Object) each 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

- (Object) target_def

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