Thank you! I'm a bit shocked that samtools does not have this option by default. As you can see from the example above, all of those flags are not set in the alignment I obtained from hisat2.
I'll ask in the samtools mailing list. Another interesting thing I realised samtools is not capable of is to "cap" a BAM file at a certain coverage. Seems like such as basic and useful task, I'm really surprised it's not one of the options.
That example read is missing the 'mapped in proper pair' flag, which is generally not set when the mate is on a different chromosome. You should be able to filter out those reads with
samtools view -f2 infile.bam.I wanted to retain single-end mappings though. I am very surprised that there are no specific options to filter chimeric reads from
samtools(I guess there's a flag that needs to be set, so technically that's the mapper's fault, but still)What is the relevance of the
CRAMandSAMtags here?No special relevance, but the question can be applied to all 3 formats, so I decided to add them just for the hell of it.