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 the search on a read sequence. More... | |
Public Member Functions | |
SimpleSingleMatch (const char *template_seq, size_t template_length, const BarcodePool &barcode_pool, const Options &options) | |
State | initialize () const |
void | reduce (State &state) |
bool | search_first (const char *read_seq, size_t read_length, State &state) const |
bool | search_best (const char *read_seq, size_t 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 barcoding element, i.e., the realization of the template where the variable region is replaced with one sequence from a pool of known barcodes. No restrictions are placed on the distribution of mismatches throughout the barcoding element.
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. On return, optimizations from state
are incorporated into this SimpleSingleMatch
instance.
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 barcoding element. 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 barcoding element. A match is only reported if the number of mismatches of the entire barcoding element's 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.