Dear Pierre,
I have tried your tool to filter mappings with a minimal mapped length. I see that your filtering is based on the mapped length measured on the reference. I have encountered mapping with CIGAR looking like this 106S8M1D21M14S. Based on your command the mapping does not get filtered out when I set the value to >=30. This is correct since you measure by the mapping length calculated from the reference. The mapped read length measured on the reference is 30 (8M+1D+21M). But, if we would count the mapped length from the read itself we would get just 29 (8M+21M). I could imagine an extreme case with special mappings (which would be reported for whatever reason) with a lot of insertions/deletions "closed" between several mapped regions. I assume your filtering would keep such mappings because the mapped length measured by the reference would be still OK. However, I would not consider such mappings as "correct" which I would like to keep.
FInaly for my question - Is there an option in your tool to filter by mapped length calculated from the read itself and not from the reference?
read length or alignment lenth ?
As I am already using mapped.bam so its obvious. its aligned reads.
Some aligners using soft-clipping, which let the read length untouched but the alignment length can be shorter (see e.g. here)