Limiting the alignment range to only the mutation cluster hides a lot of good cases.
This is because the cluster is often only a few bases long (i.e. the alignment ranges only span a few bases), but the minimum length for a "good" template switch case is larger than that. Even if the equal-cost-ranges find the possibility to extend the switch by many tens of bases, the TS is not found in the first place by the aligner. This applies to both FPA and tsalign. Test data to reproduce: the test bam in the repo (cli/tests/data/reads). The TSes are 7 long, but the default cost gives quite a large penalty for TS of length \< 8. This means that the TS is not found, even though it is potentially 97 bases long (EQ ranges \[-45,0\] and \[0,45\], inner cigar 7M). The proper solution is hard to pinpoint. The cause is some wrong assumptions I think. We can, for now, add a few bases to both sides of the range. This should catch at least most of these cases. Note that this also interacts with the clustering algorithm, at least with the "cluster-max-gap" parameter. @aloytyno @sebschmi fyi.
issue