Class: Bio::LazyBlast::Report::Iteration::Hit::Hsp

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/appl/blast/lazyblastxml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reader) ⇒ Hsp

Returns a new instance of Hsp.



141
142
143
144
145
146
147
148
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 141

def initialize(reader)
  @nodes = Enumerator.new do |yielder|
    until (reader.name == "Hsp" and reader.node_type == LibXML::XML::Reader::TYPE_END_ELEMENT) or !reader.read
      yielder << reader if reader.node_type == LibXML::XML::Reader::TYPE_ELEMENT
    end
  end
  setup_hsp_values
end

Instance Attribute Details

#align_lenObject (readonly)

Returns the value of attribute align_len.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def align_len
  @align_len
end

#bit_scoreObject (readonly)

Returns the value of attribute bit_score.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def bit_score
  @bit_score
end

#densityObject (readonly)

Returns the value of attribute density.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def density
  @density
end

#evalueObject (readonly)

Returns the value of attribute evalue.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def evalue
  @evalue
end

#gapsObject (readonly)

Returns the value of attribute gaps.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def gaps
  @gaps
end

#hit_frameObject (readonly)

Returns the value of attribute hit_frame.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def hit_frame
  @hit_frame
end

#hit_fromObject (readonly)

Returns the value of attribute hit_from.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def hit_from
  @hit_from
end

#hit_toObject (readonly)

Returns the value of attribute hit_to.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def hit_to
  @hit_to
end

#hseqObject (readonly)

Returns the value of attribute hseq.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def hseq
  @hseq
end

#identityObject (readonly)

Returns the value of attribute identity.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def identity
  @identity
end

#midlineObject (readonly)

Returns the value of attribute midline.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def midline
  @midline
end

#mismatch_countObject (readonly)

Returns the value of attribute mismatch_count.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def mismatch_count
  @mismatch_count
end

#numObject (readonly)

Returns the value of attribute num.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def num
  @num
end

#percent_identityObject (readonly)

Returns the value of attribute percent_identity.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def percent_identity
  @percent_identity
end

#positiveObject (readonly)

Returns the value of attribute positive.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def positive
  @positive
end

#qseqObject (readonly)

Returns the value of attribute qseq.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def qseq
  @qseq
end

#query_frameObject (readonly)

Returns the value of attribute query_frame.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def query_frame
  @query_frame
end

#query_fromObject (readonly)

Returns the value of attribute query_from.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def query_from
  @query_from
end

#query_toObject (readonly)

Returns the value of attribute query_to.



139
140
141
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 139

def query_to
  @query_to
end

Instance Method Details

#setup_hsp_valuesObject



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/bio/appl/blast/lazyblastxml.rb', line 150

def setup_hsp_values
  @nodes.each do |node|
    case node.name
    when 'Hsp_num'
      @num = node.read_inner_xml.to_i
    when 'Hsp_bit-score'
      @bit_score = node.read_inner_xml.to_f
    when 'Hsp_evalue'
      @evalue = node.read_inner_xml.to_f
    when 'Hsp_query-from'
      @query_from = node.read_inner_xml.to_i
    when 'Hsp_query-to'
      @query_to = node.read_inner_xml.to_i
    when 'Hsp_query-frame'
      @query_frame = node.read_inner_xml.to_i
    when 'Hsp_hit-frame'
      @hit_frame = node.read_inner_xml.to_i
    when 'Hsp_identity'
      @identity = node.read_inner_xml.to_i
    when 'Hsp_positive'
      @positive = node.read_inner_xml.to_i
    when 'Hsp_align-len'
      @align_len = node.read_inner_xml.to_i
    when 'Hsp_qseq'
      @qseq = node.read_inner_xml
    when 'Hsp_hseq'
      @hseq = node.read_inner_xml
    when 'Hsp_midline'
      @midline = node.read_inner_xml
    end
  end
end