kaori
A C++ library for barcode extraction and matching
|
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 |
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.
max_size_ | Maximum length of the template sequence. |
|
inline |
[in] | template_seq | Pointer to a character array containing the template sequence, see ScanTemplate . |
template_length | Length of the array pointed to by barcode_length . This should be less than or equal to max_size_ . | |
barcode_pool | Known sequences for the single variable region in template_seq . | |
options | Optional parameters. |
|
inline |
Initialize the search state for thread-safe execution.
State
object.
|
inline |
Incorporate search cache optimizations from state
, see SimpleBarcodeSearch::reduce()
for details. This allows regular consolidation and sharing of optimizations across threads.
state | A state object generated by initialize() . Typically this has been used in search_first() or search_best() at least once. |
|
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.
[in] | read_seq | Pointer to a character array containing the read sequence. |
read_length | Length of the read sequence. | |
state | State object, used to store the search result. |
true
, state
is filled with the details of the best match.
|
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.
[in] | read_seq | Pointer to a character array containing the read sequence. |
read_length | Length of the read sequence. | |
state | State object, used to store the search result. |
true
, state
is filled with the details of the first match.