Pileup< PILEUP_TYPE, FUNC_CLASS > Class Template Reference

Collaboration diagram for Pileup< PILEUP_TYPE, FUNC_CLASS >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Pileup (const FUNC_CLASS &fp=FUNC_CLASS())
 Pileup (int window, const FUNC_CLASS &fp=FUNC_CLASS())
 Pileup (const std::string &refSeqFileName, const FUNC_CLASS &fp=FUNC_CLASS())
 Pileup (int window, const std::string &refSeqFileName, const FUNC_CLASS &fp=FUNC_CLASS())
virtual int processFile (const std::string &fileName, uint16_t excludeFlag=0x0704, uint16_t includeFlag=0)
virtual void processAlignment (SamRecord &record)
 Add an alignment to the pileup.
virtual void processAlignmentRegion (SamRecord &record, int startPos, int endPos, PosList *excludeList=NULL)
 Add only positions that fall within the specified region of the alignment to the pileup and outside of the specified excluded positions.
void flushPileup ()

Protected Member Functions

void addAlignmentPosition (int refPosition, SamRecord &record)
virtual void flushPileup (int refID, int refPosition)
void flushPileup (int refPosition)
int pileupPosition (int refPosition)
virtual void resetElement (PILEUP_TYPE &element, int position)
virtual void addElement (PILEUP_TYPE &element, SamRecord &record)
virtual void analyzeElement (PILEUP_TYPE &element)
virtual void analyzeHead ()

Protected Attributes

FUNC_CLASS myAnalyzeFuncPtr
std::vector< PILEUP_TYPE > myElements
int pileupStart
int pileupHead
int pileupTail
int pileupWindow
int myCurrentRefID
GenomeSequencemyRefPtr

Detailed Description

template<class PILEUP_TYPE, class FUNC_CLASS = defaultPileup<PILEUP_TYPE>>
class Pileup< PILEUP_TYPE, FUNC_CLASS >

Definition at line 49 of file Pileup.h.


Member Function Documentation

template<class PILEUP_TYPE , class FUNC_CLASS >
void Pileup< PILEUP_TYPE, FUNC_CLASS >::processAlignmentRegion ( SamRecord record,
int  startPos,
int  endPos,
PosList excludeList = NULL 
) [inline, virtual]

Add only positions that fall within the specified region of the alignment to the pileup and outside of the specified excluded positions.

Parameters:
record alignment to be added to the pileup.
startPos 0-based start position of the bases that should be added to the pileup.
endPos 0-based end position of the bases that should be added to the pileup (this position is not added). Set to -1 if there is no end position to the region.
excludeList list of refID/positions to exclude from processing.

Definition at line 299 of file Pileup.h.

References SamRecord::get0BasedAlignmentEnd(), SamRecord::get0BasedPosition(), SamRecord::getReferenceID(), and PosList::hasPosition().

00303 {
00304     int refPosition = record.get0BasedPosition();
00305     int refID = record.getReferenceID();
00306 
00307     // Flush any elements from the pileup that are prior to this record
00308     // since the file is sorted, we are done with those positions.
00309     flushPileup(refID, refPosition);
00310     
00311     // Check if the region starts after this reference starts.  If so,
00312     // we only want to start adding at the region start position.
00313     if(startPos > refPosition)
00314     {
00315         refPosition = startPos;
00316     }
00317 
00318     // Loop through for each reference position covered by the record.
00319     // It is up to the PILEUP_TYPE to handle insertions/deletions, etc
00320     // that are related with the given reference position.
00321     for(; refPosition <= record.get0BasedAlignmentEnd(); ++refPosition)
00322     {
00323         // Check to see if we have gone past the end of the region, in which
00324         // case we can stop processing this record.  Check >= since the
00325         // end position is not in the region.
00326         if((endPos != -1) && (refPosition >= endPos))
00327         {
00328             break;
00329         }
00330 
00331         // Check to see if this position is in the exclude list.
00332         bool addPos = true;
00333         if(excludeList != NULL)
00334         {
00335             // There is an exclude list, so lookup the position.
00336             if(excludeList->hasPosition(refID, refPosition))
00337             {
00338                 // This position is in the exclude list, so don't add it.
00339                 addPos = false;
00340             }
00341         }
00342         if(addPos)
00343         {
00344             addAlignmentPosition(refPosition, record);
00345         }
00346     }
00347 }


The documentation for this class was generated from the following file:
Generated on Tue Sep 6 17:52:04 2011 for libStatGen Software by  doxygen 1.6.3