GoodDay Guys!
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. I ran samtools sort
on a sam file (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.
Thanks
Hi Devon,
PIPESTATUS would not help in this case, as I ran the command on a computenode on cluster. Now, I can't enter same node and run as the PIPESTATUS as it would have be over-written with other fresh pipeouts. But its a good thing to keep in mind.
The merged file is truncated and counting fails, so I am merging them.
Thanks
I didn't know the PIPESTATUS variable, thanks for mentioning it! It's been bugging me that echo "$?" returns the exit code of the last command in the pipe!