I'm running STAR to align RNA-seq reads separately to paternal and maternal genomes for subsequent analysis of allele-specific expression with GATK tools. So as an output I have two BAM files.
I want to keep reads aligned uniquely to only one genome and in cases where reads mapped uniquely to both genomes, use the alignment with the higher alignment quality.
Are there any existing tools for it? I can write a script doing this but I would prefer to use existing tool if there is one.