kaori
A C++ library for barcode extraction and matching
|
Search for known barcode sequences with segmented mismatches. More...
#include <BarcodeSearch.hpp>
Classes | |
struct | Options |
Optional parameters for a SegmentedBarcodeSearch . More... | |
struct | State |
State of the search. More... | |
Public Member Functions | |
SegmentedBarcodeSearch () | |
SegmentedBarcodeSearch (const BarcodePool &barcode_pool, std::array< int, num_segments > segments, const Options &options) | |
State | initialize () const |
void | reduce (State &state) |
void | search (const std::string &search_seq, State &state) const |
void | search (const std::string &search_seq, State &state, std::array< int, num_segments > allowed_mismatches) const |
Search for known barcode sequences with segmented mismatches.
This supports exact and mismatch-aware searches for known sequences. Mismatches are restricted by segments along the sequence, see SegmentedMismatches
for details. Instances of this class use caching to avoid redundant work when a mismatching sequence has been previously encountered.
num_segments | Number of segments to consider. |
|
inline |
Default constructor.
|
inline |
barcode_pool | Pool of barcode sequences. |
segments | Size of each segment. All values should be positive and their sum should be equal to the barcode length. |
options | Optional parameters. |
|
inline |
Initialize the search state for thread-safe execution.
SeachState()
.
|
inline |
Incorporate the mismatch cache from state
into the cache for this SimpleBarcodeSearch
instance. This allows regular consolidation of optimizations across threads. On return, the mismatch cache of state
is combined with that of this instance.
state | A state object generated by initialize() . Typically this has already been used in search() . |
|
inline |
Search the known sequences in the barcode pool for an input sequence. The number of allowed mismatches in each segment is equal to the maximum specified in the constructor.
search_seq | The input sequence to use for searching. This is expected to have the same length as the known sequences. |
state | A state object generated by initialize() . On return, state is filled with the details of the best-matching barcode sequence, if any exists. |
|
inline |
Search the known sequences in the barcode pool for an input sequence, with potentially more stringent mismatch requirements for each segment. This can improve efficiency in situations where some mismatches have already been consumed by matching the template sequence.
search_seq | The input sequence to use for searching. This is expected to have the same length as the known sequences. |
state | A state object generated by initialize() . On return, state is filled with the details of the best-matching barcode sequence, if any exists. |
allowed_mismatches | Allowed number of mismatches in each segment. Each value should not be greater than the corresponding maximum specified in the constructor. |