Crates.io | seqalign |
lib.rs | seqalign |
version | 0.2.3 |
source | src |
created_at | 2018-03-09 11:36:33.064149 |
updated_at | 2022-08-22 18:43:06.694314 |
description | Sequence alignment using edit operations |
homepage | https://github.com/danieldk/seqalign |
repository | https://github.com/danieldk/seqalign |
max_upload_size | |
id | 54674 |
size | 49,357 |
This crate implements commonly-used sequence alignment methods based on edit operations. There are multiple crates available to compute edit distances. However, to my knowledge there was no crate that supports all of the following seqalign features:
use seqalign::Align;
use seqalign::measures::LevenshteinDamerau;
let incorrect = &['t', 'p', 'y', 'o'];
let correct = &['t', 'y', 'p', 'o', 's'];
let measure = LevenshteinDamerau::new(1, 1, 1, 1);
let alignment = measure.align(incorrect, correct);
// Get the edit distance
assert_eq!(2, alignment.distance());
// Get the edit script.
use seqalign::measures::LevenshteinDamerauOp;
use seqalign::op::IndexedOperation;
assert_eq!(vec![
IndexedOperation::new(LevenshteinDamerauOp::Match, 0, 0),
IndexedOperation::new(LevenshteinDamerauOp::Transpose(1), 1, 1),
IndexedOperation::new(LevenshteinDamerauOp::Match, 3, 3),
IndexedOperation::new(LevenshteinDamerauOp::Insert(1), 4, 4)
], alignment.edit_script());