Entering edit mode
5.0 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,
catsimply concatenates two files. Inappropriate for BAM files since they have header structures etc.samtools catwould be more appropriate whereasmergekeeps the sort order. Theindexcommand requires coordinate-sorted files. In any case you have to sort the files, either the input files and then usemergeor usesamtools catand then sort this file, then index.