kaori
A C++ library for barcode extraction and matching
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | List of all members
kaori::MismatchTrie Class Reference

Base class for the mismatch search. More...

#include <MismatchTrie.hpp>

Inheritance diagram for kaori::MismatchTrie:
Inheritance graph
[legend]

Classes

struct  AddStatus
 Status of the barcode sequence addition. More...
 

Public Member Functions

 MismatchTrie ()
 
 MismatchTrie (size_t barcode_length, DuplicateAction duplicates)
 
AddStatus add (const char *barcode_seq)
 
size_t get_length () const
 
int size () const
 
void optimize ()
 

Static Public Attributes

static constexpr int STATUS_MISSING = -1
 
static constexpr int STATUS_AMBIGUOUS = -2
 

Detailed Description

Base class for the mismatch search.

Given a (typically read-derived) sequence, this class will perform a mismatch-aware search to a pool of known barcode sequences. It will then return the barcode with the fewest mismatches to the input sequence. Any number of mismatches are supported; subclasses will decide how the mismatches can be distributed throughout the length of the sequence.

Constructor & Destructor Documentation

◆ MismatchTrie() [1/2]

kaori::MismatchTrie::MismatchTrie ( )
inline

Default constructor. This is only provided to enable composition, the resulting object should not be used until it is copy-assigned to a properly constructed instance.

◆ MismatchTrie() [2/2]

kaori::MismatchTrie::MismatchTrie ( size_t  barcode_length,
DuplicateAction  duplicates 
)
inline
Parameters
barcode_lengthLength of the barcodes in the pool.
duplicatesHow duplicate sequences across add() calls should be handled.

Member Function Documentation

◆ add()

AddStatus kaori::MismatchTrie::add ( const char *  barcode_seq)
inline
Parameters
[in]barcode_seqPointer to a character array containing a barcode sequence. The array should have length equal to get_length() and should only contain IUPAC nucleotides or their lower-case equivalents (excepting U or gap characters).
Returns
The barcode sequence is added to the trie. The index of the newly added sequence is defined as the number of sequences that were previously added. The status of the addition is returned.

◆ get_length()

size_t kaori::MismatchTrie::get_length ( ) const
inline
Returns
The length of the barcode sequences.

◆ optimize()

void kaori::MismatchTrie::optimize ( )
inline

Attempt to optimize the trie for more cache-friendly look-ups. This is not necessary if sorted sequences are supplied in add().

◆ size()

int kaori::MismatchTrie::size ( ) const
inline
Returns
The number of barcode sequences added.

Member Data Documentation

◆ STATUS_AMBIGUOUS

constexpr int kaori::MismatchTrie::STATUS_AMBIGUOUS = -2
staticconstexpr

Ambiguous match to two or more known barcodes.

◆ STATUS_MISSING

constexpr int kaori::MismatchTrie::STATUS_MISSING = -1
staticconstexpr

No match to a known barcode.


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