kaori
A C++ library for barcode extraction and matching
Loading...
Searching...
No Matches
kaori::SimpleSingleMatch< max_size_ > Class Template Reference

Search for a template with a single variable region. More...

#include <SimpleSingleMatch.hpp>

Classes

struct  Options
 Optional parameters for SimpleSingleMatch. More...
 
struct  State
 State of search(). More...
 

Public Member Functions

 SimpleSingleMatch (const char *template_seq, SeqLength template_length, const BarcodePool &barcode_pool, const Options &options)
 
State initialize () const
 
void reduce (State &state)
 
bool search_first (const char *read_seq, SeqLength read_length, State &state) const
 
bool search_best (const char *read_seq, SeqLength read_length, State &state) const
 

Detailed Description

template<SeqLength max_size_>
class kaori::SimpleSingleMatch< max_size_ >

Search for a template with a single variable region.

This class implements the most common use case for barcode matching, where the template sequence has a single variable region. It will find a match to any valid vector sequence (i.e., the template after replacing the variable region with one of the known barcodes) in the read. No restrictions are placed on the distribution of mismatches throughout the vector sequence.

Template Parameters
max_size_Maximum length of the template sequence.

Constructor & Destructor Documentation

◆ SimpleSingleMatch()

template<SeqLength max_size_>
kaori::SimpleSingleMatch< max_size_ >::SimpleSingleMatch ( const char * template_seq,
SeqLength template_length,
const BarcodePool & barcode_pool,
const Options & options )
inline
Parameters
[in]template_seqPointer to a character array containing the template sequence, see ScanTemplate.
template_lengthLength of the array pointed to by barcode_length. This should be less than or equal to max_size_.
barcode_poolKnown sequences for the single variable region in template_seq.
optionsOptional parameters.

Member Function Documentation

◆ initialize()

template<SeqLength max_size_>
State kaori::SimpleSingleMatch< max_size_ >::initialize ( ) const
inline

Initialize the search state for thread-safe execution.

Returns
A new State object.

◆ reduce()

template<SeqLength max_size_>
void kaori::SimpleSingleMatch< max_size_ >::reduce ( State & state)
inline

Incorporate search cache optimizations from state, see SimpleBarcodeSearch::reduce() for details. This allows regular consolidation and sharing of optimizations across threads.

Parameters
stateA state object generated by initialize(). Typically this has been used in search_first() or search_best() at least once.

◆ search_best()

template<SeqLength max_size_>
bool kaori::SimpleSingleMatch< max_size_ >::search_best ( const char * read_seq,
SeqLength read_length,
State & state ) const
inline

Search a read for the best match to a valid vector sequence. This is slower than search_first() but will find the matching position with the fewest mismatches. If multiple positions are tied for the fewest mismatches, no match is reported.

Parameters
[in]read_seqPointer to a character array containing the read sequence.
read_lengthLength of the read sequence.
stateState object, used to store the search result.
Returns
Whether a match was found. If true, state is filled with the details of the best match.

◆ search_first()

template<SeqLength max_size_>
bool kaori::SimpleSingleMatch< max_size_ >::search_first ( const char * read_seq,
SeqLength read_length,
State & state ) const
inline

Search a read for the first match to a valid vector sequence. A match is only reported if the number of mismatches of the vector sequence to the read is no greater than max_mismatches (see the constructor) and there is exactly one barcode sequence with the fewest mismatches to the read sequence at the variable region.

Parameters
[in]read_seqPointer to a character array containing the read sequence.
read_lengthLength of the read sequence.
stateState object, used to store the search result.
Returns
Whether an appropriate match was found. If true, state is filled with the details of the first match.

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