yat  0.12.3pre
Public Member Functions | Related Functions | List of all members
theplu::yat::utility::Aligner::Cigar Class Reference

Compact Idiosyncratic Gapped Alignment Report. More...

#include <yat/utility/Aligner.h>

Public Member Functions

void clear (void)
 
uint32_t length (void) const
 
uint8_t op (size_t i) const
 
char opchr (size_t i) const
 
uint32_t oplen (size_t i) const
 
void pop_back (uint32_t len=1)
 
void pop_front (uint32_t len=1)
 
void push_back (uint8_t op, uint32_t len=1)
 
void push_front (uint8_t op, uint32_t len=1)
 
uint32_t query_length (void) const
 Translate CIGAR to a query length. More...
 
uint32_t reference_length (void) const
 Translate CIGAR to a reference length. More...
 
uint32_t operator[] (size_t i) const
 
size_t size (void) const
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &os, const Aligner::Cigar &cigar)
 

Detailed Description

Compact Idiosyncratic Gapped Alignment Report.

A CIGAR is a representation of an alignment, an array of operation/length where the operation and length is packed into a uint32_t. So a CIGAR of e.g. '3M1D5M' means alignment is three matches, one deletion, and five matches, which is represented by an array of length 3.

#define valuechartype consume refconsume query
BAM_CMATCH 0M3 true true
BAM_CINS 1I1 false true
BAM_CDEL 2D2 true false
BAM_CREF_SKIP 3N2 true false
BAM_CSOFT_CLIP4S1 false true
BAM_CHARD_CLIP5H0 false false
BAM_CPAD 6P0 false false
BAM_CEQUAL 7=3 true true
BAM_CDIFF 8X3 true true
BAM_CBACK 9B0 false false
Since
new in yat 0.12
See Also
file yat/utility/Cigar.h for some useful macros

Member Function Documentation

void theplu::yat::utility::Aligner::Cigar::clear ( void  )

Erases all elements.

uint32_t theplu::yat::utility::Aligner::Cigar::length ( void  ) const

Total length of operations counting operations that consume either (or both) query and reference e.g. match, insertion, or deletion. HardClip or Padding operations are ignored.

uint8_t theplu::yat::utility::Aligner::Cigar::op ( size_t  i) const

See table in class documntation.

Returns
operation part of element i
char theplu::yat::utility::Aligner::Cigar::opchr ( size_t  i) const

Translate the op(i) to a descriptive character of one of the following "MIDNSHP=XB". See table in class documentation.

Returns
character describing operation i
uint32_t theplu::yat::utility::Aligner::Cigar::operator[] ( size_t  i) const
Returns
cigar element i
uint32_t theplu::yat::utility::Aligner::Cigar::oplen ( size_t  i) const
Returns
length of element i
void theplu::yat::utility::Aligner::Cigar::pop_back ( uint32_t  len = 1)

Erase last len operation.

void theplu::yat::utility::Aligner::Cigar::pop_front ( uint32_t  len = 1)

Erase first len operation.

void theplu::yat::utility::Aligner::Cigar::push_back ( uint8_t  op,
uint32_t  len = 1 
)

Add an operation op of length len at back of cigar. If last operation equals op, length of that element is changed and the size() is not modified.

void theplu::yat::utility::Aligner::Cigar::push_front ( uint8_t  op,
uint32_t  len = 1 
)

Add an operation op of length len at front of cigar.

uint32_t theplu::yat::utility::Aligner::Cigar::query_length ( void  ) const

Translate CIGAR to a query length.

Calculate total length of operations which consume a query e.g. match or insetion. See table in class documentation.

This is the same function as bam_cigar2qlen in samtools C API.

uint32_t theplu::yat::utility::Aligner::Cigar::reference_length ( void  ) const

Translate CIGAR to a reference length.

Calculate total length of operations which consume a reference e.g. match or deletion. See table in class documentation.

Similar to bam_calend but does not handle BAM_CBACK as it has not been included in SAM specification. http://sourceforge.net/p/samtools/mailman/message/29373646/

size_t theplu::yat::utility::Aligner::Cigar::size ( void  ) const
Returns
number of elements in cigar

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  os,
const Aligner::Cigar cigar 
)
related

Output e.g. '5S44M5I98M' if the cigar has four elements. Each element is output as the length followed by the character descibing the operation (see opchr).


The documentation for this class was generated from the following file:

Generated on Mon Jun 1 2015 12:29:53 for yat by  doxygen 1.8.5