As explanation, cat simply concatenates two files. Inappropriate for BAM files since they have header structures etc. samtools cat would be more appropriate whereas merge keeps the sort order. The index command requires coordinate-sorted files. In any case you have to sort the files, either the input files and then use merge or use samtools cat and then sort this file, then index.
samtools index cannot index concatenated bam?
Hi:
I have a quick question. I have 2 bam files generated from STAR. I used cat file1.bam file2.bam > combined.bam to put them together. Now I want to get it index using samtools index combined.bam but got an error:
samtools index: failed to create index for "GRCh37_combined_Aligned.sortedByCoord.out.bam": No such file or directory
.
Is this normal?
Thanks,
• 1,876 views
•
link
1 answer
You can't just cat bam files. Use samtools merge instead.
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.