Hi Kim,
I do not know if you figured out a way yet, but there are other aligners than BWA you could use. NovoAlign allows you to drop the reads that map to more than one place in the genome.
Alternatively, and because BWA is a very good aligner with many great options, you good trim your SAM files yourself using basic unix scripting.
For paralogous sequences, a three step filter can be used:
1. As you know already, a read could map to more than one area in the genome. BWA will indeed report the best alignment as the main alignment, but will include the other alignment found at the end of the line of that read, under a parameter called XA. It should look like this in your file: XA:Z:scaffold01899,+9941,90M,4;
This gives you the chromosome/scaffold it maps to, if it is forward or reverse, the position of the first nucleotide, the cigar string (very useful for further filtering) and finally the mapping quality of this alternate mapping. What you could do is grep the name of all the loci showing reads mapping to them and having this XA column at the end.
2. Alternatively to the grep (but maybe less precise), it is known that having an alternative mapping will bring the mapping score down for the read considered. You could filter your SAM file to only keep loci with a mapping quality of at least 25 (cat yourfile.sam | awk '$5 > 24 {print $0}' > newfile.sam)
3. Another type of paralogous behaviour in a SAM file is linked with loci depth: you could have reads coming from two paralogs in in sequencing pannel, but your reference genome, but your reference genome assembled only one of those paralogous sequences. Then you should see a bias in the depth of the locus compared to the other, and have a lot of reads mapping there. You could do a grep and count the unique occurrence. You would have a rough idea of which loci can be problematic and decide to remove them from all individuals...
(cat yourfile.sam | awk '{print $3 "_" $4"}' | sort | uniq -c > loci_coverage.txt). The number on the right hand should be the depth of the locus, open the file with excel, sort by depth, calculate the mean or median depth and decide of a cut off for acceptable upper limit depth (like, 4 time the median individual depth maximum).
Also to remember, you could also filter according to the max number of substitution you would allow between your sample and the reference genome. This number is reported in column 12 of your SAM file. However, if you are aligning on a genome that is not your species, you would expect higher number of substitutions for certain reads...
I hope this helps.
Cheers
Celine