Open thekugelmeister opened 1 year ago
In investigating this error, I managed to get pysam
to throw the following warning:
[E::bam_parse_basemod] MM tag refers to bases beyond sequence length
Thus far, I have only been able to get this to occur when attempting to TAB auto-complete methods for a pysam.AlignedSegment
object that has this sort of malformed MM/ML tags. I have been unable to trigger this warning in other ways, despite my best efforts.
Search results for this warning in the pysam
github repo: https://github.com/pysam-developers/pysam/search?q=MM+tag+refers+to+bases+beyond+sequence+length
Tracking here: https://streets-lab.atlassian.net/browse/DM-67
For malformed BAM files, the number of bases specified in the MM/ML tags may be greater than the number of bases in a read. When this happens,
pysam
appears content to allow normal operation until attempting to access one of these out-of-bounds bases, then throws an index error, causing a traceback like the following:There should be a check added to prevent such an error from occurring / improve error readability.