Class: GeneValidator::Hsp

Inherits:
Object
  • Object
show all
Defined in:
lib/genevalidator/hsp.rb

Overview

A class that initialises the BLAST tabular attributes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHsp

Returns a new instance of Hsp.



26
27
28
29
# File 'lib/genevalidator/hsp.rb', line 26

def initialize
  @query_alignment = nil
  @hit_alignment   = nil
end

Instance Attribute Details

#align_lenObject

Returns the value of attribute align_len.



24
25
26
# File 'lib/genevalidator/hsp.rb', line 24

def align_len
  @align_len
end

#bit_scoreObject

positive (mis)matches with +, mismatches and gaps are with space



17
18
19
# File 'lib/genevalidator/hsp.rb', line 17

def bit_score
  @bit_score
end

#gapsObject

Returns the value of attribute gaps.



23
24
25
# File 'lib/genevalidator/hsp.rb', line 23

def gaps
  @gaps
end

#hit_alignmentObject

Returns the value of attribute hit_alignment.



12
13
14
# File 'lib/genevalidator/hsp.rb', line 12

def hit_alignment
  @hit_alignment
end

#hit_fromObject

ref. from the unaligned hit sequence



7
8
9
# File 'lib/genevalidator/hsp.rb', line 7

def hit_from
  @hit_from
end

#hit_toObject

Returns the value of attribute hit_to.



8
9
10
# File 'lib/genevalidator/hsp.rb', line 8

def hit_to
  @hit_to
end

#hsp_evalueObject

Returns the value of attribute hsp_evalue.



19
20
21
# File 'lib/genevalidator/hsp.rb', line 19

def hsp_evalue
  @hsp_evalue
end

#hsp_scoreObject

Returns the value of attribute hsp_score.



18
19
20
# File 'lib/genevalidator/hsp.rb', line 18

def hsp_score
  @hsp_score
end

#identityObject

number of conserved residues



20
21
22
# File 'lib/genevalidator/hsp.rb', line 20

def identity
  @identity
end

#match_query_fromObject

ref. from the unaligned query sequence



9
10
11
# File 'lib/genevalidator/hsp.rb', line 9

def match_query_from
  @match_query_from
end

#match_query_toObject

Returns the value of attribute match_query_to.



10
11
12
# File 'lib/genevalidator/hsp.rb', line 10

def match_query_to
  @match_query_to
end

#middlesObject

conserved residues are with letters,



14
15
16
# File 'lib/genevalidator/hsp.rb', line 14

def middles
  @middles
end

#pidentityObject

percentage of identical matches



21
22
23
# File 'lib/genevalidator/hsp.rb', line 21

def pidentity
  @pidentity
end

#positiveObject

positive score for the (mis)match



22
23
24
# File 'lib/genevalidator/hsp.rb', line 22

def positive
  @positive
end

#query_alignmentObject

Returns the value of attribute query_alignment.



13
14
15
# File 'lib/genevalidator/hsp.rb', line 13

def query_alignment
  @query_alignment
end

#query_reading_frameObject

Returns the value of attribute query_reading_frame.



11
12
13
# File 'lib/genevalidator/hsp.rb', line 11

def query_reading_frame
  @query_reading_frame
end

Instance Method Details

#assert_seq_type(query) ⇒ Object



53
54
55
56
# File 'lib/genevalidator/hsp.rb', line 53

def assert_seq_type(query)
  seq_type = BlastUtils.guess_sequence_type(query)
  fail SequenceTypeError if seq_type != :protein
end

#init_tabular_attribute(hash) ⇒ Object

Initializes the corresponding attribute of the hsp with respect to the column name of the tabular blast output Params: column: String with column name. value: Value of the column



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/genevalidator/hsp.rb', line 37

def init_tabular_attribute(hash)
  @match_query_from    = hash['qstart'].to_i if hash['qstart']
  @match_query_to      = hash['qend'].to_i if hash['qend']
  @query_reading_frame = hash['qframe'].to_i if hash['qframe']
  @hit_from            = hash['sstart'].to_i if hash['sstart']
  @hit_to              = hash['send'].to_i if hash['send']
  @query_alignment     = hash['qseq'] if hash['qseq']
  @hit_alignment       = hash['sseq'] if hash['sseq']
  @align_len           = hash['length'].to_i if hash['length']
  @pidentity           = hash['pident'].to_f if hash['pident']
  @identity            = hash['nident'].to_f if hash['nident']
  @hsp_evalue          = hash['evalue'].to_f if hash['evalue']
  assert_seq_type(@query_alignment) if hash['sseq']
  assert_seq_type(@hit_alignment) if hash['sseq']
end