class Bio::HMMER::Report::Hsp

Container class for HMMER search hsps.

Attributes

accession[R]
bit_score[R]

Score

csline[R]

CS Line

domain[R]
evalue[R]

E-value

flatseq[R]
hmm_f[R]
hmm_ft[R]
hmm_t[R]
hmmseq[R]
midline[R]

Alignment midline

query_frame[R]
rfline[R]

RF Line

score[R]

Score

seq_f[R]
seq_ft[R]
seq_t[R]
target_frame[R]
target_id[R]

Public Class Methods

new(hsp_data, is_hmmsearch) click to toggle source

Sets hsps.

# File lib/bio/appl/hmmer/report.rb, line 483
def initialize(hsp_data, is_hmmsearch)
  @is_hmmsearch = is_hmmsearch

  @accession, @domain, seq_f, seq_t, @seq_ft, hmm_f, hmm_t, @hmm_ft,         score, evalue = hsp_data.split(' ')
  @seq_f = seq_f.to_i
  @seq_t = seq_t.to_i
  @hmm_f = hmm_f.to_i
  @hmm_t = hmm_t.to_i
  @score = score.to_f
  @evalue = evalue.to_f
  @hmmseq = ''
  @flatseq = ''
  @midline = ''
  @query_frame = 1
  @target_frame = 1
  # CS and RF lines are rarely used.
  @csline = nil
  @rfline = nil
end

Public Instance Methods

query_from() click to toggle source
# File lib/bio/appl/hmmer/report.rb, line 550
def query_from
  @is_hmmsearch ? @hmm_f   : @seq_f
end
query_seq() click to toggle source
# File lib/bio/appl/hmmer/report.rb, line 530
def query_seq
  @is_hmmsearch ? @hmmseq  : @flatseq
end
query_to() click to toggle source
# File lib/bio/appl/hmmer/report.rb, line 555
def query_to
  @is_hmmsearch ? @hmm_t   : @seq_t
end
set_alignment(alignment) click to toggle source
# File lib/bio/appl/hmmer/report.rb, line 505
def set_alignment(alignment)
  # First, split the input alignment into an array of
  # "alignment blocks." One block usually has three lines,
  # i.e. hmmseq, midline and flatseq. 
  # However, although infrequent, it can contain CS or RF lines.
  alignment.split(/ (?:\d+|-)\s*\n\n/).each do |blk|
    lines = blk.split(/\n/)   
    cstmp = (lines[0] =~ /^ {16}CS/) ? lines.shift : nil
    rftmp = (lines[0] =~ /^ {16}RF/) ? lines.shift : nil
    aln_width = lines[0][/\S+/].length
    @csline  = @csline.to_s + cstmp[19, aln_width] if cstmp
    @rfline  = @rfline.to_s + rftmp[19, aln_width] if rftmp
    @hmmseq  += lines[0][19, aln_width]
    @midline += lines[1][19, aln_width]
    @flatseq += lines[2][19, aln_width]
  end
  @csline  = @csline[3...-3] if @csline
  @rfline  = @rfline[3...-3] if @rfline
  @hmmseq  = @hmmseq[3...-3]
  @midline = @midline[3...-3]
  @flatseq = @flatseq[3...-3]
end
target_from() click to toggle source
# File lib/bio/appl/hmmer/report.rb, line 540
def target_from
  @is_hmmsearch ? @seq_f   : @hmm_f
end
target_seq() click to toggle source
# File lib/bio/appl/hmmer/report.rb, line 535
def target_seq
  @is_hmmsearch ? @flatseq : @hmmseq
end
target_to() click to toggle source
# File lib/bio/appl/hmmer/report.rb, line 545
def target_to
  @is_hmmsearch ? @seq_t   : @hmm_t
end