pezmaster31 / bamtools

C++ API & command-line toolkit for working with BAM data
MIT License
418 stars 153 forks source link

Unnecessary space in BamAlignment object? #226

Open rlorigro opened 2 years ago

rlorigro commented 2 years ago

Not sure if this is intentional or not, but there are two fields in the BamAlignment class which seem to be oversized:

https://github.com/pezmaster31/bamtools/blob/2bd8699bbb8e2f1fb0677d44049bddbb7fe39419/src/api/BamAlignment.h#L135 https://github.com/pezmaster31/bamtools/blob/2bd8699bbb8e2f1fb0677d44049bddbb7fe39419/src/api/BamAlignment.h#L136

mapq has a maximum value of 255 so an 8bit integer would suffice, and there are only 12 boolean fields in the flag, so a 16 bit integer would be enough. You can confirm this on the SAM format spec by looking at the "Range" column in section 1.4:

https://samtools.github.io/hts-specs/SAMv1.pdf