class
HTS::Bam::Record
- HTS::Bam::Record
- Reference
- Object
Defined in:
hts/bam/record.crConstant Summary
-
SEQ_NT16_STR =
"=ACMGRSVTWYHKDBN"
Constructors
-
.new(header : Bam::Header, qname : String, flag : UInt16 | Int32, tid : Int32, pos : Int64, mapq : UInt8 | Int32, cigar_words : Array(UInt32), seq : String, qual : Array(UInt8), mtid : Int32 = -1, mpos : Int64 = 0_i64, isize : Int64 = 0_i64)
Convenience constructor: build a record with core fields using bam_set1 - Coordinates are 0-based (as in BAM core) - CIGAR may be given as encoded words (Array(UInt32)) or SAM string - Qualities are Phred-scaled values (0..93), one per base
-
.new(header : Bam::Header, qname : String, flag : UInt16 | Int32, rname : String, pos : Int64, mapq : UInt8 | Int32, cigar_str : String, seq : String, qual : Array(UInt8), mtid : Int32 = -1, mpos : Int64 = 0_i64, isize : Int64 = 0_i64)
Overload: rname + CIGAR as String
- .new(header : Bam::Header, bam1_t : Pointer(HTS::LibHTS::Bam1T))
- .new(header : Bam::Header)
Instance Method Summary
-
#aux
Return Aux object for iteration over all auxiliary tags
- #aux_char(str) : Char | Nil
- #aux_float(str) : Float64 | Nil
-
#aux_int(str) : Int64 | Nil
Return Int64
- #aux_string(str) : String | Nil
-
#base(n)
return only the base of the requested index "i" of the query sequence.
-
#base_mod : Bam::BaseMod
Base modification accessor NOTE: Currently always returns a new BaseMod instance to avoid a finalizer cycle between Record and BaseMod.
-
#base_qual(n)
return only the base quality of the requested index "i" of the query sequence.
- #bin
- #bin=(bin)
-
#chrom
returns the chromosome or '' if not mapped.
-
#cigar
returns a
Cigarobject. -
#cigar_size : UInt32
Returns the number of CIGAR operations in this record without allocating a
Cigarobject. - #clone
-
#contig
returns the mate chromosome or '' if not mapped.
- #duplicate?
-
#each_base(&)
Iterate over query sequence bases without building a String.
-
#each_cigar(& : Tuple(Char, UInt32) -> ) : self
Iterate over CIGAR operations without allocating a
Cigarobject or copying the encoded CIGAR words out of the BAM record. -
#each_qual(&)
Iterate over base qualities without building an Array.
-
#endpos
returns end position of the read.
-
#finalize
garbagew collection
-
#flag
returns a
Flagobject. - #flag=(flag : Flag)
- #flag=(flag)
- #flag_value : UInt16
- #has_flag?(mask) : Bool
- #header : HTS::Bam::Header
-
#insert_size
insert size
- #insert_size=(isize)
- #isize
- #isize=(isize)
- #len
-
#mapq
mapping quality
- #mapq=(mapq)
-
#mate_chrom
returns the chromosome of the mate or '' if not mapped.
- #mate_contig
-
#mate_pos
returns 0-based mate position
- #mate_pos=(mpos)
- #mate_reverse?
- #mate_strand
- #mate_unmapped?
- #mpos
- #mpos=(mpos)
-
#mtid
returns the tid of the mate or -1 if not mapped.
- #mtid=(mtid)
- #paired?
-
#pos
returns 0-based start position.
- #pos=(pos)
- #proper_pair?
- #qcfail?
- #qlen
-
#qname
returns the query name.
- #qname=(name)
-
#qual
return the base qualities
-
#qual_string
Return base qualities as a Phred+33 QUAL string.
- #read1?
- #read2?
- #reverse?
- #rlen
- #secondary?
-
#seq
return the read sequence
- #sequence
- #strand
- #supplementary?
-
#tid
returns the tid of the record or -1 if not mapped.
- #tid=(tid)
-
#to_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
- #to_unsafe : Pointer(HTS::LibHTS::Bam1T)
- #unmapped?
Constructor Detail
Convenience constructor: build a record with core fields using bam_set1
- Coordinates are 0-based (as in BAM core)
- CIGAR may be given as encoded words (Array(UInt32)) or SAM string
- Qualities are Phred-scaled values (0..93), one per base
Overload: rname + CIGAR as String
Instance Method Detail
Base modification accessor
NOTE Currently always returns a new BaseMod instance to avoid a finalizer cycle between Record and BaseMod. In the future, memoization could be considered for performance optimization once the GC cycle issue is resolved.
Returns the number of CIGAR operations in this record without
allocating a Cigar object.
Iterate over CIGAR operations without allocating a Cigar object or
copying the encoded CIGAR words out of the BAM record. This yields the
same {op, len} tuple shape as Cigar#each, but reads from this record's
underlying BAM memory during the block. Use #cigar when an independent,
retained CIGAR object is needed.
Return base qualities as a Phred+33 QUAL string.
Matches htslib's SAM formatter: if the first quality byte is 0xff, QUAL is returned as "*"; otherwise each quality byte is emitted as byte + 33 without validating later bytes.
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>