tools.bwa.filter_sam_on_alignment_score populates a python dict for every read ID it sees on input. This means that simple tasks like spike-in counting on a >10-100M read bam file will fail on a 7GB RAM machine. Ideally convert to an O(1) implementation if possible, or, failing that, convert to a sqlite disk-backed solution.