Hello I encountered something strange. When I use:
samtools index sample.bam
I see no output, error message, or new file.
Then I tried it w/o the file name:
samtools index
I see something I expect to see:
Usage: samtools index [-bc] [-m INT] <in.bam> [out.index]
Options:
-b Generate BAI-format index for BAM files [default]
-c Generate CSI-format index for BAM files
-m INT Set minimum interval size for CSI indices to 2^INT [14]
So what exact was the issue? I have not seen samtools index acting like this before. Any advice? Thank you so much!
=========
Updated 05/06/2017 Like advised in the comments, the issue was that I did not sort my input bam, which was generated by extracting one chromosome from a large sorted bam file. Apparently, I need to sort it again:
samtools sort sample.bam sample.sort
#Note samtools sort will add ".bam" extension to output automatically and therefore I did not add ".bam" to "sample.sort"
Then do
samtools index sample.sort.bam
After you
samtools index sample.bam
, tryecho $?
, which will return the number that samtools exited with. My guess is that it's not 0 (though I don't really know that it sets an appropriate exit code in all cases).Thanks for the suggestions.