| Class | Bio::HMMER::Report::Hsp |
| In: |
lib/bio/appl/hmmer/report.rb
|
| Parent: | Object |
Container class for HMMER search hsps.
| accession | -> | target_id |
| score | -> | bit_score |
| accession | [R] | |
| 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] |
Sets hsps.
# File lib/bio/appl/hmmer/report.rb, line 483
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
# File lib/bio/appl/hmmer/report.rb, line 550
550: def query_from
551: @is_hmmsearch ? @hmm_f : @seq_f
552: end
# File lib/bio/appl/hmmer/report.rb, line 530
530: def query_seq
531: @is_hmmsearch ? @hmmseq : @flatseq
532: end
# File lib/bio/appl/hmmer/report.rb, line 555
555: def query_to
556: @is_hmmsearch ? @hmm_t : @seq_t
557: end
# File lib/bio/appl/hmmer/report.rb, line 505
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
# File lib/bio/appl/hmmer/report.rb, line 540
540: def target_from
541: @is_hmmsearch ? @seq_f : @hmm_f
542: end
# File lib/bio/appl/hmmer/report.rb, line 535
535: def target_seq
536: @is_hmmsearch ? @flatseq : @hmmseq
537: end