Class: SequenceServer::BLAST::HSP

Inherits:
Struct
  • Object
show all
Defined in:
lib/sequenceserver/blast/hsp.rb

Overview

Structure to hold data for each HSP.

Constant Summary collapse

INTEGER_ARGS =
[1, 3].concat((5..15).to_a).freeze
FLOAT_ARGS =
[2, 4].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ HSP



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sequenceserver/blast/hsp.rb', line 11

def initialize(*args)
  INTEGER_ARGS.each do |i|
    args[i] = args[i].to_i
  end

  FLOAT_ARGS.each do |i|
    args[i] = args[i].to_f
  end

  super
end

Instance Attribute Details

#bit_scoreObject

Returns the value of attribute bit_score



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def bit_score
  @bit_score
end

#evalueObject

Returns the value of attribute evalue



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def evalue
  @evalue
end

#gapsObject

Returns the value of attribute gaps



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def gaps
  @gaps
end

#hitObject

Returns the value of attribute hit



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def hit
  @hit
end

#identityObject

Returns the value of attribute identity



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def identity
  @identity
end

#lengthObject

Returns the value of attribute length



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def length
  @length
end

#midlineObject

Returns the value of attribute midline



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def midline
  @midline
end

#numberObject

Returns the value of attribute number



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def number
  @number
end

#positivesObject

Returns the value of attribute positives



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def positives
  @positives
end

#qcovhspObject

Returns the value of attribute qcovhsp



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def qcovhsp
  @qcovhsp
end

#qendObject

Returns the value of attribute qend



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def qend
  @qend
end

#qframeObject

Returns the value of attribute qframe



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def qframe
  @qframe
end

#qseqObject

Returns the value of attribute qseq



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def qseq
  @qseq
end

#qstartObject

Returns the value of attribute qstart



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def qstart
  @qstart
end

#scoreObject

Returns the value of attribute score



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def score
  @score
end

#sendObject

Returns the value of attribute send



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def send
  @send
end

#sframeObject

Returns the value of attribute sframe



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def sframe
  @sframe
end

#sseqObject

Returns the value of attribute sseq



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def sseq
  @sseq
end

#sstartObject

Returns the value of attribute sstart



5
6
7
# File 'lib/sequenceserver/blast/hsp.rb', line 5

def sstart
  @sstart
end

Instance Method Details

#to_json(*args) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/sequenceserver/blast/hsp.rb', line 23

def to_json(*args)
  i[number bit_score score evalue qstart qend
     sstart send qframe sframe identity positives
     gaps length qcovhsp qseq sseq midline].inject({}) { |h, k|
    h[k] = self[k]
    h
  }.to_json(*args)
end