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
483 def initialize(hsp_data, is_hmmsearch)
484   @is_hmmsearch = is_hmmsearch
485 
486   @accession, @domain, seq_f, seq_t, @seq_ft, hmm_f, hmm_t, @hmm_ft,\
487   score, evalue = hsp_data.split(' ')
488   @seq_f = seq_f.to_i
489   @seq_t = seq_t.to_i
490   @hmm_f = hmm_f.to_i
491   @hmm_t = hmm_t.to_i
492   @score = score.to_f
493   @evalue = evalue.to_f
494   @hmmseq = ''
495   @flatseq = ''
496   @midline = ''
497   @query_frame = 1
498   @target_frame = 1
499   # CS and RF lines are rarely used.
500   @csline = nil
501   @rfline = nil
502 end

Public Instance Methods

query_from() click to toggle source
    # File lib/bio/appl/hmmer/report.rb
550 def query_from
551   @is_hmmsearch ? @hmm_f   : @seq_f
552 end
query_seq() click to toggle source
    # File lib/bio/appl/hmmer/report.rb
530 def query_seq
531   @is_hmmsearch ? @hmmseq  : @flatseq
532 end
query_to() click to toggle source
    # File lib/bio/appl/hmmer/report.rb
555 def query_to
556   @is_hmmsearch ? @hmm_t   : @seq_t
557 end
set_alignment(alignment) click to toggle source
    # File lib/bio/appl/hmmer/report.rb
505 def set_alignment(alignment)
506   # First, split the input alignment into an array of
507   # "alignment blocks." One block usually has three lines,
508   # i.e. hmmseq, midline and flatseq.
509   # However, although infrequent, it can contain CS or RF lines.
510   alignment.split(/ (?:\d+|-)\s*\n\n/).each do |blk|
511     lines = blk.split(/\n/)   
512     cstmp = (lines[0] =~ /^ {16}CS/) ? lines.shift : nil
513     rftmp = (lines[0] =~ /^ {16}RF/) ? lines.shift : nil
514     aln_width = lines[0][/\S+/].length
515     @csline  = @csline.to_s + cstmp[19, aln_width] if cstmp
516     @rfline  = @rfline.to_s + rftmp[19, aln_width] if rftmp
517     @hmmseq  += lines[0][19, aln_width]
518     @midline += lines[1][19, aln_width]
519     @flatseq += lines[2][19, aln_width]
520   end
521   @csline  = @csline[3...-3] if @csline
522   @rfline  = @rfline[3...-3] if @rfline
523   @hmmseq  = @hmmseq[3...-3]
524   @midline = @midline[3...-3]
525   @flatseq = @flatseq[3...-3]
526 end
target_from() click to toggle source
    # File lib/bio/appl/hmmer/report.rb
540 def target_from
541   @is_hmmsearch ? @seq_f   : @hmm_f
542 end
target_seq() click to toggle source
    # File lib/bio/appl/hmmer/report.rb
535 def target_seq
536   @is_hmmsearch ? @flatseq : @hmmseq
537 end
target_to() click to toggle source
    # File lib/bio/appl/hmmer/report.rb
545 def target_to
546   @is_hmmsearch ? @seq_t   : @hmm_t
547 end