Class: HTS::Bam::Flag
- Inherits:
-
Object
- Object
- HTS::Bam::Flag
- Defined in:
- lib/hts/bam/flag.rb
Overview
SAM flags
Constant Summary collapse
- TABLE =
BAM_FPAIRED = 1 BAM_FPROPER_PAIR = 2 BAM_FUNMAP = 4 BAM_FMUNMAP = 8 BAM_FREVERSE = 16 BAM_FMREVERSE = 32 BAM_FREAD1 = 64 BAM_FREAD2 = 128 BAM_FSECONDARY = 256 BAM_FQCFAIL = 512 BAM_FDUP = 1024 BAM_FSUPPLEMENTARY = 2048
{ paired?: LibHTS::BAM_FPAIRED, proper_pair?: LibHTS::BAM_FPROPER_PAIR, unmapped?: LibHTS::BAM_FUNMAP, mate_unmapped?: LibHTS::BAM_FMUNMAP, reverse?: LibHTS::BAM_FREVERSE, mate_reverse?: LibHTS::BAM_FMREVERSE, read1?: LibHTS::BAM_FREAD1, read2?: LibHTS::BAM_FREAD2, secondary?: LibHTS::BAM_FSECONDARY, qcfail?: LibHTS::BAM_FQCFAIL, duplicate?: LibHTS::BAM_FDUP, supplementary?: LibHTS::BAM_FSUPPLEMENTARY }.freeze
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #&(other) ⇒ Object
- #<<(f) ⇒ Object
- #>>(other) ⇒ Object
- #^(other) ⇒ Object
- #duplicate? ⇒ Boolean
- #has_flag?(f) ⇒ Boolean
-
#initialize(flag_value) ⇒ Flag
constructor
A new instance of Flag.
- #mate_reverse? ⇒ Boolean
- #mate_unmapped? ⇒ Boolean
- #paired? ⇒ Boolean
- #proper_pair? ⇒ Boolean
- #qcfail? ⇒ Boolean
- #read1? ⇒ Boolean
- #read2? ⇒ Boolean
- #reverse? ⇒ Boolean
- #secondary? ⇒ Boolean
- #supplementary? ⇒ Boolean
- #to_i ⇒ Object
- #to_s ⇒ Object
- #unmapped? ⇒ Boolean
- #|(other) ⇒ Object
- #~ ⇒ Object
Constructor Details
#initialize(flag_value) ⇒ Flag
Returns a new instance of Flag.
10 11 12 13 14 |
# File 'lib/hts/bam/flag.rb', line 10 def initialize(flag_value) raise TypeError unless flag_value.is_a? Integer @value = flag_value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
16 17 18 |
# File 'lib/hts/bam/flag.rb', line 16 def value @value end |
Instance Method Details
#&(other) ⇒ Object
71 72 73 |
# File 'lib/hts/bam/flag.rb', line 71 def &(other) Flag.new(@value & other.to_i) end |
#<<(f) ⇒ Object
87 88 89 |
# File 'lib/hts/bam/flag.rb', line 87 def <<(f) Flag.new(@value << f.to_i) end |
#>>(other) ⇒ Object
91 92 93 |
# File 'lib/hts/bam/flag.rb', line 91 def >>(other) Flag.new(@value >> other.to_i) end |
#^(other) ⇒ Object
79 80 81 |
# File 'lib/hts/bam/flag.rb', line 79 def ^(other) Flag.new(@value ^ other.to_i) end |
#duplicate? ⇒ Boolean
64 |
# File 'lib/hts/bam/flag.rb', line 64 generate :duplicate? |
#has_flag?(f) ⇒ Boolean
67 68 69 |
# File 'lib/hts/bam/flag.rb', line 67 def has_flag?(f) (@value & f) != 0 end |
#mate_reverse? ⇒ Boolean
59 |
# File 'lib/hts/bam/flag.rb', line 59 generate :mate_reverse? |
#mate_unmapped? ⇒ Boolean
57 |
# File 'lib/hts/bam/flag.rb', line 57 generate :mate_unmapped? |
#paired? ⇒ Boolean
54 |
# File 'lib/hts/bam/flag.rb', line 54 generate :paired? |
#proper_pair? ⇒ Boolean
55 |
# File 'lib/hts/bam/flag.rb', line 55 generate :proper_pair? |
#qcfail? ⇒ Boolean
63 |
# File 'lib/hts/bam/flag.rb', line 63 generate :qcfail? |
#read1? ⇒ Boolean
60 |
# File 'lib/hts/bam/flag.rb', line 60 generate :read1? |
#read2? ⇒ Boolean
61 |
# File 'lib/hts/bam/flag.rb', line 61 generate :read2? |
#reverse? ⇒ Boolean
58 |
# File 'lib/hts/bam/flag.rb', line 58 generate :reverse? |
#secondary? ⇒ Boolean
62 |
# File 'lib/hts/bam/flag.rb', line 62 generate :secondary? |
#supplementary? ⇒ Boolean
65 |
# File 'lib/hts/bam/flag.rb', line 65 generate :supplementary? |
#to_i ⇒ Object
95 96 97 |
# File 'lib/hts/bam/flag.rb', line 95 def to_i @value end |
#to_s ⇒ Object
99 100 101 102 |
# File 'lib/hts/bam/flag.rb', line 99 def to_s LibHTS.bam_flag2str(@value) # "0x#{format('%x', @value)}\t#{@value}\t#{LibHTS.bam_flag2str(@value)}" end |
#unmapped? ⇒ Boolean
56 |
# File 'lib/hts/bam/flag.rb', line 56 generate :unmapped? |