Samtools index and sambamba-depth error?
0
0
Entering edit mode
13 months ago
MobiusT ▴ 20

I have the following script

samtools index dataset01.bam
basename dataset01.bam
f="$(basename -- dataset01.bam)"
sambamba depth base -L genomic.bed dataset01.bam > ./read_depths/"$f.txt"

I run this script with a whole genome dataset and after that is gives the following error.

samtools index: failed to create or write index
dataset001.bam
sambamba-depth: All files must be coordinate-sorted

What can be the reason for this and it takes more than half a day running so any help could save my time.

I use a conda environment and use the following versions

  • sambamba=0.6.6=2
  • samtools=1.7=1
linux samtools sambamba • 687 views
ADD COMMENT
0
Entering edit mode
samtools index: failed to create or write index

you first have to find why samtools failed at this point: is the bam sorted on coordinate ? is the directory writeable ? etc....

ADD REPLY
0
Entering edit mode

sambamba-depth: All files must be coordinate-sorted

Does this not answer your question? Your files must be sorted prior to indexing, or doing pretty much any genomic-coordinate based analysis. Samtools should give a clearer error message. It gives more information now, but it's still not crystal clear IMO. This also implies you're using an out-dated version of samtools.

Try looking at the samtools sort man page for detailed usage.

ADD REPLY

Login before adding your answer.

Traffic: 2898 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