I have a sam file (BWA output, paired-end reads). I would like to retain only reads which are "properly paired". This I would do by:
samtools view -f 0x002 file.sam > file_filtered.sam
Additionally I would like to retain only those pairs of reads where both reads have the XT:A:U tag. It is important to me that after the filterting step I still have the pairs together (so read1, read2, read1, read2, ...).
Any ideas how to do so?
Thanks for any help! Stefanie