module HTS::LibHTS

Constants

BAM_CBACK
BAM_CDEL
BAM_CDIFF
BAM_CEQUAL
BAM_CHARD_CLIP
BAM_CIGAR_MASK
BAM_CIGAR_SHIFT
BAM_CIGAR_STR
BAM_CIGAR_STR_PADDED
BAM_CIGAR_TYPE
BAM_CINS
BAM_CMATCH

constants

BAM_CPAD
BAM_CREF_SKIP
BAM_CSOFT_CLIP
BAM_FDUP
BAM_FMREVERSE
BAM_FMUNMAP
BAM_FPAIRED
BAM_FPROPER_PAIR
BAM_FQCFAIL
BAM_FREAD1
BAM_FREAD2
BAM_FREVERSE
BAM_FSECONDARY
BAM_FSUPPLEMENTARY
BAM_FUNMAP
BCF1_DIRTY_ALS
BCF1_DIRTY_FLT
BCF1_DIRTY_ID
BCF1_DIRTY_INF
BCF_BT_CHAR
BCF_BT_FLOAT
BCF_BT_INT16
BCF_BT_INT32
BCF_BT_INT64
BCF_BT_INT8
BCF_BT_NULL
BCF_DT_CTG
BCF_DT_ID
BCF_DT_SAMPLE
BCF_ERR_CHAR
BCF_ERR_CTG_INVALID
BCF_ERR_CTG_UNDEF
BCF_ERR_LIMITS
BCF_ERR_NCOLS
BCF_ERR_TAG_INVALID
BCF_ERR_TAG_UNDEF
BCF_HL_CTG
BCF_HL_FLT

constants

BCF_HL_FMT
BCF_HL_GEN
BCF_HL_INFO
BCF_HL_STR
BCF_HT_FLAG
BCF_HT_INT
BCF_HT_LONG
BCF_HT_REAL
BCF_HT_STR
BCF_UN_ALL
BCF_UN_FLT
BCF_UN_FMT
BCF_UN_IND
BCF_UN_INFO
BCF_UN_SHR
BCF_UN_STR

constants

BCF_VL_A
BCF_VL_FIXED
BCF_VL_G
BCF_VL_R
BCF_VL_VAR
BamHdr

HtsFile

FaiFormatOptions

faidx

HtsCompression
HtsExactFormat
HtsFmtOption
HtsFormatCategory
HtsLogLevel

hts

SamFile
VCF_BND
VCF_INDEL
VCF_MNP
VCF_OTHER
VCF_OVERLAP
VCF_REF
VCF_SNP

Public Class Methods

attach_function(*) click to toggle source
Calls superclass method
# File lib/hts/libhts.rb, line 13
def self.attach_function(*)
  super
rescue FFI::NotFoundError => e
  warn e.message
end
bam_cigar_gen(l, o) click to toggle source
# File lib/hts/libhts/sam.rb, line 37
def bam_cigar_gen(l, o)
  l << BAM_CIGAR_SHIFT | o
end
bam_cigar_op(c) click to toggle source
# File lib/hts/libhts/sam.rb, line 25
def bam_cigar_op(c)
  c & BAM_CIGAR_MASK
end
bam_cigar_opchr(c) click to toggle source
# File lib/hts/libhts/sam.rb, line 33
def bam_cigar_opchr(c)
  ("#{BAM_CIGAR_STR}??????")[bam_cigar_op(c)]
end
bam_cigar_oplen(c) click to toggle source
# File lib/hts/libhts/sam.rb, line 29
def bam_cigar_oplen(c)
  c >> BAM_CIGAR_SHIFT
end
bam_cigar_type(o) click to toggle source
# File lib/hts/libhts/sam.rb, line 41
def bam_cigar_type(o)
  BAM_CIGAR_TYPE >> (o << 1) & 3
end
bam_get_aux(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 86
def bam_get_aux(b)
  b[:data] + (b[:core][:n_cigar] << 2) + b[:core][:l_qname] + ((b[:core][:l_qseq] + 1) >> 1) + b[:core][:l_qseq]
end
bam_get_cigar(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 74
def bam_get_cigar(b)
  b[:data] + b[:core][:l_qname]
end
bam_get_l_aux(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 90
def bam_get_l_aux(b)
  b[:l_data] - (b[:core][:n_cigar] << 2) - b[:core][:l_qname] - b[:core][:l_qseq] - ((b[:core][:l_qseq] + 1) >> 1)
end
bam_get_qname(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 70
def bam_get_qname(b)
  b[:data]
end
bam_get_qual(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 82
def bam_get_qual(b)
  b[:data] + (b[:core][:n_cigar] << 2) + b[:core][:l_qname] + ((b[:core][:l_qseq] + 1) >> 1)
end
bam_get_seq(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 78
def bam_get_seq(b)
  b[:data] + (b[:core][:n_cigar] << 2) + b[:core][:l_qname]
end
bam_is_mrev(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 66
def bam_is_mrev(b)
  b[:core][:flag] & BAM_FMREVERSE != 0
end
bam_is_rev(b) click to toggle source
# File lib/hts/libhts/sam.rb, line 62
def bam_is_rev(b)
  b[:core][:flag] & BAM_FREVERSE != 0
end
bam_seqi(s, i) click to toggle source
# File lib/hts/libhts/sam.rb, line 94
def bam_seqi(s, i)
  s[(i) >> 1].read_uint8 >> ((~i & 1) << 2) & 0xf
end
bcf_hdr_nsamples(hdr) click to toggle source
# File lib/hts/libhts/vcf.rb, line 60
def bcf_hdr_nsamples(hdr)
  hdr[:n][BCF_DT_SAMPLE]
end
sam_itr_next(htsfp, itr, r) click to toggle source

Get the next read from a SAM/BAM/CRAM iterator

# File lib/hts/libhts/sam.rb, line 442
def self.sam_itr_next(htsfp, itr, r)
  # FIXME: check if htsfp is compressed BGZF
  hts_log_error("Null iterator") if itr.null?
  # FIXME: check multi
  hts_itr_next(htsfp[:fp][:bgzf], itr, r, htsfp)
end