Entering edit mode
3.4 years ago
Kai_Qi
▴
130
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,
As explanation,
cat
simply concatenates two files. Inappropriate for BAM files since they have header structures etc.samtools cat
would be more appropriate whereasmerge
keeps the sort order. Theindex
command requires coordinate-sorted files. In any case you have to sort the files, either the input files and then usemerge
or usesamtools cat
and then sort this file, then index.