Skip to content
Snippets Groups Projects
Commit 45594c0a authored by Martin Larralde's avatar Martin Larralde
Browse files

Add method to explicitly convert a `WeightMatrix` to a `ScoringMatrix`

parent c7bee48d
No related branches found
No related tags found
No related merge requests found
......@@ -227,6 +227,18 @@ impl<A: Alphabet, const K: usize> WeightMatrix<A, K> {
self.clone()
}
}
/// Get a position-specific scoring matrix from this position weight matrix.
pub fn to_scoring(&self) -> ScoringMatrix<A, K> {
let background = self.background.clone();
let mut data = self.data.clone();
for row in data.iter_mut() {
for item in row.iter_mut() {
*item = item.log2();
}
}
ScoringMatrix { background, data }
}
}
impl<A: Alphabet, const K: usize> AsRef<WeightMatrix<A, K>> for WeightMatrix<A, K> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment