Class: HTS::Bam::Flag
- Inherits:
-
Object
- Object
- HTS::Bam::Flag
- Defined in:
- lib/hts/bam/flag.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #dup? ⇒ Boolean
- #has_flag?(m) ⇒ Boolean
-
#initialize(flag_value) ⇒ Flag
constructor
A new instance of Flag.
- #mate_reverse? ⇒ Boolean
- #mate_unmapped? ⇒ Boolean
-
#paired? ⇒ Boolean
TODO: Enabling bitwise operations hts-nim proc ‘and`*(f: Flag, o: uint16): uint16 borrow, inline . proc `and`*(f: Flag, o: Flag): uint16 borrow, inline . proc `or`*(f: Flag, o: uint16): uint16 borrow . proc `or`*(o: uint16, f: Flag): uint16 borrow . proc `==`*(f: Flag, o: Flag): bool borrow, inline . proc `==`*(f: Flag, o: uint16): bool borrow, inline . proc `==`*(o: uint16, f: Flag): bool borrow, inline ..
- #proper_pair? ⇒ Boolean
- #qcfail? ⇒ Boolean
- #read1? ⇒ Boolean
- #read2? ⇒ Boolean
- #reverse? ⇒ Boolean
- #secondary? ⇒ Boolean
- #supplementary? ⇒ Boolean
- #to_s ⇒ Object
- #unmapped? ⇒ Boolean
Constructor Details
#initialize(flag_value) ⇒ Flag
Returns a new instance of Flag.
9 10 11 12 13 |
# File 'lib/hts/bam/flag.rb', line 9 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.
15 16 17 |
# File 'lib/hts/bam/flag.rb', line 15 def value @value end |
Instance Method Details
#dup? ⇒ Boolean
80 81 82 |
# File 'lib/hts/bam/flag.rb', line 80 def dup? has_flag? LibHTS::BAM_FDUP end |
#has_flag?(m) ⇒ Boolean
88 89 90 |
# File 'lib/hts/bam/flag.rb', line 88 def has_flag?(m) (@value & m) != 0 end |
#mate_reverse? ⇒ Boolean
60 61 62 |
# File 'lib/hts/bam/flag.rb', line 60 def mate_reverse? has_flag? LibHTS::BAM_FMREVERSE end |
#mate_unmapped? ⇒ Boolean
52 53 54 |
# File 'lib/hts/bam/flag.rb', line 52 def mate_unmapped? has_flag? LibHTS::BAM_FMUNMAP end |
#paired? ⇒ Boolean
TODO: Enabling bitwise operations hts-nim proc ‘and`*(f: Flag, o: uint16): uint16 borrow, inline . proc `and`*(f: Flag, o: Flag): uint16 borrow, inline . proc `or`*(f: Flag, o: uint16): uint16 borrow . proc `or`*(o: uint16, f: Flag): uint16 borrow . proc `==`*(f: Flag, o: Flag): bool borrow, inline . proc `==`*(f: Flag, o: uint16): bool borrow, inline . proc `==`*(o: uint16, f: Flag): bool borrow, inline .
40 41 42 |
# File 'lib/hts/bam/flag.rb', line 40 def paired? has_flag? LibHTS::BAM_FPAIRED end |
#proper_pair? ⇒ Boolean
44 45 46 |
# File 'lib/hts/bam/flag.rb', line 44 def proper_pair? has_flag? LibHTS::BAM_FPROPER_PAIR end |
#qcfail? ⇒ Boolean
76 77 78 |
# File 'lib/hts/bam/flag.rb', line 76 def qcfail? has_flag? LibHTS::BAM_FQCFAIL end |
#read1? ⇒ Boolean
64 65 66 |
# File 'lib/hts/bam/flag.rb', line 64 def read1? has_flag? LibHTS::BAM_FREAD1 end |
#read2? ⇒ Boolean
68 69 70 |
# File 'lib/hts/bam/flag.rb', line 68 def read2? has_flag? LibHTS::BAM_FREAD2 end |
#reverse? ⇒ Boolean
56 57 58 |
# File 'lib/hts/bam/flag.rb', line 56 def reverse? has_flag? LibHTS::BAM_FREVERSE end |
#secondary? ⇒ Boolean
72 73 74 |
# File 'lib/hts/bam/flag.rb', line 72 def secondary? has_flag? LibHTS::BAM_FSECONDARY end |
#supplementary? ⇒ Boolean
84 85 86 |
# File 'lib/hts/bam/flag.rb', line 84 def supplementary? has_flag? LibHTS::BAM_FSUPPLEMENTARY end |
#to_s ⇒ Object
92 93 94 |
# File 'lib/hts/bam/flag.rb', line 92 def to_s "0x#{format('%x', @value)}\t#{@value}\t#{LibHTS.bam_flag2str(@value)}" end |
#unmapped? ⇒ Boolean
48 49 50 |
# File 'lib/hts/bam/flag.rb', line 48 def unmapped? has_flag? LibHTS::BAM_FUNMAP end |