本文整理汇总了C++中bamtools::BamAlignment::IsPrimaryAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ BamAlignment::IsPrimaryAlignment方法的具体用法?C++ BamAlignment::IsPrimaryAlignment怎么用?C++ BamAlignment::IsPrimaryAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bamtools::BamAlignment
的用法示例。
在下文中一共展示了BamAlignment::IsPrimaryAlignment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readAlignmentPair
// Read an alignment pair from the BamReader.
// Returns false if the read fails
bool readAlignmentPair(BamTools::BamReader* pReader,
BamTools::BamAlignment& record1,
BamTools::BamAlignment& record2)
{
// Read a pair from the BAM
// Read record 1. Skip secondary alignments of the previous pair
do
{
if(!pReader->GetNextAlignment(record1))
return false;
} while(!record1.IsPrimaryAlignment());
// Read record 2.
do
{
if(!pReader->GetNextAlignment(record2))
return false;
} while(!record2.IsPrimaryAlignment());
return true;
}
示例2: GetReadLength
uint32_t BamAlignmentReader::GetReadLength(const std::string& bamPath)
{
uint32_t bamReadLength = 300;
BamTools::BamReader bamReader;
if (!bamReader.Open(bamPath))
{
throw "Unable to open bam file";
}
BamTools::BamAlignment bamAlignment;
while(bamReader.GetNextAlignment(bamAlignment))
{
if (bamAlignment.IsPrimaryAlignment())
{
bamReadLength = bamAlignment.QueryBases.size();
break;
}
}
bamReader.Close();
return bamReadLength;
}