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