class MgNu::Parser::Blast::Hsp
Attributes
bit_score[RW]
evalue[RW]
gap_count[RW]
identity[RW]
length[RW]
midline[RW]
mismatches[RW]
number[RW]
positive[RW]
query[RW]
query_frame[RW]
query_from[RW]
query_sequence[RW]
query_to[RW]
sbjct[RW]
sbjct_frame[RW]
sbjct_from[RW]
sbjct_sequence[RW]
sbjct_to[RW]
score[RW]
Public Class Methods
new()
click to toggle source
create a new Hsp
object
# File lib/mgnu/parser/blast/hsp.rb, line 13 def initialize @number = nil @bit_score = nil @score = nil @evalue = nil @query_from = nil @query_to = nil @sbjct_from = nil @sbjct_to = nil @query_frame = nil @sbjct_frame = nil @identity = nil @positive = nil @length = nil @query_sequence = "" @sbjct_sequence = "" @midline = "" @gap_count = nil @mismatches = nil @sbjct = nil @query = nil end
Public Instance Methods
query_frameshifts()
click to toggle source
# File lib/mgnu/parser/blast/hsp.rb, line 36 def query_frameshifts if @query_sequence =~ /(?:\/|\\)/ loc2frame = Hash.new re = /[\/\\]{1,2}/ re.global_match(@query_sequence.gsub(/[- ]/,'')) do |m| frame = nil # m.begin(0) is location of char match # (m.begin(0) - 1) * 3 is the length of the coding dna # up to the (but not including) the char match # (m.begin(0) - 1) * 3 + @query_from - 1 is the corrected # position taking into account the start of the query # sequence. query_from is reported in nt if @query_from > @query_to location = @query_from - (m.begin(0) * 3 - 1) else location = (m.begin(0) * 3 - 1) + @query_from end case m[0] when '/' frame = 1 when '//' frame = 2 when '\\' frame = -1 when '\\\\' frame = -2 end loc2frame[location] = frame end # end re.global_match return loc2frame else return nil end # end if @query_sequence =~ /(?:\/|\\)/ end