Class: Minibwa::Hit
- Inherits:
-
Object
- Object
- Minibwa::Hit
- Defined in:
- lib/minibwa/hit.rb,
ext/minibwa/mb_hit.c
Overview
A single alignment of one query against the reference.
The fields are filled in by mb_hit.c. This file reopens the class for the values that can be derived without touching C: CIGAR formatting, the soft-clipped CIGAR rebuilt from qs/qe -- upstream only reports the aligned region -- the strand character, and #inspect.
Constant Summary collapse
- CIGAR_STR =
CIGAR operation characters indexed by operation code.
'MIDNSHP=XB'
Instance Attribute Summary collapse
-
#blen ⇒ Integer
readonly
Alignment block length.
-
#cigar ⇒ Array<Array(Integer, Integer)>
readonly
CIGAR operations as [length, op] pairs.
-
#cnt ⇒ Integer
readonly
Number of seed hits.
-
#cs_flag ⇒ Integer
readonly
CS tag flags.
-
#ctg ⇒ String?
readonly
Target contig name, when available.
-
#dp_max ⇒ Integer
readonly
Dynamic-programming maximum.
-
#dp_max0 ⇒ Integer
readonly
First dynamic-programming maximum.
-
#dp_max2 ⇒ Integer
readonly
Second dynamic-programming maximum.
-
#dp_score ⇒ Integer
readonly
Dynamic-programming score.
-
#flt ⇒ Boolean
readonly
Whether the hit is filtered.
-
#frac_high ⇒ Boolean
readonly
Whether the high-frequency seed fraction is high.
-
#hash ⇒ Integer
readonly
Upstream hash value for tie-breaking.
-
#inv ⇒ Boolean
readonly
Whether the hit represents an inversion.
-
#mapq ⇒ Integer
readonly
Mapping quality.
-
#mlen ⇒ Integer
readonly
Number of matching bases.
-
#n_ambi ⇒ Integer
readonly
Number of ambiguous reference bases.
-
#n_sub ⇒ Integer
readonly
Number of suboptimal hits.
-
#proper_pair ⇒ Boolean
readonly
Whether the hit is part of a proper pair.
-
#qe ⇒ Integer
readonly
Zero-based query end.
-
#qs ⇒ Integer
readonly
Zero-based query start.
-
#rescued ⇒ Boolean
readonly
Whether paired-end rescue found the hit.
-
#rev ⇒ Boolean
readonly
Whether the hit is on the reverse strand.
-
#sam_pri ⇒ Boolean
readonly
Whether the hit is primary in SAM output.
-
#score ⇒ Integer
readonly
Alignment score.
-
#score0 ⇒ Integer
readonly
Best-chain score before post-processing.
-
#seed_ratio ⇒ Boolean
readonly
Whether the seed ratio flag is set.
-
#split ⇒ Boolean
readonly
Whether the hit is split.
-
#split_inv ⇒ Boolean
readonly
Whether the split hit is inverted.
-
#subsc ⇒ Integer
readonly
Suboptimal alignment score.
-
#te ⇒ Integer
readonly
Zero-based target end.
-
#tid ⇒ Object
readonly
attr_readers for all fields.
-
#ts ⇒ Integer
readonly
Zero-based target start.
Instance Method Summary collapse
-
#cigar_str ⇒ Object
Returns the CIGAR string for the aligned region (no soft/hard clips).
-
#full_cigar_str(query_len) ⇒ Object
Returns the full CIGAR string including soft clips.
-
#inspect ⇒ Object
Returns a compact representation of the most commonly inspected fields.
-
#strand ⇒ Object
Returns the strand as '+' or '-'.
-
#tlen ⇒ Object
Returns the target (reference) span length.
Instance Attribute Details
#blen ⇒ Integer (readonly)
Returns alignment block length.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#cigar ⇒ Array<Array(Integer, Integer)> (readonly)
Returns CIGAR operations as [length, op] pairs.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#cnt ⇒ Integer (readonly)
Returns number of seed hits.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#cs_flag ⇒ Integer (readonly)
Returns CS tag flags.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#ctg ⇒ String? (readonly)
Returns target contig name, when available.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#dp_max ⇒ Integer (readonly)
Returns dynamic-programming maximum.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#dp_max0 ⇒ Integer (readonly)
Returns first dynamic-programming maximum.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#dp_max2 ⇒ Integer (readonly)
Returns second dynamic-programming maximum.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#dp_score ⇒ Integer (readonly)
Returns dynamic-programming score.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#flt ⇒ Boolean (readonly)
Returns whether the hit is filtered.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#frac_high ⇒ Boolean (readonly)
Returns whether the high-frequency seed fraction is high.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#hash ⇒ Integer (readonly)
Returns upstream hash value for tie-breaking.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#inv ⇒ Boolean (readonly)
Returns whether the hit represents an inversion.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#mapq ⇒ Integer (readonly)
Returns mapping quality.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#mlen ⇒ Integer (readonly)
Returns number of matching bases.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#n_ambi ⇒ Integer (readonly)
Returns number of ambiguous reference bases.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#n_sub ⇒ Integer (readonly)
Returns number of suboptimal hits.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#proper_pair ⇒ Boolean (readonly)
Returns whether the hit is part of a proper pair.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#qe ⇒ Integer (readonly)
Returns zero-based query end.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#qs ⇒ Integer (readonly)
Returns zero-based query start.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#rescued ⇒ Boolean (readonly)
Returns whether paired-end rescue found the hit.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#rev ⇒ Boolean (readonly)
Returns whether the hit is on the reverse strand.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#sam_pri ⇒ Boolean (readonly)
Returns whether the hit is primary in SAM output.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#score ⇒ Integer (readonly)
Returns alignment score.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#score0 ⇒ Integer (readonly)
Returns best-chain score before post-processing.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#seed_ratio ⇒ Boolean (readonly)
Returns whether the seed ratio flag is set.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#split ⇒ Boolean (readonly)
Returns whether the hit is split.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#split_inv ⇒ Boolean (readonly)
Returns whether the split hit is inverted.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#subsc ⇒ Integer (readonly)
Returns suboptimal alignment score.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#te ⇒ Integer (readonly)
Returns zero-based target end.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#tid ⇒ Object (readonly)
attr_readers for all fields
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
#ts ⇒ Integer (readonly)
Returns zero-based target start.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/minibwa/hit.rb', line 75 class Hit # CIGAR operation characters indexed by operation code. CIGAR_STR = 'MIDNSHP=XB' # Returns the CIGAR string for the aligned region (no soft/hard clips). def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end # Returns the full CIGAR string including soft clips. # # The query length is required because the Hit only stores the aligned # region (qs/qe); the clips are derived from the difference. # # hit.full_cigar_str(query.length) # => "2S35M3S" def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end # Returns the strand as '+' or '-'. def strand rev ? '-' : '+' end # Returns the target (reference) span length. def tlen te - ts end # Returns a compact representation of the most commonly inspected fields. def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end end |
Instance Method Details
#cigar_str ⇒ Object
Returns the CIGAR string for the aligned region (no soft/hard clips).
80 81 82 |
# File 'lib/minibwa/hit.rb', line 80 def cigar_str @cigar.map { |len, op| "#{len}#{CIGAR_STR[op]}" }.join end |
#full_cigar_str(query_len) ⇒ Object
Returns the full CIGAR string including soft clips.
The query length is required because the Hit only stores the aligned region (qs/qe); the clips are derived from the difference.
hit.full_cigar_str(query.length) # => "2S35M3S"
90 91 92 |
# File 'lib/minibwa/hit.rb', line 90 def full_cigar_str(query_len) Sam.build_full_cigar(self, query_len) end |
#inspect ⇒ Object
Returns a compact representation of the most commonly inspected fields.
105 106 107 108 |
# File 'lib/minibwa/hit.rb', line 105 def inspect attrs = %i[tid ctg ts te qs qe strand score mapq mlen blen] "#<#{self.class.name} #{attrs.map { |a| "#{a}=#{send(a).inspect}" }.join(' ')}>" end |
#strand ⇒ Object
Returns the strand as '+' or '-'.
95 96 97 |
# File 'lib/minibwa/hit.rb', line 95 def strand rev ? '-' : '+' end |
#tlen ⇒ Object
Returns the target (reference) span length.
100 101 102 |
# File 'lib/minibwa/hit.rb', line 100 def tlen te - ts end |