No output from samtools index?
1
0
Entering edit mode
7.0 years ago
DVA ▴ 630

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
samtools • 4.1k views
ADD COMMENT
1
Entering edit mode

After you samtools index sample.bam, try echo $?, 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).

ADD REPLY
0
Entering edit mode

Thanks for the suggestions.

ADD REPLY
3
Entering edit mode
7.0 years ago
GenoMax 141k

Have you sorted the BAM file?

ADD COMMENT
0
Entering edit mode

Thank you it was indeed the issue. My input bam resulted from extraction of one chromosome of a sorted large bam. I thought the sorting was no longer needed.

ADD REPLY
0
Entering edit mode

.toggled status to accepted.

ADD REPLY

Login before adding your answer.

Traffic: 1462 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6