BamTools 2.5.2
Loading...
Searching...
No Matches
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) const
 

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) );
Function object for comparing alignments by tag value.
@ DescendingOrder
Definition Sort.h:37
@ AscendingOrder
Definition Sort.h:36

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 ) const
inline

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