rrwick / Polypolish

a short-read polishing tool for long-read assemblies
GNU General Public License v3.0
146 stars 10 forks source link

Suggestion for local realignment #22

Closed YannDussert closed 7 months ago

YannDussert commented 7 months ago

Hi,

First thanks for developing Polypolish!

About your search for a way to do local realignment before polishing: freebayes includes a local realignment module, bamleftalign (https://github.com/freebayes/freebayes/blob/master/src/bamleftalign.cpp). Not sure at all it suits your needs, but I thought I should mention it.

Best regards, Yann

rrwick commented 7 months ago

Thank you for that, but if I'm understanding correctly, this tool does left alignment not local realignment.

For example, it would take this alignment:

read: ACGAT--CG
ref:  ACGATATCG

And turn it into this:

read: ACG--ATCG
ref:  ACGATATCG

This helps multiple alignments over the same region to agree with each other, but it acts on each alignment individually, so it's not quite the same thing as local realignment.

Even though I still haven't found an easy way to do local realignment before Polypolish, I suspect it wouldn't make too much difference. It would likely only affect alignments that end near an indel, so in most cases there should be plenty of reads which have the indel in their middle, allowing Polypolish to fix the error.

Ryan