/*! \brief Compute effect of soft and hard clipping on coordinates * When offset is applied to either reference position or query position * the origin of sequencing can be identified. * @return offset of origin of sequencing from start or end * @deprecated - Use cigar operation directly to avoid constructing multiple Cigar objects */ int getOriginOffset() const { assert(m_dataPtr); // Now delegated to Cigar const Strand & strand = getStrand(); if(strand == FORWARD) { return getCigar().getOriginOffsetForward(); } else if(strand == REVERSE) { return getCigar().getOriginOffsetReverse(); } return 0; // Strand NA? }
static uint64_t getReferenceLength(uint8_t const * D) { uint64_t reflen = 0; uint32_t const ncigar = getNCigar(D); uint8_t const * cigar = getCigar(D); for ( uint32_t i = 0; i < ncigar; ++i, cigar+=4 ) { uint32_t const v = getLEInteger(cigar,4); uint8_t const op = v & ((1ull<<(4))-1); switch ( op ) { case 0: // M case 2: // D case 3: // N case 7: // = case 8: // X reflen += (v >> 4) & ((1ull<<(32-4))-1); break; } } return reflen; }
static uint64_t getLseqByCigar(uint8_t const * D) { uint64_t seqlen = 0; uint64_t const ncigar = getNCigar(D); uint8_t const * cigar = getCigar(D); for ( uint32_t i = 0; i < ncigar; ++i, cigar+=4 ) { uint32_t const v = getLEInteger(cigar,4); uint8_t const op = v & ((1ull<<(4))-1); // MIS=X switch ( op ) { case 0: // M case 1: // I case 4: // S case 7: // = case 8: // X seqlen += (v >> 4) & ((1ull<<(32-4))-1); break; } } return seqlen; }
static uint64_t getFrontClipping(uint8_t const * D) { uint32_t const ncigar = getNCigar(D); uint8_t const * cigar = getCigar(D); uint64_t frontclip = 0; for ( uint32_t i = 0; i < ncigar; ++i, cigar+=4 ) { uint32_t const v = getLEInteger(cigar,4); uint8_t const op = v & ((1ull<<(4))-1); if ( op == 4 /* S */ || op == 5 /* H */ ) frontclip += static_cast<int64_t>((v >> 4) & ((1ull<<(32-4))-1)); else break; }
static uint64_t getNumPreCigarBytes(uint8_t const * D) { return getCigar(D) - D; }
static uint32_t getCigarField(uint8_t const * D, uint64_t const i) { return getLEInteger(getCigar(D)+4*i,4); }