C++ Class: CigarRoller

From Genome Analysis Wiki
Revision as of 18:06, 14 May 2010 by Mktrost (talk | contribs)
Jump to: navigation, search

CigarRoller

This class is part of libcsg.

This purpose of this class is to provide utilities for creating and processing CIGAR strings.

Public Methods

Method Name Description
CigarRoller::CigarRoller() Default constructor initializes as a CIGAR with no operations.
CigarRoller::CigarRoller(const char *cigarString) Constructor that initializes the object with the specified cigarString.
CigarRoller & CigarRoller::operator += (CigarRoller &rhs) Add the contents of the specified CigarRoller to this object.
CigarRoller & CigarRoller::operator += (CigarOperator &rhs) Append the specified cigar operation to this object.
void CigarRoller::Add(Operation operation, int count) Adds the specified operation with the specified count to this object.
void CigarRoller::Add(const char *cigarString) Adds the specified cigarString to this object.
void CigarRoller::Set(const char *cigarString) Sets this object to the specified cigarString.
DEPRECATED int CigarRoller::getMatchPositionOffset() DO NOT USE.
const char * CigarRoller::getString() REturns the string representation of this CIGAR object.
void CigarRoller::getExpandedString(std::string &s) Sets the specified string to a string of characters that represent this cigar with no digits (a CIGAR of "3M" would return "MMM")
void CigarRoller::clear() Clear this object so that it has 0 Cigar Operations.
CigarOperator & CigarRoller::operator [] (int i) Return the Cigar Operation at the specified index (starting at 0).
bool CigarRoller::operator == (CigarRoller &rhs) Returns true if two Cigar Rollers are the same (the same operations of the same sizes)
int CigarRoller::size() Return the number of cigar operations in this object.
void CigarRoller::Dump() Write this object as a string to cout.
int CigarRoller::getExpectedQueryBaseCount() Returns the expected read length
int CigarRoller::getExpectedReferenceBaseCount() Return how many bases in the reference are spanned by the given CIGAR string
int32_t CigarRoller::getRefOffset(int32_t queryIndex) Return the reference offset associated with the specified query index based on this cigar.
int32_t CigarRoller::getQueryIndex(int32_t refOffset) Return the query index associated with the specified reference offset based on this cigar.


Overloaded Streaming Operators

Method Name Description
std::ostream &operator << (std::ostream &stream, const CigarRoller& roller) Writes all of the cigar operations contained in this roller to the passed in stream.
std::ostream &operator << (std::ostream &stream, const CigarRoller::CigarOperator& o) Writes the specified cigar operation to the specified stream as <count><char> (3M).


Public Enums

enum SPACE_TYPE
Enum Value Description
none No operation has been specified
match The query sequence and the reference sequence bases are the same for the bases associated with this cigar operation.

Both match and mismatch are associated with CIGAR Operation "M"

mismatch The query sequence and the reference sequence bases are different for the bases associated with this cigar operation, but bases exist in both the query and the reference.

Both match and mismatch are associated with CIGAR Operation "M"

insert Insertion to the reference (the query sequence contains bases that have no corresponding base in the reference).

Associated with CIGAR Operation "I"

del Deletion from the reference (the reference contains bases that have no corresponding base in the query sequence).

Associated with CIGAR Operation "D"

skip Skipped region from the reference (the reference contains bases that have no corresponding base in the query sequence).

Associated with CIGAR Operation "N"

softClip Soft clip on the read (clipped sequence present in the query sequence)

Associated with CIGAR Operation "S"

hardClip Hard clip on the read (clipped sequence not present in the query sequence)

Associated with CIGAR Operation "H"

pad Padding (silent deletion from the padded reference sequence)

Associated with CIGAR Operation "P"


Public Constants

Constant Value Description
INDEX_NA -1 Value associated with an index that is not applicable/does not exist.

Used for converting between query and reference indexes/offsets when an associated index/offset does not exist.


Nested Class

CigarOperation

Public Methods

Method Name Description
CigarOperator::CigarOperator(Operation operation, uint32_t count) Set the cigar operator with the specified operation and count length.
char CigarOperator::getChar() Returns the character code (M, I, D, N, S, H, or P) associated with this operation.
bool CigarOperator::operator == (CigarOperator &rhs) Returns true if the passed in operator is the same as this operator, false if not.
bool CigarOperator::operator != (CigarOperator &rhs) Returns true if the passed in operator is not the same as this operator, false if they are the same.