Cigar Class Reference

This class represents the CIGAR without any methods to set the cigar (see CigarRoller for that). More...

#include <Cigar.h>

Inheritance diagram for Cigar:
Inheritance graph
[legend]
Collaboration diagram for Cigar:
Collaboration graph
[legend]

List of all members.

Classes

struct  CigarOperator

Public Types

enum  Operation {
  none = 0, match, mismatch, insert,
  del, skip, softClip, hardClip,
  pad
}
 

Enum for the cigar operations.

More...

Public Member Functions

 Cigar ()
 Default constructor initializes as a CIGAR with no operations.
void getCigarString (String &cigarString) const
 Set the passed in String to the string reprentation of the Cigar operations in this object.
void getCigarString (std::string &cigarString) const
 Set the passed in std::string to the string reprentation of the Cigar operations in this object.
void getExpandedString (std::string &s) const
 Sets the specified string to a valid CIGAR string of characters that represent the cigar with no digits (a CIGAR of "3M" would return "MMM").
const CigarOperatoroperator[] (int i) const
 Return the Cigar Operation at the specified index (starting at 0).
const CigarOperatorgetOperator (int i) const
 Return the Cigar Operation at the specified index (starting at 0).
bool operator== (Cigar &rhs) const
 Return true if the 2 Cigars are the same (the same operations of the same sizes).
int size () const
 Return the number of cigar operations.
void Dump () const
 Write this object as a string to cout.
int getExpectedQueryBaseCount () const
 Return the length of the read that corresponds to the current CIGAR string.
int getExpectedReferenceBaseCount () const
 Return the number of bases in the reference that this CIGAR "spans".
int getNumBeginClips () const
 Return the number of clips that are at the beginning of the cigar.
int getNumEndClips () const
 Return the number of clips that are at the end of the cigar.
int32_t getRefOffset (int32_t queryIndex)
 Return the reference offset associated with the specified query index or INDEX_NA based on this cigar.
int32_t getQueryIndex (int32_t refOffset)
 Return the query index associated with the specified reference offset or INDEX_NA based on this cigar.
int32_t getRefPosition (int32_t queryIndex, int32_t queryStartPos)
 Return the reference position associated with the specified query index or INDEX_NA based on this cigar and the specified queryStartPos which is the leftmost mapping position of the first matching base in the query.
int32_t getQueryIndex (int32_t refPosition, int32_t queryStartPos)
 Return the query index or INDEX_NA associated with the specified reference offset when the query starts at the specified reference position.
int32_t getExpandedCigarIndexFromQueryIndex (int32_t queryIndex)
 Returns the index into the expanded cigar for the cigar associated with the specified queryIndex.
int32_t getExpandedCigarIndexFromRefOffset (int32_t refOffset)
 Returns the index into the expanded cigar for the cigar associated with the specified reference offset.
int32_t getExpandedCigarIndexFromRefPos (int32_t refPosition, int32_t queryStartPos)
 Returns the index into the expanded cigar for the cigar associated with the specified reference position and queryStartPos.
char getCigarCharOp (int32_t expandedCigarIndex)
 Return the character code of the cigar operator associated with the specified expanded CIGAR index.
char getCigarCharOpFromQueryIndex (int32_t queryIndex)
 Return the character code of the cigar operator associated with the specified queryIndex.
char getCigarCharOpFromRefOffset (int32_t refOffset)
 Return the character code of the cigar operator associated with the specified reference offset.
char getCigarCharOpFromRefPos (int32_t refPosition, int32_t queryStartPos)
 Return the character code of the cigar operator associated with the specified reference position.
uint32_t getNumOverlaps (int32_t start, int32_t end, int32_t queryStartPos)
 Return the number of bases that overlap the reference and the read associated with this cigar that falls within the specified region.
bool hasIndel ()
 Return whether or not the cigar has indels (insertions or delections).

Static Public Member Functions

static bool foundInReference (Operation op)
 Return true if the specified operation is found in the reference sequence, false if not.
static bool foundInReference (char op)
 Return true if the specified operation is found in the reference sequence, false if not.
static bool foundInReference (const CigarOperator &op)
 Return true if the specified operation is found in the reference sequence, false if not.
static bool foundInQuery (Operation op)
 Return true if the specified operation is found in the query sequence, false if not.
static bool foundInQuery (char op)
 Return true if the specified operation is found in the query sequence, false if not.
static bool foundInQuery (const CigarOperator &op)
 Return true if the specified operation is found in the query sequence, false if not.
static bool isClip (Operation op)
 Return true if the specified operation is a clipping operation, false if not.
static bool isClip (char op)
 Return true if the specified operation is a clipping operation, false if not.
static bool isClip (const CigarOperator &op)
 Return true if the specified operation is a clipping operation, false if not.
static bool isMatchOrMismatch (Operation op)
 Return true if the specified operation is a match/mismatch operation, false if not.
static bool isMatchOrMismatch (const CigarOperator &op)
 Return true if the specified operation is a match/mismatch operation, false if not.

Static Public Attributes

static const int MAX_OP_VALUE = pad
static const int32_t 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.

Protected Member Functions

void clearQueryAndReferenceIndexes ()
void setQueryAndReferenceIndexes ()

Protected Attributes

std::vector< CigarOperatorcigarOperations

Friends

std::ostream & operator<< (std::ostream &stream, const Cigar &cigar)
 Writes all of the cigar operations contained in the cigar to the passed in stream.

Detailed Description

This class represents the CIGAR without any methods to set the cigar (see CigarRoller for that).

This class represents the CIGAR. It contains methods for converting to strings and extracting information from the cigar on how a read maps to the reference.

It only contains read only methods. There are no ways to set values. To set a value, a child class must be used.

Definition at line 83 of file Cigar.h.


Member Enumeration Documentation

Enum for the cigar operations.

Enumerator:
none 

no operation has been set.

match 

match/mismatch operation. Associated with CIGAR Operation "M"

mismatch 

mismatch operation. 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, but not in reference). Associated with CIGAR Operation "S".

hardClip 

Hard clip on the read (clipped sequence not present in the query sequence or reference). Associated with CIGAR Operation "H".

pad 

Padding (not in reference or query). Associated with CIGAR Operation "P".

Definition at line 87 of file Cigar.h.

00087                    {
00088         none=0, ///< no operation has been set.
00089         match, ///< match/mismatch operation.  Associated with CIGAR Operation "M"
00090         mismatch, ///< mismatch operation.  Associated with CIGAR Operation "M"
00091         insert,  ///< insertion to the reference (the query sequence contains bases that have no corresponding base in the reference).  Associated with CIGAR Operation "I"
00092         del,  ///< deletion from the reference (the reference contains bases that have no corresponding base in the query sequence).  Associated with CIGAR Operation "D"
00093         skip,  ///< skipped region from the reference (the reference contains bases that have no corresponding base in the query sequence).  Associated with CIGAR Operation "N"
00094         softClip,  ///< Soft clip on the read (clipped sequence present in the query sequence, but not in reference).  Associated with CIGAR Operation "S"
00095         hardClip,  ///< Hard clip on the read (clipped sequence not present in the query sequence or reference).  Associated with CIGAR Operation "H"
00096         pad ///< Padding (not in reference or query).  Associated with CIGAR Operation "P"
00097     };


Member Function Documentation

static bool Cigar::foundInQuery ( const CigarOperator op  )  [inline, static]

Return true if the specified operation is found in the query sequence, false if not.

Definition at line 254 of file Cigar.h.

References foundInQuery().

00255     {
00256         return(foundInQuery(op.operation));
00257     }

static bool Cigar::foundInQuery ( char  op  )  [inline, static]

Return true if the specified operation is found in the query sequence, false if not.

Definition at line 236 of file Cigar.h.

00237     {
00238         switch(op)
00239         {
00240             case 'M':
00241             case '=':
00242             case 'X':
00243             case 'I':
00244             case 'S':
00245                 return true;
00246             default:
00247                 return false;
00248         }
00249         return false;
00250     }

static bool Cigar::foundInQuery ( Operation  op  )  [inline, static]

Return true if the specified operation is found in the query sequence, false if not.

Definition at line 219 of file Cigar.h.

References insert, match, mismatch, and softClip.

Referenced by foundInQuery(), SamRecord::shiftIndelsLeft(), SamFilter::softClip(), CigarHelper::softClipBeginByRefPos(), and CigarHelper::softClipEndByRefPos().

00220     {
00221         switch(op)
00222         {
00223             case match:
00224             case mismatch:
00225             case insert:
00226             case softClip:
00227                 return true;
00228             default:
00229                 return false;
00230         }
00231         return false;
00232     }

static bool Cigar::foundInReference ( const CigarOperator op  )  [inline, static]

Return true if the specified operation is found in the reference sequence, false if not.

Definition at line 212 of file Cigar.h.

References foundInReference().

00213     {
00214         return(foundInReference(op.operation));
00215     }

static bool Cigar::foundInReference ( char  op  )  [inline, static]

Return true if the specified operation is found in the reference sequence, false if not.

Definition at line 194 of file Cigar.h.

00195     {
00196         switch(op)
00197         {
00198             case 'M':
00199             case '=':
00200             case 'X':
00201             case 'D':
00202             case 'N':
00203                 return true;
00204             default:
00205                 return false;
00206         }
00207         return false;
00208     }

static bool Cigar::foundInReference ( Operation  op  )  [inline, static]

Return true if the specified operation is found in the reference sequence, false if not.

Definition at line 177 of file Cigar.h.

References del, match, mismatch, and skip.

Referenced by foundInReference(), CigarHelper::softClipBeginByRefPos(), and CigarHelper::softClipEndByRefPos().

00178     {
00179         switch(op)
00180         {
00181             case match:
00182             case mismatch:
00183             case del:
00184             case skip:
00185                 return true;
00186             default:
00187                 return false;
00188         }
00189         return false;
00190     }

char Cigar::getCigarCharOp ( int32_t  expandedCigarIndex  ) 

Return the character code of the cigar operator associated with the specified expanded CIGAR index.

'?' is returned for an out of range index.

Definition at line 295 of file Cigar.cpp.

Referenced by getCigarCharOpFromQueryIndex(), getCigarCharOpFromRefOffset(), and getCigarCharOpFromRefPos().

00296 {
00297     // Check if the expanded cigar has been set yet
00298     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00299     {
00300         // Set the expanded cigar.
00301         setQueryAndReferenceIndexes();
00302     }
00303 
00304     // Check to see if the index is in range.
00305     if((expandedCigarIndex < 0) || 
00306        ((uint32_t)expandedCigarIndex >= myExpandedCigar.length()))
00307     {
00308         return('?');
00309     }
00310     return(myExpandedCigar[expandedCigarIndex]);
00311 }

char Cigar::getCigarCharOpFromQueryIndex ( int32_t  queryIndex  ) 

Return the character code of the cigar operator associated with the specified queryIndex.

'?' is returned for an out of range index.

Definition at line 314 of file Cigar.cpp.

References getCigarCharOp(), and getExpandedCigarIndexFromQueryIndex().

00315 {
00316     return(getCigarCharOp(getExpandedCigarIndexFromQueryIndex(queryIndex)));
00317 }

char Cigar::getCigarCharOpFromRefOffset ( int32_t  refOffset  ) 

Return the character code of the cigar operator associated with the specified reference offset.

'?' is returned for an out of range offset.

Definition at line 320 of file Cigar.cpp.

References getCigarCharOp(), and getExpandedCigarIndexFromRefOffset().

00321 {
00322     return(getCigarCharOp(getExpandedCigarIndexFromRefOffset(refOffset)));
00323 }

char Cigar::getCigarCharOpFromRefPos ( int32_t  refPosition,
int32_t  queryStartPos 
)

Return the character code of the cigar operator associated with the specified reference position.

'?' is returned for an out of range reference position.

Definition at line 326 of file Cigar.cpp.

References getCigarCharOp(), and getExpandedCigarIndexFromRefPos().

00327 {
00328     return(getCigarCharOp(getExpandedCigarIndexFromRefPos(refPosition, queryStartPos)));
00329 }

void Cigar::getCigarString ( std::string &  cigarString  )  const

Set the passed in std::string to the string reprentation of the Cigar operations in this object.

Definition at line 36 of file Cigar.cpp.

00037 {
00038     using namespace STLUtilities;
00039 
00040     std::vector<CigarOperator>::const_iterator i;
00041 
00042     cigarString.clear();  // clear result string
00043 
00044     // Progressively append the character representations of the operations to
00045     // the cigar string.
00046     for (i = cigarOperations.begin(); i != cigarOperations.end(); i++)
00047     {
00048         cigarString << (*i).count << (*i).getChar();
00049     }
00050 }

void Cigar::getCigarString ( String cigarString  )  const

Set the passed in String to the string reprentation of the Cigar operations in this object.

Definition at line 52 of file Cigar.cpp.

Referenced by Dump(), and SamRecord::setCigar().

00053 {
00054     std::string cigar;
00055 
00056     getCigarString(cigar);
00057 
00058     cigarString = cigar.c_str();
00059 
00060     return;
00061 }

int32_t Cigar::getExpandedCigarIndexFromQueryIndex ( int32_t  queryIndex  ) 

Returns the index into the expanded cigar for the cigar associated with the specified queryIndex.

INDEX_NA returned if the index is out of range.

Definition at line 258 of file Cigar.cpp.

References INDEX_NA.

Referenced by getCigarCharOpFromQueryIndex().

00259 {
00260     // If the vectors aren't set, set them.
00261     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00262     {
00263         setQueryAndReferenceIndexes();
00264     }
00265     if ((queryIndex < 0) || ((uint32_t)queryIndex >= queryToCigar.size()))
00266     {
00267         return(INDEX_NA);
00268     }
00269     return(queryToCigar[queryIndex]);
00270 }

int32_t Cigar::getExpandedCigarIndexFromRefOffset ( int32_t  refOffset  ) 

Returns the index into the expanded cigar for the cigar associated with the specified reference offset.

INDEX_NA returned if the offset is out of range.

Definition at line 273 of file Cigar.cpp.

References INDEX_NA.

Referenced by getCigarCharOpFromRefOffset(), and getExpandedCigarIndexFromRefPos().

00274 {
00275     // If the vectors aren't set, set them.
00276     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00277     {
00278         setQueryAndReferenceIndexes();
00279     }
00280     if ((refOffset < 0) || ((uint32_t)refOffset >= refToCigar.size()))
00281     {
00282         return(INDEX_NA);
00283     }
00284     return(refToCigar[refOffset]);
00285 }

int32_t Cigar::getExpandedCigarIndexFromRefPos ( int32_t  refPosition,
int32_t  queryStartPos 
)

Returns the index into the expanded cigar for the cigar associated with the specified reference position and queryStartPos.

INDEX_NA returned if the position is out of range.

Definition at line 288 of file Cigar.cpp.

References getExpandedCigarIndexFromRefOffset().

Referenced by getCigarCharOpFromRefPos().

00290 {
00291     return(getExpandedCigarIndexFromRefOffset(refPosition - queryStartPos));
00292 }

void Cigar::getExpandedString ( std::string &  s  )  const

Sets the specified string to a valid CIGAR string of characters that represent the cigar with no digits (a CIGAR of "3M" would return "MMM").

The returned string is actually also a valid CIGAR string. In theory this makes it easier to parse some reads.

Returns:
s the string to populate

Definition at line 63 of file Cigar.cpp.

00064 {
00065     s = "";
00066 
00067     std::vector<CigarOperator>::const_iterator i;
00068 
00069     // Progressively append the character representations of the operations to
00070     // the string passed in
00071 
00072     for (i = cigarOperations.begin(); i != cigarOperations.end(); i++)
00073     {
00074         for (uint32_t j = 0; j<(*i).count; j++) s += (*i).getChar();
00075     }
00076     return;
00077 }

int Cigar::getExpectedQueryBaseCount (  )  const

Return the length of the read that corresponds to the current CIGAR string.

For validation, we should expect that a sequence read in a SAM file will be the same length as the value returned by this method.

Example: 3M2D3M describes a read with three bases matching the reference, then skips 2 bases, then has three more bases that match the reference (match/mismatch). In this case, the read length is expected to be 6.

Example: 3M2I3M describes a read with 3 match/mismatch bases, two extra bases, and then 3 more match/mistmatch bases. The total in this example is 8 bases.

Returns:
returns the expected read length

Definition at line 95 of file Cigar.cpp.

References insert, match, mismatch, and softClip.

Referenced by SamValidator::isValidCigar(), and SamFilter::softClip().

00096 {
00097     int matchCount = 0;
00098     std::vector<CigarOperator>::const_iterator i;
00099     for (i = cigarOperations.begin(); i != cigarOperations.end(); i++)
00100     {
00101         switch (i->operation)
00102         {
00103             case match:
00104             case mismatch:
00105             case softClip:
00106             case insert:
00107                 matchCount += i->count;
00108                 break;
00109             default:
00110                 // we only care about operations that are in the query sequence.
00111                 break;
00112         }
00113     }
00114     return matchCount;
00115 }

int Cigar::getExpectedReferenceBaseCount (  )  const

Return the number of bases in the reference that this CIGAR "spans".

When doing range checking, we occassionally need to know how many total bases the CIGAR string represents as compared to the reference.

Examples: 3M2D3M describes a read that overlays 8 bases in the reference. 3M2I3M describes a read with 3 bases that match the reference, two additional bases that aren't in the reference, and 3 more bases that match the reference, so it spans 6 bases in the reference.

Returns:
how many bases in the reference are spanned by the given CIGAR string

Definition at line 120 of file Cigar.cpp.

References del, match, mismatch, and skip.

Referenced by SamTags::createMDTag().

00121 {
00122     int matchCount = 0;
00123     std::vector<CigarOperator>::const_iterator i;
00124     for (i = cigarOperations.begin(); i != cigarOperations.end(); i++)
00125     {
00126         switch (i->operation)
00127         {
00128             case match:
00129             case mismatch:
00130             case del:
00131             case skip:
00132                 matchCount += i->count;
00133                 break;
00134             default:
00135                 // we only care about operations that are in the reference sequence.
00136                 break;
00137         }
00138     }
00139     return matchCount;
00140 }

uint32_t Cigar::getNumOverlaps ( int32_t  start,
int32_t  end,
int32_t  queryStartPos 
)

Return the number of bases that overlap the reference and the read associated with this cigar that falls within the specified region.

Parameters:
start : inclusive 0-based start position (reference position) of the region to check for overlaps in (-1 indicates to start at the beginning of the reference.)
end : exclusive 0-based end position (reference position) of the region to check for overlaps in (-1 indicates to go to the end of the reference.)
queryStartPos : 0-based leftmost mapping position of the first matcihng base in the query.

Definition at line 334 of file Cigar.cpp.

References getRefOffset().

Referenced by SamRecord::getNumOverlaps().

00336 {
00337     // Get the overlap info.
00338     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00339     {
00340         setQueryAndReferenceIndexes();
00341     }
00342 
00343     // Get the start and end offsets.
00344     int32_t startRefOffset = 0;
00345     // If the specified start is more than the queryStartPos, set
00346     // the startRefOffset to the appropriate non-zero value.
00347     // (if start is <= queryStartPos, than startRefOffset is 0 - it should
00348     // not be set to a negative value.)
00349     if (start > queryStartPos)
00350     {
00351         startRefOffset = start - queryStartPos;
00352     }
00353 
00354     int32_t endRefOffset = end - queryStartPos;
00355     if (end  == -1)
00356     {
00357         // -1 means that the region goes to the end of the refrerence.
00358         // So set endRefOffset to the max refOffset + 1 which is the
00359         // size of the refToQuery vector.
00360         endRefOffset = refToQuery.size();
00361     }
00362 
00363 
00364     // if endRefOffset is less than 0, then this read does not fall within
00365     // the specified region, so return 0.
00366     if (endRefOffset < 0)
00367     {
00368         return(0);
00369     }
00370 
00371     // Get the overlaps for these offsets.
00372     // Loop through the read counting positions that match the reference
00373     // within this region.
00374     int32_t refOffset = 0;
00375     int32_t numOverlaps = 0;
00376     for (unsigned int queryIndex = 0; queryIndex < queryToRef.size();
00377             queryIndex++)
00378     {
00379         refOffset = getRefOffset(queryIndex);
00380         if (refOffset > endRefOffset)
00381         {
00382             // Past the end of the specified region, so stop checking
00383             // for overlaps since there will be no more.
00384             break;
00385         }
00386         else if ((refOffset >= startRefOffset) && (refOffset < endRefOffset))
00387         {
00388             // within the region, increment the counter.
00389             ++numOverlaps;
00390         }
00391     }
00392 
00393     return(numOverlaps);
00394 }

int32_t Cigar::getQueryIndex ( int32_t  refPosition,
int32_t  queryStartPos 
)

Return the query index or INDEX_NA associated with the specified reference offset when the query starts at the specified reference position.

Definition at line 240 of file Cigar.cpp.

References INDEX_NA.

00241 {
00242     // If the vectors aren't set, set them.
00243     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00244     {
00245         setQueryAndReferenceIndexes();
00246     }
00247 
00248     int32_t refOffset = refPosition - queryStartPos;
00249     if ((refOffset < 0) || ((uint32_t)refOffset >= refToQuery.size()))
00250     {
00251         return(INDEX_NA);
00252     }
00253 
00254     return(refToQuery[refOffset]);
00255 }

int32_t Cigar::getQueryIndex ( int32_t  refOffset  ) 

Return the query index associated with the specified reference offset or INDEX_NA based on this cigar.

Definition at line 202 of file Cigar.cpp.

References INDEX_NA.

Referenced by PileupElementBaseQual::addEntry(), SamRecordHelper::checkSequence(), and SamTags::createMDTag().

00203 {
00204     // If the vectors aren't set, set them.
00205     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00206     {
00207         setQueryAndReferenceIndexes();
00208     }
00209     if ((refOffset < 0) || ((uint32_t)refOffset >= refToQuery.size()))
00210     {
00211         return(INDEX_NA);
00212     }
00213     return(refToQuery[refOffset]);
00214 }

int32_t Cigar::getRefOffset ( int32_t  queryIndex  ) 

Return the reference offset associated with the specified query index or INDEX_NA based on this cigar.

Definition at line 187 of file Cigar.cpp.

References INDEX_NA.

Referenced by SamQuerySeqWithRefIter::getNextMatchMismatch(), getNumOverlaps(), SamQuerySeqWithRef::seqWithEquals(), and SamQuerySeqWithRef::seqWithoutEquals().

00188 {
00189     // If the vectors aren't set, set them.
00190     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00191     {
00192         setQueryAndReferenceIndexes();
00193     }
00194     if ((queryIndex < 0) || ((uint32_t)queryIndex >= queryToRef.size()))
00195     {
00196         return(INDEX_NA);
00197     }
00198     return(queryToRef[queryIndex]);
00199 }

int32_t Cigar::getRefPosition ( int32_t  queryIndex,
int32_t  queryStartPos 
)

Return the reference position associated with the specified query index or INDEX_NA based on this cigar and the specified queryStartPos which is the leftmost mapping position of the first matching base in the query.

Definition at line 217 of file Cigar.cpp.

References INDEX_NA.

Referenced by SamFilter::softClip().

00218 {
00219     // If the vectors aren't set, set them.
00220     if ((queryToRef.size() == 0) || (refToQuery.size() == 0))
00221     {
00222         setQueryAndReferenceIndexes();
00223     }
00224     if ((queryIndex < 0) || ((uint32_t)queryIndex >= queryToRef.size()))
00225     {
00226         return(INDEX_NA);
00227     }
00228 
00229     if (queryToRef[queryIndex] != INDEX_NA)
00230     {
00231         return(queryToRef[queryIndex] + queryStartPos);
00232     }
00233     return(INDEX_NA);
00234 }

bool Cigar::hasIndel (  ) 

Return whether or not the cigar has indels (insertions or delections).

Returns:
true if it has an insertion or deletion, false if not.

Definition at line 398 of file Cigar.cpp.

References del, and insert.

00399 {
00400     for(unsigned int i = 0; i < cigarOperations.size(); i++)
00401     {
00402         if((cigarOperations[i].operation == insert) ||
00403            (cigarOperations[i].operation == del))
00404         {
00405             // Found an indel, so return true.
00406             return(true);
00407         }
00408     }
00409     // Went through all the operations, and found no indel, so return false.
00410     return(false);
00411 }

static bool Cigar::isClip ( const CigarOperator op  )  [inline, static]

Return true if the specified operation is a clipping operation, false if not.

Definition at line 291 of file Cigar.h.

References isClip().

00292     {
00293         return(isClip(op.operation));
00294     }

static bool Cigar::isClip ( char  op  )  [inline, static]

Return true if the specified operation is a clipping operation, false if not.

Definition at line 276 of file Cigar.h.

00277     {
00278         switch(op)
00279         {
00280             case 'S':
00281             case 'H':
00282                 return true;
00283             default:
00284                 return false;
00285         }
00286         return false;
00287     }

static bool Cigar::isClip ( Operation  op  )  [inline, static]

Return true if the specified operation is a clipping operation, false if not.

Definition at line 261 of file Cigar.h.

References hardClip, and softClip.

Referenced by isClip(), SamFilter::softClip(), and CigarHelper::softClipEndByRefPos().

00262     {
00263         switch(op)
00264         {
00265             case softClip:
00266             case hardClip:
00267                 return true;
00268             default:
00269                 return false;
00270         }
00271         return false;
00272     }

static bool Cigar::isMatchOrMismatch ( const CigarOperator op  )  [inline, static]

Return true if the specified operation is a match/mismatch operation, false if not.

Definition at line 313 of file Cigar.h.

References isMatchOrMismatch().

00314     {
00315         return(isMatchOrMismatch(op.operation));
00316     }

static bool Cigar::isMatchOrMismatch ( Operation  op  )  [inline, static]

Return true if the specified operation is a match/mismatch operation, false if not.

Definition at line 298 of file Cigar.h.

References match, and mismatch.

Referenced by isMatchOrMismatch(), and SamRecord::shiftIndelsLeft().

00299     {
00300         switch(op)
00301         {
00302             case match:
00303             case mismatch:
00304                 return true;
00305             default:
00306                 return false;
00307         }
00308         return false;
00309     }

bool Cigar::operator== ( Cigar rhs  )  const

Return true if the 2 Cigars are the same (the same operations of the same sizes).

Definition at line 80 of file Cigar.cpp.

References size().

00081 {
00082 
00083     if (this->size() != rhs.size()) return false;
00084 
00085     for (int i = 0; i < this->size(); i++)
00086     {
00087         if (cigarOperations[i]!=rhs.cigarOperations[i]) return false;
00088     }
00089     return true;
00090 }


Member Data Documentation

const int32_t Cigar::INDEX_NA = -1 [static]

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.

Definition at line 492 of file Cigar.h.

Referenced by PileupElementBaseQual::addEntry(), SamRecordHelper::checkSequence(), SamTags::createMDTag(), getExpandedCigarIndexFromQueryIndex(), getExpandedCigarIndexFromRefOffset(), SamQuerySeqWithRefIter::getNextMatchMismatch(), getQueryIndex(), getRefOffset(), getRefPosition(), SamQuerySeqWithRef::seqWithEquals(), and SamQuerySeqWithRef::seqWithoutEquals().


The documentation for this class was generated from the following files:
Generated on Mon Feb 11 13:45:21 2013 for libStatGen Software by  doxygen 1.6.3