Class: Bio::Blast::Default::Report::Hit
- Defined in:
- lib/bio/appl/blast/format0.rb
Overview
Bio::Blast::Default::Report::Hit contains information about a hit. It may contain some Bio::Blast::Default::Report::HSP objects.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#hsps ⇒ Object
readonly
Hsp(high-scoring segment pair)s of the hit.
Instance Method Summary collapse
-
#bit_score ⇒ Object
Returns first hsp’s bit score.
-
#definition ⇒ Object
(also: #target_def)
Returns definition of the hit.
-
#each ⇒ Object
Iterates over each hsp(high-scoring segment pair) of the hit.
-
#evalue ⇒ Object
Returns first hsp’s e-value.
-
#found_again? ⇒ Boolean
(PSI-BLAST) Returns true if the hit is found again in the iteration.
-
#identity ⇒ Object
Same as hsps.first.identity.
-
#initialize(data) ⇒ Hit
constructor
Creates a new Hit object.
-
#lap_at ⇒ Object
Returns an array which contains [ query_start, query_end, target_start, target_end ].
-
#len ⇒ Object
(also: #target_len)
Returns length of the hit.
-
#midline ⇒ Object
Same as hsps.first.midline.
-
#overlap ⇒ Object
Same as hsps.first.align_len.
-
#query_end ⇒ Object
Same as hsps.first.query_to.
-
#query_seq ⇒ Object
Same as hsps.first.qseq.
-
#query_start ⇒ Object
Same as hsps.first.query_from.
-
#score ⇒ Object
Returns first hsp’s score.
-
#target_end ⇒ Object
Same as hsps.first.hit_to.
-
#target_seq ⇒ Object
Same as hsps.first.hseq.
-
#target_start ⇒ Object
Same as hsps.first.hit_from.
Constructor Details
#initialize(data) ⇒ Hit
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.
786 787 788 789 790 791 792 793 |
# File 'lib/bio/appl/blast/format0.rb', line 786 def initialize(data) @f0hitname = data.shift @hsps = [] while r = data[0] and /\A\s+Score/ =~ r @hsps << HSP.new(data) end @again = false end |
Instance Attribute Details
#hsps ⇒ Object (readonly)
Hsp(high-scoring segment pair)s of the hit. Returns an array of Bio::Blast::Default::Report::HSP objects.
797 798 799 |
# File 'lib/bio/appl/blast/format0.rb', line 797 def hsps @hsps end |
Instance Method Details
#bit_score ⇒ Object
Returns first hsp’s bit score. (shown in hit list of BLAST result)
819 820 821 822 823 824 825 826 |
# File 'lib/bio/appl/blast/format0.rb', line 819 def bit_score unless defined?(@bit_score) if h = @hsps.first then @bit_score = h.bit_score end end @bit_score end |
#definition ⇒ Object Also known as: target_def
Returns definition of the hit.
861 |
# File 'lib/bio/appl/blast/format0.rb', line 861 def definition; parse_hitname; @definition; end |
#each ⇒ Object
Iterates over each hsp(high-scoring segment pair) of the hit. Yields a Bio::Blast::Default::Report::HSP object.
801 802 803 |
# File 'lib/bio/appl/blast/format0.rb', line 801 def each @hsps.each { |x| yield x } end |
#evalue ⇒ Object
Returns first hsp’s e-value. (shown in hit list of BLAST result)
830 831 832 833 834 835 836 837 |
# File 'lib/bio/appl/blast/format0.rb', line 830 def evalue unless defined?(@evalue) if h = @hsps.first then @evalue = h.evalue end end @evalue end |
#found_again? ⇒ Boolean
(PSI-BLAST) Returns true if the hit is found again in the iteration. Otherwise, returns false or nil.
808 809 810 |
# File 'lib/bio/appl/blast/format0.rb', line 808 def found_again? @again end |
#identity ⇒ Object
Same as hsps.first.identity. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
885 |
# File 'lib/bio/appl/blast/format0.rb', line 885 def identity; hsp_first :identity; end |
#lap_at ⇒ Object
Returns an array which contains [ query_start, query_end, target_start, target_end ]. (Compatibility method with FASTA)
930 931 932 |
# File 'lib/bio/appl/blast/format0.rb', line 930 def lap_at [ query_start, query_end, target_start, target_end ] end |
#len ⇒ Object Also known as: target_len
Returns length of the hit.
858 |
# File 'lib/bio/appl/blast/format0.rb', line 858 def len; parse_hitname; @len; end |
#midline ⇒ Object
Same as hsps.first.midline. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
905 |
# File 'lib/bio/appl/blast/format0.rb', line 905 def midline; hsp_first :midline; end |
#overlap ⇒ Object
Same as hsps.first.align_len. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
890 |
# File 'lib/bio/appl/blast/format0.rb', line 890 def overlap; hsp_first :align_len; end |
#query_end ⇒ Object
Same as hsps.first.query_to. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
915 |
# File 'lib/bio/appl/blast/format0.rb', line 915 def query_end; hsp_first :query_to; end |
#query_seq ⇒ Object
Same as hsps.first.qseq. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
895 |
# File 'lib/bio/appl/blast/format0.rb', line 895 def query_seq; hsp_first :qseq; end |
#query_start ⇒ Object
Same as hsps.first.query_from. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
910 |
# File 'lib/bio/appl/blast/format0.rb', line 910 def query_start; hsp_first :query_from; end |
#score ⇒ Object
Returns first hsp’s score.
813 814 815 |
# File 'lib/bio/appl/blast/format0.rb', line 813 def score (h = @hsps.first) ? h.score : nil end |
#target_end ⇒ Object
Same as hsps.first.hit_to. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
925 |
# File 'lib/bio/appl/blast/format0.rb', line 925 def target_end; hsp_first :hit_to; end |
#target_seq ⇒ Object
Same as hsps.first.hseq. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
900 |
# File 'lib/bio/appl/blast/format0.rb', line 900 def target_seq; hsp_first :hseq; end |
#target_start ⇒ Object
Same as hsps.first.hit_from. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)
920 |
# File 'lib/bio/appl/blast/format0.rb', line 920 def target_start; hsp_first :hit_from; end |