Class: BioMummer::Alignment
- Inherits:
-
Object
- Object
- BioMummer::Alignment
- Defined in:
- lib/bio-mummer/mummer.rb
Instance Attribute Summary collapse
-
#distances ⇒ Object
Returns the value of attribute distances.
-
#qryname ⇒ Object
Returns the value of attribute qryname.
-
#qrystart ⇒ Object
Returns the value of attribute qrystart.
-
#qrystop ⇒ Object
Returns the value of attribute qrystop.
-
#refname ⇒ Object
Returns the value of attribute refname.
-
#refstart ⇒ Object
Returns the value of attribute refstart.
-
#refstop ⇒ Object
Returns the value of attribute refstop.
-
#strand ⇒ Object
Returns the value of attribute strand.
Instance Method Summary collapse
- #deltas ⇒ Object
-
#initialize(refname, qryname, refstart, refstop, qrystart, qrystop, strand, distances) ⇒ Alignment
constructor
A new instance of Alignment.
- #ref_to_query(ref_position) ⇒ Object
Constructor Details
#initialize(refname, qryname, refstart, refstop, qrystart, qrystop, strand, distances) ⇒ Alignment
Returns a new instance of Alignment.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/bio-mummer/mummer.rb', line 8 def initialize(refname, qryname, refstart, refstop, qrystart, qrystop, strand, distances) @refname = refname @qryname = qryname @refstart = refstart @refstop = refstop @qrystart = qrystart @qrystop = qrystop @strand = strand @distances = distances end |
Instance Attribute Details
#distances ⇒ Object
Returns the value of attribute distances.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def distances @distances end |
#qryname ⇒ Object
Returns the value of attribute qryname.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def qryname @qryname end |
#qrystart ⇒ Object
Returns the value of attribute qrystart.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def qrystart @qrystart end |
#qrystop ⇒ Object
Returns the value of attribute qrystop.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def qrystop @qrystop end |
#refname ⇒ Object
Returns the value of attribute refname.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def refname @refname end |
#refstart ⇒ Object
Returns the value of attribute refstart.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def refstart @refstart end |
#refstop ⇒ Object
Returns the value of attribute refstop.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def refstop @refstop end |
#strand ⇒ Object
Returns the value of attribute strand.
6 7 8 |
# File 'lib/bio-mummer/mummer.rb', line 6 def strand @strand end |
Instance Method Details
#deltas ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bio-mummer/mummer.rb', line 19 def deltas ds = [] a = @distances.each_with_object([0]) do |d, arr| state = arr.last if d > 0 ds += Array.new(d - 1, state) ds.push(nil) arr << state - 1 else ds += Array.new(d * -1 - 1, state) arr << state + 1 end end ds << a.last return ds end |
#ref_to_query(ref_position) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bio-mummer/mummer.rb', line 36 def ref_to_query(ref_position) position_in_alignment = ref_position - refstart + 1 qrypos = nil if position_in_alignment >= deltas.length qrypos = @qrystart - 1 + position_in_alignment + deltas.last elsif deltas[position_in_alignment-1] qrypos = @qrystart - 1 + position_in_alignment + deltas[position_in_alignment-1] end !@strand && qrypos ? @qrystart + @qrystop - qrypos : qrypos end |