Class: Minibwa::Hit

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#blenInteger (readonly)

Returns alignment block length.

Returns:

  • (Integer)

    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

#cigarArray<Array(Integer, Integer)> (readonly)

Returns CIGAR operations as [length, op] pairs.

Returns:

  • (Array<Array(Integer, Integer)>)

    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

#cntInteger (readonly)

Returns number of seed hits.

Returns:

  • (Integer)

    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_flagInteger (readonly)

Returns CS tag flags.

Returns:

  • (Integer)

    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

#ctgString? (readonly)

Returns target contig name, when available.

Returns:

  • (String, nil)

    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_maxInteger (readonly)

Returns dynamic-programming maximum.

Returns:

  • (Integer)

    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_max0Integer (readonly)

Returns first dynamic-programming maximum.

Returns:

  • (Integer)

    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_max2Integer (readonly)

Returns second dynamic-programming maximum.

Returns:

  • (Integer)

    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_scoreInteger (readonly)

Returns dynamic-programming score.

Returns:

  • (Integer)

    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

#fltBoolean (readonly)

Returns whether the hit is filtered.

Returns:

  • (Boolean)

    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_highBoolean (readonly)

Returns whether the high-frequency seed fraction is high.

Returns:

  • (Boolean)

    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

#hashInteger (readonly)

Returns upstream hash value for tie-breaking.

Returns:

  • (Integer)

    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

#invBoolean (readonly)

Returns whether the hit represents an inversion.

Returns:

  • (Boolean)

    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

#mapqInteger (readonly)

Returns mapping quality.

Returns:

  • (Integer)

    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

#mlenInteger (readonly)

Returns number of matching bases.

Returns:

  • (Integer)

    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_ambiInteger (readonly)

Returns number of ambiguous reference bases.

Returns:

  • (Integer)

    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_subInteger (readonly)

Returns number of suboptimal hits.

Returns:

  • (Integer)

    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_pairBoolean (readonly)

Returns whether the hit is part of a proper pair.

Returns:

  • (Boolean)

    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

#qeInteger (readonly)

Returns zero-based query end.

Returns:

  • (Integer)

    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

#qsInteger (readonly)

Returns zero-based query start.

Returns:

  • (Integer)

    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

#rescuedBoolean (readonly)

Returns whether paired-end rescue found the hit.

Returns:

  • (Boolean)

    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

#revBoolean (readonly)

Returns whether the hit is on the reverse strand.

Returns:

  • (Boolean)

    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_priBoolean (readonly)

Returns whether the hit is primary in SAM output.

Returns:

  • (Boolean)

    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

#scoreInteger (readonly)

Returns alignment score.

Returns:

  • (Integer)

    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

#score0Integer (readonly)

Returns best-chain score before post-processing.

Returns:

  • (Integer)

    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_ratioBoolean (readonly)

Returns whether the seed ratio flag is set.

Returns:

  • (Boolean)

    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

#splitBoolean (readonly)

Returns whether the hit is split.

Returns:

  • (Boolean)

    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_invBoolean (readonly)

Returns whether the split hit is inverted.

Returns:

  • (Boolean)

    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

#subscInteger (readonly)

Returns suboptimal alignment score.

Returns:

  • (Integer)

    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

#teInteger (readonly)

Returns zero-based target end.

Returns:

  • (Integer)

    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

#tidObject (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

#tsInteger (readonly)

Returns zero-based target start.

Returns:

  • (Integer)

    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_strObject

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

#inspectObject

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

#strandObject

Returns the strand as '+' or '-'.



95
96
97
# File 'lib/minibwa/hit.rb', line 95

def strand
  rev ? '-' : '+'
end

#tlenObject

Returns the target (reference) span length.



100
101
102
# File 'lib/minibwa/hit.rb', line 100

def tlen
  te - ts
end