BamTools  2.4.1
Public Member Functions | List of all members
BamTools::Algorithms::Sort::ByTag< T > Struct Template Reference

Function object for comparing alignments by tag value. More...

#include <Sort.h>

Inherits AlignmentSortBase.

Public Member Functions

 ByTag (const std::string &tag, const Sort::Order &order=Sort::AscendingOrder)
 
bool operator() (const BamTools::BamAlignment &lhs, const BamTools::BamAlignment &rhs)
 

Detailed Description

template<typename T>
struct BamTools::Algorithms::Sort::ByTag< T >

Function object for comparing alignments by tag value.

Default sort order is Sort::AscendingOrder.

std::vector<BamAlignment> a;
// sort by edit distance, in ascending order (the following two lines are equivalent):
std::sort( a.begin(), a.end(), Sort::ByTag<int>("NM") );
std::sort( a.begin(), a.end(), Sort::ByTag<int>("NM", Sort::AscendingOrder) );
// OR sort in descending order
std::sort( a.begin(), a.end(), Sort::ByTag<int>("NM", Sort::DescendingOrder) );

Constructor & Destructor Documentation

◆ ByTag()

template<typename T >
BamTools::Algorithms::Sort::ByTag< T >::ByTag ( const std::string &  tag,
const Sort::Order order = Sort::AscendingOrder 
)
inline

Member Function Documentation

◆ operator()()

template<typename T >
bool BamTools::Algorithms::Sort::ByTag< T >::operator() ( const BamTools::BamAlignment lhs,
const BamTools::BamAlignment rhs 
)
inline

The documentation for this struct was generated from the following file: