Is there a tool that removes PCR duplicates from a BAM file if they are above the background levels of the region? I don't mean remove all PCR duplicates just by position; sometimes you have two reads with identical positions originating from two molecules legitimately. I mean cases where there is extreme pileup of one position that sticks out greatly over background positions and therefore should be removed (either completely or reduce to the "average" coverage of the region). Is there a tool that does that efficiently for BAM files? If I understand samtools rmdup
correctly, it will remove any reads that start in the same position and consider those duplicates, which is not the behavior I'm looking for.