rust-bio / rust-bio-types

A library of common biomedical types.
MIT License
34 stars 15 forks source link

Error prettry print suffix xclip or yclip #47

Open kwuiee opened 1 year ago

kwuiee commented 1 year ago

When xclip or yclip is suffix, pretty print gives wrong sequence, the problem lies in src/alignment.rs file where you should skip x_i and y_i bases before actual clip sequence, I think, like below

图片

dcroote commented 1 year ago

Thanks for raising this issue @kwuiee. Do you have a simple test case for reproducing it? We could then use the test case in our CI test suite along with the fix.

kwuiee commented 1 year ago

The following should do @dcroote, aligning TCGC against ATCG

 let alignment = Alignment {
    score: -7,
    ystart: 1,
    xstart: 0,
    yend: 4,
    xend: 3,
    ylen: 4,
    xlen: 4,
    operations: vec![Yclip(1), Match, Match, Match, Xclip(1)],
    mode: AlignmentMode::Custom,
};
let pretty = concat!(" TCGC\n ||| \nATCG \n\n\n");
assert_eq!(alignment.pretty(b"TCGC", b"ATCG", 100), pretty);