Any efficient way to split the bam file to two separate files, say one file with only singletons(mate unmapped) and other with paired reads(no matter if it is discordant).
I have already used.
(i) samtools view -f 8 -F 4 -b foo.bam > foo.singletons.bam
(ii) samtools view -f 1 -F 12 -b foo.bam > foo.paired.bam
Is this correct solution to go ahead.
PS: This file has already been filtered for uniquely mapped reads using NH:i:1 tags.