kaori
A C++ library for barcode extraction and matching
|
Search against known barcodes. More...
#include <BarcodeSearch.hpp>
Classes | |
struct | Options |
Optional parameters for SimpleBarcodeSearch . More... | |
struct | State |
State of the search. More... | |
Public Member Functions | |
SimpleBarcodeSearch ()=default | |
SimpleBarcodeSearch (const BarcodePool &barcode_pool, 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, int allowed_mismatches) const |
Search against known barcodes.
Given an input sequence, this class performs exact and mismatch-aware searches against a pool of known barcodes. Mismatches may be distributed anywhere along the length of the sequence, see AnyMismatches
for details. Caching is used to avoid redundant work when a mismatching sequence has been previously encountered.
|
default |
Default constructor. This is only provided for composition purposes; methods of this class should only be called on properly constructed instance.
|
inline |
barcode_pool | Pool of barcode sequences. |
options | Further options. |
|
inline |
|
inline |
Incorporate the mismatch cache from state
into the cache for this SimpleBarcodeSearch
instance. This enables regular synchronization of the cache (and its related search optimizations) across threads.
state | A state object generated by initialize() . Typically this has already been used in search() at least once. |
|
inline |
Search the known sequences in the barcode pool against an input sequence. The number of allowed mismatches is equal to the Options::max_mismatches
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 a user-supplied number of allowed mismatches. It is expected that allowed_mismatches
is no greater than the Options::max_mismatches
specified in the constructor. Lower values can improve efficiency in situations where some mismatches have already been "used up", e.g., by matching the template sequence in ScanTemplate
.
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. This should not be greater than the Options::max_mismatches specified in the constructor. |