class Bio::Blast::Default::Report::Hit
Bio::Blast::Default::Report::Hit contains information about a hit. It may contain some Bio::Blast::Default::Report::HSP objects.
Attributes
Hsp(high-scoring segment pair)s of the hit. Returns an array of Bio::Blast::Default::Report::HSP objects.
Public Class Methods
Creates a new Hit object. It is designed to be called only internally from the Bio::Blast::Default::Report::Iteration class. Users should not call the method directly.
# File lib/bio/appl/blast/format0.rb, line 792 def initialize(data) @f0hitname = data.shift @hsps = [] while r = data[0] and /\A\s+Score/ =~ r @hsps << HSP.new(data) end @again = false end
Public Instance Methods
Returns first hsp's bit score. (shown in hit list of BLAST result)
# File lib/bio/appl/blast/format0.rb, line 825 def bit_score unless defined?(@bit_score) if h = @hsps.first then @bit_score = h.bit_score end end @bit_score end
Returns definition of the hit.
# File lib/bio/appl/blast/format0.rb, line 867 def definition; parse_hitname; @definition; end
Iterates over each hsp(high-scoring segment pair) of the hit. Yields a Bio::Blast::Default::Report::HSP object.
# File lib/bio/appl/blast/format0.rb, line 807 def each @hsps.each { |x| yield x } end
Returns first hsp's e-value. (shown in hit list of BLAST result)
# File lib/bio/appl/blast/format0.rb, line 836 def evalue unless defined?(@evalue) if h = @hsps.first then @evalue = h.evalue end end @evalue end
(PSI-BLAST) Returns true if the hit is found again in the iteration. Otherwise, returns false or nil.
# File lib/bio/appl/blast/format0.rb, line 814 def found_again? @again end
Same as hsps.first.identity. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 892 def identity; hsp_first :identity; end
Returns an array which contains [ #query_start, #query_end, #target_start, #target_end ]. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 937 def lap_at [ query_start, query_end, target_start, target_end ] end
Returns length of the hit.
# File lib/bio/appl/blast/format0.rb, line 864 def len; parse_hitname; @len; end
Same as hsps.first.midline. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 912 def midline; hsp_first :midline; end
Same as hsps.first.align_len. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 897 def overlap; hsp_first :align_len; end
Same as hsps.first.query_to. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 922 def query_end; hsp_first :query_to; end
Same as hsps.first.qseq. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 902 def query_seq; hsp_first :qseq; end
Same as hsps.first.query_from. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 917 def query_start; hsp_first :query_from; end
Returns first hsp's score.
# File lib/bio/appl/blast/format0.rb, line 819 def score (h = @hsps.first) ? h.score : nil end
Same as hsps.first.hit_to. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 932 def target_end; hsp_first :hit_to; end
# File lib/bio/appl/blast/format0.rb, line 869 def target_id; definition[/^\s*(\S+)/, 1]; end
Same as hsps.first.hseq. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 907 def target_seq; hsp_first :hseq; end
Same as hsps.first.hit_from. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
# File lib/bio/appl/blast/format0.rb, line 927 def target_start; hsp_first :hit_from; end
Private Instance Methods
Sends given method to the first hsp or returns nil if there are no hsps.
# File lib/bio/appl/blast/format0.rb, line 879 def hsp_first(m) (h = hsps.first) ? h.send(m) : nil end
Parses name of the hit.
# File lib/bio/appl/blast/format0.rb, line 846 def parse_hitname unless defined?(@parse_hitname) sc = StringScanner.new(@f0hitname) sc.skip(/\s*/) sc.skip(/\>/) d = [] begin d << sc.scan(/.*/) sc.skip(/\s*/) end until !sc.rest? or r = sc.skip(/ *Length *\= *([\,\d]+)\s*\z/) @len = (r ? sc[1].delete(',').to_i : nil) @definition = d.join(" ") @parse_hitname = true end end