template<simd_concept simd_score_t, semialphabet alphabet_t, typename alignment_t>
class seqan3::detail::simd_match_mismatch_scoring_scheme< simd_score_t, alphabet_t, alignment_t >
A vectorised scoring scheme handling matches and mismatches only.
- Template Parameters
-
Wraps a regular scoring scheme by extracting the scores for a match and a mismatch and converts them into seqan3::detail::simd vectors. Only symmetric scoring schemes are preserved, i.e. in the vectorised scoring scheme elements with the same rank are assigned the match score and elements with a different rank are assigned the mismatch score. Note during the conversion to the simd vectors the alphabet type information is lost and only the ranks of the alphabet are used.
Handling special padding symbols
During the vectorised alignment multiple sequences are packed into one simd vector. To handle sequences with different sizes in the vectorised alignment algorithm the smaller sequences are filled up with special padding symbols. These padding symbols are chosen in a way that allows the computation of the alignments without the need of masking the results for invalid positions within the matrix because a specific position might have exceeded the original sequence size. To do so, the global alignment uses the same padding symbol for the first sequence pack and the second sequence pack. This padding symbol is distinct to any symbol in the underlying alphabet of the sequences. The score function is adapted in a way that a comparison with a padding symbol always yields a match. Thus, after the end of a sequence within the pack is reached the score can only grow. The respective score can then be inferred from the projected position of the last row or column of the vectorised matrix depending on the the corresponding alignment configuration.
In case of the local alignment the second sequence pack are padded with a symbol that is distinct to any symbol of the corresponding alphabet and to the padding symbol of the first sequence pack. Comparing any symbol with the padding symbols will yield a mismatch, such that the score can only get smaller after the end of a sequence has reached. This way the specific optimum of one sequence pair in the pack is not affected during the computation of the vectorised alignment.
template<simd_concept simd_score_t, semialphabet alphabet_t, typename alignment_t >
template<typename scoring_scheme_t >
Initialises the simd vector match score and mismatch score from the given scoring scheme.
- Template Parameters
-
scoring_scheme_t | The type of the underlying scoring scheme; must model seqan3::scoring_scheme for alphabet_t . |
- Parameters
-
[in] | scoring_scheme | The scoring scheme to initialise the vectorised match and mismatch score from. |
- Exceptions
-
std::invalid_argument | if the value of the match or mismatch score exceed the value range of the scalar type of the used simd vector type simd_score_t . |
Obtains the score for a match and a mismatch respectively and fills the corresponding simd vectors with these scores. In addition, some safety checks are performed in order to avoid that a score is used which cannot be represented by the scalar type of the used simd vector.
template<simd_concept simd_score_t, semialphabet alphabet_t, typename alignment_t >
template<typename scoring_scheme_t >
Initialises the simd vector match score and mismatch score from the given scoring scheme.
- Template Parameters
-
scoring_scheme_t | The type of the underlying scoring scheme; must model seqan3::scoring_scheme for alphabet_t . |
- Parameters
-
[in] | scoring_scheme | The scoring scheme to initialise the vectorised match and mismatch score from. |
- Exceptions
-
std::invalid_argument | if the value of the match or mismatch score exceed the value range of the scalar type of the used simd vector type simd_score_t . |
Obtains the score for a match and a mismatch respectively and fills the corresponding simd vectors with these scores. In addition, some safety checks are performed in order to avoid that a score is used which cannot be represented by the scalar type of the used simd vector.
template<simd_concept simd_score_t, semialphabet alphabet_t, typename alignment_t >
template<typename scoring_scheme_t >
Initialises the simd vector match score and mismatch score from the given scoring scheme.
- Template Parameters
-
scoring_scheme_t | The type of the underlying scoring scheme; must model seqan3::scoring_scheme for alphabet_t . |
- Parameters
-
[in] | scoring_scheme | The scoring scheme to initialise the vectorised match and mismatch score from. |
- Exceptions
-
std::invalid_argument | if the value of the match or mismatch score exceed the value range of the scalar type of the used simd vector type simd_score_t . |
Obtains the score for a match and a mismatch respectively and fills the corresponding simd vectors with these scores. In addition, some safety checks are performed in order to avoid that a score is used which cannot be represented by the scalar type of the used simd vector.
template<simd_concept simd_score_t, semialphabet alphabet_t, typename alignment_t >
Computes the score for two simd vectors.
- Parameters
-
[in] | ranks1 | The alphabet ranks of the first operand. |
[in] | ranks2 | The alphabet ranks of the second operand. |
- Returns
- The simd score with match and mismatch scores after comparing both input operands.
This function compares packed elements in both simd vectors and returns a new simd vector filled with match and mismatch scores depending on the result of the comparison. For global alignments the comparison yields a match if any of the elements is a padding symbol. The padding symbol must have the signed bit set. For local alignments two different padding symbols are assumed, which will always yield a mismatch when compared with any other symbol.
Exception
No-throw guarantee.
Complexity
Constant.
Thread safety
Thread-safe.