本文整理汇总了C++中SamRecord::setFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ SamRecord::setFlag方法的具体用法?C++ SamRecord::setFlag怎么用?C++ SamRecord::setFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SamRecord
的用法示例。
在下文中一共展示了SamRecord::setFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filterRead
void SamFilter::filterRead(SamRecord& record)
{
// Filter the read by marking it as unmapped.
uint16_t flag = record.getFlag();
SamFlag::setUnmapped(flag);
// Clear N/A flags.
flag &= ~SamFlag::PROPER_PAIR;
flag &= ~SamFlag::SECONDARY_ALIGNMENT;
flag &= ~SamFlag::SUPPLEMENTARY_ALIGNMENT;
record.setFlag(flag);
// Clear Cigar
record.setCigar("*");
// Clear mapping quality
record.setMapQuality(0);
}
示例2: execute
//.........这里部分代码省略.........
Logger::gLogger->writeLog("Sorting the indices of %d duplicated records",
myDupList.size());
// sort the indices of duplicate records
std::sort(myDupList.begin(), myDupList.end(),
std::less<uint32_t> ());
// get ready to write the output file by making a second pass
// through the input file
samIn.OpenForRead(inFile.c_str());
samIn.ReadHeader(header);
SamFile samOut;
samOut.OpenForWrite(outFile.c_str());
samOut.WriteHeader(header);
// If we are recalibrating, output the model information.
if(myDoRecab)
{
myRecab.modelFitPrediction(outFile);
}
// an iterator to run through the duplicate indices
int currentDupIndex = 0;
bool moreDups = !myDupList.empty();
// let the user know what we're doing
Logger::gLogger->writeLog("\nWriting %s", outFile.c_str());
// count the duplicate records as a check
uint32_t singleDuplicates(0), pairedDuplicates(0);
// start reading records and writing them out
SamRecord record;
while(samIn.ReadRecord(header, record))
{
uint32_t currentIndex = samIn.GetCurrentRecordCount();
bool foundDup = moreDups &&
(currentIndex == myDupList[currentDupIndex]);
// modify the duplicate flag and write out the record,
// if it's appropriate
int flag = record.getFlag();
if (foundDup)
{
// this record is a duplicate, so mark it.
record.setFlag( flag | 0x400 );
currentDupIndex++;
// increment duplicate counters to verify we found them all
if ( ( ( flag & 0x0001 ) == 0 ) || ( flag & 0x0008 ) )
{ // unpaired or mate unmapped
singleDuplicates++;
}
else
{
pairedDuplicates++;
}
// recalibrate if necessary.
if(myDoRecab)
{
myRecab.processReadApplyTable(record);
}
// write the record if we are not removing duplicates
if (!removeFlag ) samOut.WriteRecord(header, record);
}
else
{
if(myForceFlag)
{
// this is not a duplicate we've identified but we want to
// remove any duplicate marking
record.setFlag( flag & 0xfffffbff ); // unmark duplicate
}
// Not a duplicate, so recalibrate if necessary.
if(myDoRecab)
{
myRecab.processReadApplyTable(record);
}
samOut.WriteRecord(header, record);
}
// Let the user know we're still here
if (verboseFlag && (currentIndex % 100000 == 0)) {
Logger::gLogger->writeLog("recordCount=%u", currentIndex);
}
}
// We're done. Close the files and print triumphant messages.
samIn.Close();
samOut.Close();
Logger::gLogger->writeLog("Successfully %s %u unpaired and %u paired duplicate reads",
removeFlag ? "removed" : "marked" ,
singleDuplicates,
pairedDuplicates/2);
Logger::gLogger->writeLog("\nDedup_LowMem complete!");
return 0;
}