kaori
A C++ library for barcode extraction and matching
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kaori::AnyMismatches Class Reference

Search for barcodes with mismatches anywhere. More...

#include <MismatchTrie.hpp>

Inheritance diagram for kaori::AnyMismatches:
Inheritance graph
[legend]
Collaboration diagram for kaori::AnyMismatches:
Collaboration graph
[legend]

Public Member Functions

 AnyMismatches ()
 
 AnyMismatches (size_t barcode_length, DuplicateAction duplicates)
 
std::pair< int, int > search (const char *search_seq, int max_mismatches) const
 
- Public Member Functions inherited from kaori::MismatchTrie
 MismatchTrie ()
 
 MismatchTrie (size_t barcode_length, DuplicateAction duplicates)
 
AddStatus add (const char *barcode_seq)
 
size_t get_length () const
 
int size () const
 
void optimize ()
 

Additional Inherited Members

- Static Public Attributes inherited from kaori::MismatchTrie
static constexpr int STATUS_MISSING = -1
 
static constexpr int STATUS_AMBIGUOUS = -2
 

Detailed Description

Search for barcodes with mismatches anywhere.

This MismatchTrie subclass will search for the best match to known sequences in a barcode pool. Any number of mismatches are supported, distributed anywhere throughout the sequence.

Constructor & Destructor Documentation

◆ AnyMismatches() [1/2]

kaori::AnyMismatches::AnyMismatches ( )
inline

Default constructor. This is only provided to enable composition, the resulting object should not be used until it is copy-assigned to a properly constructed instance.

◆ AnyMismatches() [2/2]

kaori::AnyMismatches::AnyMismatches ( size_t  barcode_length,
DuplicateAction  duplicates 
)
inline
Parameters
barcode_lengthLength of the barcode sequences.
duplicatesHow duplicate sequences across add() calls should be handled.

Member Function Documentation

◆ search()

std::pair< int, int > kaori::AnyMismatches::search ( const char *  search_seq,
int  max_mismatches 
) const
inline
Parameters
[in]search_seqPointer to a character array containing a sequence to use for searching the barcode pool. This is assumed to be of length equal to get_length() and is typically derived from a read.
max_mismatchesMaximum number of mismatches in the search.
Returns
Pair containing:
  1. The index of the barcode sequence with the lowest number of mismatches to search_seq. This is only non-negative if a barcode was unambiguously matched with no more mismatches than max_mismatches. If multiple sequences have the same lowest number of mismatches, the match is ambiguous and MismatchTrie::STATUS_AMBIGUOUS is returned. If all sequences have more mismatches than max_mismatches, MismatchTrie::STATUS_MISSING is returned.
  2. The number of mismatches.

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