Class: CRB_Blast::Hit

Inherits:
Object
  • Object
show all
Defined in:
lib/crb-blast/hit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list, qprot, tprot) ⇒ Hit

Returns a new instance of Hit.

Raises:

  • (RuntimeError)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/crb-blast/hit.rb', line 9

def initialize(list, qprot, tprot)
  raise(RuntimeError, "unexpected number of columns") if list.length < 14
  @query      = list[0].split(/[\|\ ]/).first
  @target     = list[1].split(/[\|\ ]/).first
  @id         = list[2]
  @alnlen     = list[3].to_i
  @mismatches = list[4].to_i
  @gaps       = list[5].to_i
  @qstart     = list[6].to_i
  @qend       = list[7].to_i
  @tstart     = list[8].to_i
  @tend       = list[9].to_i
  @evalue     = list[10].to_f
  @bitscore   = list[11].to_f
  @qlen       = list[12].to_f
  @tlen       = list[13].to_f
  @qprot      = qprot # bool
  @tprot      = tprot # bool
end

Instance Attribute Details

#alnlenObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def alnlen
  @alnlen
end

#bitscoreObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def bitscore
  @bitscore
end

#evalueObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def evalue
  @evalue
end

#gapsObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def gaps
  @gaps
end

#idObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def id
  @id
end

#mismatchesObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def mismatches
  @mismatches
end

#qendObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def qend
  @qend
end

#qlenObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def qlen
  @qlen
end

#qprotObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def qprot
  @qprot
end

#qstartObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def qstart
  @qstart
end

#queryObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def query
  @query
end

#targetObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def target
  @target
end

#tendObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def tend
  @tend
end

#tlenObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def tlen
  @tlen
end

#tprotObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def tprot
  @tprot
end

#tstartObject

Fields: query id, subject id, % identity, alignment length, mismatches, gap opens, q. start, q. end, s. start, s. end, evalue, bit score



6
7
8
# File 'lib/crb-blast/hit.rb', line 6

def tstart
  @tstart
end

Instance Method Details

#to_sObject



29
30
31
32
33
# File 'lib/crb-blast/hit.rb', line 29

def to_s
  s = "#{@query}\t#{@target}\t#{@id}\t#{@alnlen}\t#{@evalue}\t#{@bitscore}\t"
  s << "#{@qstart}..#{@qend}\t#{@tstart}..#{@tend}\t#{@qlen}\t#{@tlen}"
  return s
end