本文整理汇总了C++中bamtools::BamAlignment::IsDuplicate方法的典型用法代码示例。如果您正苦于以下问题:C++ BamAlignment::IsDuplicate方法的具体用法?C++ BamAlignment::IsDuplicate怎么用?C++ BamAlignment::IsDuplicate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bamtools::BamAlignment
的用法示例。
在下文中一共展示了BamAlignment::IsDuplicate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::vector< IAlignment::SharedPtr > BamAlignmentReader::loadAlignmentsInRegion(Region::SharedPtr regionPtr, SampleManager::SharedPtr sampleManagerPtr, bool excludeDuplicateReads)
{
if (!m_is_open)
{
std::cout << "Bam file not opened" << std::endl;
exit(0);
}
std::vector< IAlignment::SharedPtr > alignmentPtrs;
int refID = this->m_bam_reader->GetReferenceID(regionPtr->getReferenceID());
// add 1 to the start and end positions because this is 0 based
this->m_bam_reader->SetRegion(refID, regionPtr->getStartPosition(), refID, regionPtr->getEndPosition());
// std::cout << "BamAlignmentReader.cpp refID: " << refID << std::endl;
BamTools::BamAlignment bamAlignment;
while(this->m_bam_reader->GetNextAlignment(bamAlignment))
{
if (bamAlignment.IsDuplicate() && excludeDuplicateReads) { continue; }
std::string sampleName;
bamAlignment.GetTag("RG", sampleName);
Sample::SharedPtr samplePtr = sampleManagerPtr->getSamplePtr(sampleName);
if (samplePtr == nullptr)
{
throw "There was an error in the sample name for: " + sampleName;
}
alignmentPtrs.push_back(std::make_shared< BamAlignment >(bamAlignment, samplePtr));
}
// std::this_thread::sleep_for(std::chrono::milliseconds(10000));
if (m_alignment_reader_manager_ptr != nullptr)
{
m_alignment_reader_manager_ptr->checkinReader(this->shared_from_this());
}
// std::cout << "got reads: " << regionPtr->getRegionString() << " " << alignmentPtrs.size() << std::endl;
return alignmentPtrs;
}