I have been trying to generate sorted.bam files. but haven't been successful. each time I get numerous sorted.bam files individually and I want to merge them into one big sorted.bam. The following command was what is used to obtain this multiple bamfiles.
-S dustMapping.sam && samtools view -S -b dustMapping.sam -o dustMapping.bam && samtools sort dustMapping.bam -odustMapping.sorted.bam && samtools index dustMapping.sorted.bam -o dustMapping.sorted.bam.bai && rm dustMapping.sam && dustMapping.bam
I don't know if the sorting was completed and why and the program terminates after outputting the sorted bam files. I have tried to merge with the following command.
bamtools merge -list folder.bam -out sorted.bam and I got a 64byte sorted.bam output file. what could be wrong please? (Im a Beginner) Thanks
One likely can't merge the tmp files produced during sort manually. Sorting process, when it completes normally, will automatically delete the tmp files. You may need to assign more RAM to the sort process and/or make sure that you are not running out of disk space during the sorting.
samtools index
command does not need a-o
directive.Oh OK. But How do I do that? Im working in a 500Gb external hard drive and has about 250GB of space.
Okay, first step to debugging this...I'd do things one at a time instead of stringing them all together. Confirm whether or not dustMapping.sorted.bam is being made (is "-odustMapping.sorted.bam" in your commandline, or just a typo here?)
Worst case scenario, you can cut your fastq into smaller pieces that are sortable, and maybe you can merge them all after.
Ok let me try doing the commands one after the other. The -o is a typo. thanks. Will let you know how it goes