You don't need to specify -o when you index the sorted file. Just samtools index dustMapping.sorted.bam will produce dustMapping.sorted.bam.bai
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
1 answer
Thanks everyone, I was able to obtain my sorted.bam file. But when I tried to generate the .bai file, the output i get renamed to "-o". the command I ran was
samtools index dustMapping.sorted.bam -o dustMapping.sorted.bam.bai
is this normal? or I have the right .bai file
Oh. Thanks a lot. I will do that
Log in to answer this question.
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 indexcommand does not need a-odirective.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