samtools view - f 4 collects all unmapped which includes some assigned to the chunks. Apparently it the mate of a read is mapped it gets assigned to the same chromosome. This results is some duplicates entries after merging and also makes the final.bam no longer sorted. samtools view - f 13 instead filters for reads where both the mate and read are unmapped.
samtools view - f 4
collects all unmapped which includes some assigned to the chunks. Apparently it the mate of a read is mapped it gets assigned to the same chromosome. This results is some duplicates entries after merging and also makes thefinal.bam
no longer sorted.samtools view - f 13
instead filters for reads where both the mate and read are unmapped.