I was wondering if anybody could explain the following:
Samtools 1.5 on a SGE setup (modules available are Samtools 0.1.19, 1.2 or 1.5), Calling Samtools from within a shell script.
If I run this sort command:
samtools sort -n contig_XXX_mapped.latest.all.bam -o contig_XXX_mapped.sorted.bam
Then I get a bam file contig_XXX_mapped.sorted.bam in the relevant folder
If I then run:
samtools index contig_XXX_mapped.sorted.bam
We get the error: samtools index: failed to create index for "contig_XXX_mapped.sorted.bam": No such file or directory - as stated that file does exist.
Repeating the sort command without '-n' works just fine - an output file of the same name is created and is indexed.
I cannot find an explanation for this behaviour and I was wondering if anybody could explain it to me?