Thank you so much!!!
I'm sure this is a dumb question, but I've got a workflow in galaxy that trims adapters, removes duplicates, and then filters for quality and to get only reads whose partner is mapped. The following analysis complains that it can't find the mate for a ton of reads. I looked at the sam file and discovered that there are indeed singletons with no mate, but the individual sam records claim the mate is mapped, which is why I'm guessing the filtering "mapping_quality >= 20 and not (unmapped or mate_is_unmapped)" isn't working.
Is there a tool that can repair the records for mates that have been filtered?
1 answer
Yes, samtools fixmate. It will modify that flag of the retained read and will set it to unpaired if the mate has been filtered out. It requires name-sorted files. http://www.htslib.org/doc/samtools.html
Log in to answer this question.