Class: LibSSW::Align
- Inherits:
-
FFI::Align
- Object
- FFI::Align
- LibSSW::Align
- Defined in:
- lib/libssw/align.rb
Overview
structure of the alignment result
Instance Attribute Summary collapse
-
#cigar ⇒ Array
readonly
Best alignment cigar; stored the same as that in BAM format, high 28 bits: length, low 4 bits: M/I/D (0/1/2); cigar = 0 when the best alignment path is not available.
-
#cigar_len ⇒ Integer
Length of the cigar string; cigarLen = 0 when the best alignment path is not available.
-
#read_begin1 ⇒ Integer
0-based best alignment beginning position on read; read_begin1 = -1 when the best alignment beginning position is not available.
-
#read_end1 ⇒ Integer
0-based best alignment ending position on read.
-
#read_end2 ⇒ Integer
0-based sub-optimal alignment ending position on read.
-
#ref_begin1 ⇒ Integer
0-based best alignment beginning position on reference; ref_begin1 = -1 when the best alignment beginning position is not available.
-
#ref_end1 ⇒ Integer
0-based best alignment ending position on reference.
-
#score1 ⇒ Integer
The best alignment score.
-
#score2 ⇒ Integer
Sub-optimal alignment score.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ptr) ⇒ Align
constructor
A new instance of Align.
- #to_h ⇒ Object
Constructor Details
#initialize(ptr) ⇒ Align
Returns a new instance of Align.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/libssw/align.rb', line 40 def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end |
Instance Attribute Details
#cigar ⇒ Array (readonly)
Returns best alignment cigar; stored the same as that in BAM format, high 28 bits: length, low 4 bits: M/I/D (0/1/2); cigar = 0 when the best alignment path is not available.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#cigar_len ⇒ Integer
Returns length of the cigar string; cigarLen = 0 when the best alignment path is not available.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#read_begin1 ⇒ Integer
Returns 0-based best alignment beginning position on read; read_begin1 = -1 when the best alignment beginning position is not available.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#read_end1 ⇒ Integer
Returns 0-based best alignment ending position on read.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#read_end2 ⇒ Integer
Returns 0-based sub-optimal alignment ending position on read.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#ref_begin1 ⇒ Integer
Returns 0-based best alignment beginning position on reference; ref_begin1 = -1 when the best alignment beginning position is not available.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#ref_end1 ⇒ Integer
Returns 0-based best alignment ending position on reference.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#score1 ⇒ Integer
Returns the best alignment score.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
#score2 ⇒ Integer
Returns sub-optimal alignment score.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libssw/align.rb', line 31 class Align < FFI::Align def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end # This class is read_only attr_reader(*keys) def initialize(ptr) @ptr = ptr @cstruct = align = FFI::Align.new(ptr) @score1 = align.score1 @score2 = align.score2 @ref_begin1 = align.ref_begin1 @ref_end1 = align.ref_end1 @read_begin1 = align.read_begin1 @read_end1 = align.read_end1 @ref_end2 = align.ref_end2 @cigar_len = align.cigarLen @cigar = cigar_len.positive? ? align.cigar[0, 4 * cigar_len].unpack('L*') : [] # Attributes for ruby binding only @cigar_string = LibSSW.array_to_cigar_string(@cigar) LibSSW.align_destroy(ptr) end def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end end |
Class Method Details
.keys ⇒ Object
32 33 34 35 |
# File 'lib/libssw/align.rb', line 32 def self.keys %i[score1 score2 ref_begin1 ref_end1 read_begin1 read_end1 ref_end2 cigar cigar_len cigar_string] end |
Instance Method Details
#to_h ⇒ Object
57 58 59 |
# File 'lib/libssw/align.rb', line 57 def to_h self.class.keys.map { |k| [k, __send__(k)] }.to_h end |