Class: BlastHit
- Inherits:
-
Object
- Object
- BlastHit
- Defined in:
- lib/rocker/blasthit.rb
Overview
Instance Attribute Summary collapse
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
-
#istrue ⇒ Object
readonly
Returns the value of attribute istrue.
-
#midpoint ⇒ Object
readonly
Returns the value of attribute midpoint.
-
#sbj ⇒ Object
readonly
Returns the value of attribute sbj.
-
#sfrom ⇒ Object
readonly
Returns the value of attribute sfrom.
-
#sto ⇒ Object
readonly
Returns the value of attribute sto.
Instance Method Summary collapse
-
#initialize(ln, aln = nil) ⇒ BlastHit
constructor
Initialize from BLAST using new(ln,aln), initialize from TABLE using new(ln).
- #to_s ⇒ Object
Constructor Details
#initialize(ln, aln = nil) ⇒ BlastHit
Initialize from BLAST using new(ln,aln), initialize from TABLE using new(ln)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rocker/blasthit.rb', line 11 def initialize(ln, aln=nil) l = ln.chomp.split(/\t/) if aln.nil? @sbj = l[0] @sfrom = l[1].to_i @sto = l[2].to_i @bits = l[3].to_f @istrue = l[4]=='1' @midpoint = l[5].to_i else s = aln.seq(l[1]) return nil if s.nil? @sbj = s.id a = s.pos2col(l[8].to_i) b = s.pos2col(l[9].to_i) @sfrom = [a,b].min @sto = [a,b].max @bits = l[11].to_f @istrue = ! /@%/.match(l[0]).nil? @midpoint = s.pos2col(((l[8].to_f+l[9].to_f)/2).ceil) end end |
Instance Attribute Details
#bits ⇒ Object (readonly)
Returns the value of attribute bits.
9 10 11 |
# File 'lib/rocker/blasthit.rb', line 9 def bits @bits end |
#istrue ⇒ Object (readonly)
Returns the value of attribute istrue.
9 10 11 |
# File 'lib/rocker/blasthit.rb', line 9 def istrue @istrue end |
#midpoint ⇒ Object (readonly)
Returns the value of attribute midpoint.
9 10 11 |
# File 'lib/rocker/blasthit.rb', line 9 def midpoint @midpoint end |
#sbj ⇒ Object (readonly)
Returns the value of attribute sbj.
9 10 11 |
# File 'lib/rocker/blasthit.rb', line 9 def sbj @sbj end |
#sfrom ⇒ Object (readonly)
Returns the value of attribute sfrom.
9 10 11 |
# File 'lib/rocker/blasthit.rb', line 9 def sfrom @sfrom end |
#sto ⇒ Object (readonly)
Returns the value of attribute sto.
9 10 11 |
# File 'lib/rocker/blasthit.rb', line 9 def sto @sto end |
Instance Method Details
#to_s ⇒ Object
33 34 35 36 37 |
# File 'lib/rocker/blasthit.rb', line 33 def to_s self.sbj.nil? ? "" : [self.sbj, self.sfrom.to_s, self.sto.to_s, self.bits.to_s, self.istrue ? '1' : '0', self.midpoint].join("\t") + "\n" end |