Class: Bio::Blast::Default::Report::Hit

Inherits:
Object
  • Object
show all
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

Bl2seq::Report::Hit, WU::Report::Hit

Instance Attribute Summary collapse

Instance Method Summary collapse

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.


810
811
812
813
814
815
816
817
# File 'lib/bio/appl/blast/format0.rb', line 810

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

#hspsObject (readonly)

Hsp(high-scoring segment pair)s of the hit. Returns an array of Bio::Blast::Default::Report::HSP objects.


821
822
823
# File 'lib/bio/appl/blast/format0.rb', line 821

def hsps
  @hsps
end

Instance Method Details

#bit_scoreObject

Returns first hsp's bit score. (shown in hit list of BLAST result)


843
844
845
846
847
848
849
850
# File 'lib/bio/appl/blast/format0.rb', line 843

def bit_score
  unless defined?(@bit_score)
    if h = @hsps.first then
      @bit_score = h.bit_score
    end
  end
  @bit_score
end

#definitionObject Also known as: target_def

Returns definition of the hit.


885
# File 'lib/bio/appl/blast/format0.rb', line 885

def definition; parse_hitname; @definition; end

#eachObject

Iterates over each hsp(high-scoring segment pair) of the hit. Yields a Bio::Blast::Default::Report::HSP object.


825
826
827
# File 'lib/bio/appl/blast/format0.rb', line 825

def each
  @hsps.each { |x| yield x }
end

#evalueObject

Returns first hsp's e-value. (shown in hit list of BLAST result)


854
855
856
857
858
859
860
861
# File 'lib/bio/appl/blast/format0.rb', line 854

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.

Returns:

  • (Boolean)

832
833
834
# File 'lib/bio/appl/blast/format0.rb', line 832

def found_again?
  @again
end

#identityObject

Same as hsps.first.identity. 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 identity;      hsp_first :identity;     end

#lap_atObject

Returns an array which contains [ query_start, query_end, target_start, target_end ]. (Compatibility method with FASTA)


955
956
957
# File 'lib/bio/appl/blast/format0.rb', line 955

def lap_at
  [ query_start, query_end, target_start, target_end ]
end

#lenObject Also known as: target_len

Returns length of the hit.


882
# File 'lib/bio/appl/blast/format0.rb', line 882

def len;        parse_hitname; @len;        end

#midlineObject

Same as hsps.first.midline. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)


930
# File 'lib/bio/appl/blast/format0.rb', line 930

def midline;       hsp_first :midline;      end

#overlapObject

Same as hsps.first.align_len. 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 overlap;       hsp_first :align_len;    end

#query_endObject

Same as hsps.first.query_to. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)


940
# File 'lib/bio/appl/blast/format0.rb', line 940

def query_end;     hsp_first :query_to;     end

#query_seqObject

Same as hsps.first.qseq. 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 query_seq;     hsp_first :qseq;         end

#query_startObject

Same as hsps.first.query_from. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)


935
# File 'lib/bio/appl/blast/format0.rb', line 935

def query_start;   hsp_first :query_from;   end

#scoreObject

Returns first hsp's score.


837
838
839
# File 'lib/bio/appl/blast/format0.rb', line 837

def score
  (h = @hsps.first) ? h.score : nil
end

#target_endObject

Same as hsps.first.hit_to. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)


950
# File 'lib/bio/appl/blast/format0.rb', line 950

def target_end;    hsp_first :hit_to;       end

#target_idObject


887
# File 'lib/bio/appl/blast/format0.rb', line 887

def target_id; definition[/^\s*(\S+)/, 1]; end

#target_seqObject

Same as hsps.first.hseq. 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_seq;    hsp_first :hseq;         end

#target_startObject

Same as hsps.first.hit_from. Returns nil if there are no hsp in the hit. (Compatibility method with FASTA)


945
# File 'lib/bio/appl/blast/format0.rb', line 945

def target_start;  hsp_first :hit_from;     end