pub fn matrix_lookup(
triplet: &[u8],
matrix: &NucMatrix,
) -> Result<f64, MatrixLookupError>Expand description
Looks up a value in a nucleotide matrix based on a triplet of nucleotides.
This is the convenience form taking an arbitrary slice. The hot path decodes once with
triplet_indices and then calls lookup_by_index per matrix instead.
§Arguments
triplet- A slice of u8 representing a triplet of nucleotides. Each u8 should be the ASCII value of ‘A’, ‘C’, ‘G’, or ‘T’, upper or lower case.matrix- A reference to aNucMatrixto look up the value in.
§Returns
If the triplet is of length 3 and every base is recognized, this function returns a Result
containing the value at the corresponding position in the matrix. Otherwise it returns a
Result containing a MatrixLookupError.
§Errors
Returns a MatrixLookupError if the triplet is not of length 3, or if it contains a base
that is not A, C, G, or T. These are reported as distinct errors rather than being conflated.