It seldom happens to me that samtools sort leaves the temporary files behind.
samtools sort : This command will also create temporary filesout.prefix.%d.bam as needed when the entire alignment data cannot fit into memory (as controlled via the -m option)
Ex. file.001.bam file.002.bam .......... file.00X.bam
A normal course is these split up files are merged later on to a single BAM file and deleted.
sort on a samfile (22G) and it generated an output of 2.9G
samtools view -bSh file.sam | samtools sort - file.sam.sorted
But, now I am not sure if the samtools sort finished normally or not (because of these files left behind). How can I confirm that, rather than just running it again.
I think it's not right to just concatenate all the temporary files, (which I did) outputted a BAM file of 6.7G. There is the discrepancy.